public interface CustomerService
| Modifier and Type | Method and Description |
|---|---|
void |
addPostRegisterListener(PostRegistrationObserver postRegisterListeners) |
Customer |
changePassword(PasswordChange passwordChange) |
GenericResponse |
checkPasswordResetToken(String token)
Deprecated.
checkPasswordResetToken(String, Customer), this will be removed in 4.2 |
GenericResponse |
checkPasswordResetToken(String token,
Customer customer)
Verifies that a customer has a valid token.
|
Customer |
createCustomer() |
Customer |
createCustomerFromId(Long customerId)
|
Customer |
createNewCustomer()
Returns a non-persisted
Customer. |
void |
createRegisteredCustomerRoles(Customer customer)
Subclassed implementations can assign unique roles for various customer types
|
void |
deleteCustomer(Customer customer)
Delete the customer entity from the persistent store
|
String |
encodePassword(String rawPassword)
Encodes the clear text parameter, using the salt provided by PasswordEncoder.
|
String |
encodePassword(String rawPassword,
Customer customer)
Deprecated.
the new
PasswordEncoder handles salting internally, this will be removed in 4.2 |
Long |
findNextCustomerId()
Allow customers to call from subclassed service.
|
List<PasswordUpdatedHandler> |
getPasswordChangedHandlers() |
List<PasswordUpdatedHandler> |
getPasswordResetHandlers() |
String |
getSalt()
Deprecated.
use
getSaltSource() instead, this will be removed in 4.2 |
Object |
getSalt(Customer customer)
Deprecated.
use
getSalt(Customer, String) instead, this will be removed in 4.2 |
Object |
getSalt(Customer customer,
String unencodedPassword)
Deprecated.
the new
PasswordEncoder handles salting internally, this will be removed in 4.2 |
org.springframework.security.authentication.dao.SaltSource |
getSaltSource()
Deprecated.
the new
PasswordEncoder handles salting internally, this will be removed in 4.2 |
boolean |
isPasswordValid(String rawPassword,
String encodedPassword)
Determines if a password is valid by comparing it to the encoded string, salting is handled internally to the
PasswordEncoder. |
boolean |
isPasswordValid(String rawPassword,
String encodedPassword,
Customer customer)
Deprecated.
the new
PasswordEncoder handles salting internally, this will be removed in 4.2 |
Customer |
readCustomerByEmail(String emailAddress) |
Customer |
readCustomerById(Long userId) |
Customer |
readCustomerByUsername(String customerName) |
Customer |
readCustomerByUsername(String username,
Boolean cacheable) |
Customer |
registerCustomer(Customer customer,
String password,
String passwordConfirm) |
void |
removePostRegisterListener(PostRegistrationObserver postRegisterListeners) |
Customer |
resetPassword(PasswordReset passwordReset) |
GenericResponse |
resetPasswordUsingToken(String username,
String token,
String password,
String confirmPassword)
Updates the password for the passed in customer only if the passed
in token is valid for that customer.
|
Customer |
saveCustomer(Customer customer) |
Customer |
saveCustomer(Customer customer,
boolean register) |
GenericResponse |
sendForgotPasswordNotification(String userName,
String forgotPasswordUrl)
Generates an access token and then emails the user.
|
GenericResponse |
sendForgotUsernameNotification(String emailAddress)
Looks up the corresponding
Customer and emails the address on file with
the associated username. |
void |
setPasswordChangedHandlers(List<PasswordUpdatedHandler> passwordChangedHandlers) |
void |
setPasswordResetHandlers(List<PasswordUpdatedHandler> passwordResetHandlers) |
void |
setSalt(String salt)
Deprecated.
use
setSaltSource(SaltSource) instead, this will be removed in 4.2 |
void |
setSaltSource(org.springframework.security.authentication.dao.SaltSource saltSource)
Deprecated.
the new
PasswordEncoder handles salting internally, this will be removed in 4.2 |
Customer registerCustomer(Customer customer, String password, String passwordConfirm)
Customer changePassword(PasswordChange passwordChange)
Customer createCustomer()
void deleteCustomer(Customer customer)
customer - the customer entity to removeCustomer createCustomerFromId(Long customerId)
Customer by first looking in the database, otherwise creating a new non-persisted CustomercustomerId - the id of the customer to lookupCustomer createNewCustomer()
Customer. Typically used with registering a new customer.void createRegisteredCustomerRoles(Customer customer)
customer - Customer to create roles forvoid addPostRegisterListener(PostRegistrationObserver postRegisterListeners)
void removePostRegisterListener(PostRegistrationObserver postRegisterListeners)
Customer resetPassword(PasswordReset passwordReset)
List<PasswordUpdatedHandler> getPasswordResetHandlers()
void setPasswordResetHandlers(List<PasswordUpdatedHandler> passwordResetHandlers)
List<PasswordUpdatedHandler> getPasswordChangedHandlers()
void setPasswordChangedHandlers(List<PasswordUpdatedHandler> passwordChangedHandlers)
GenericResponse sendForgotUsernameNotification(String emailAddress)
Customer and emails the address on file with
the associated username.emailAddress - user's email addressGenericResponse sendForgotPasswordNotification(String userName, String forgotPasswordUrl)
userName - - the user to send a reset password email to.forgotPasswordUrl - - Base url to include in the email.GenericResponse resetPasswordUsingToken(String username, String token, String password, String confirmPassword)
username - Username of the customertoken - Valid reset tokenpassword - new password@Deprecated GenericResponse checkPasswordResetToken(String token)
checkPasswordResetToken(String, Customer), this will be removed in 4.2
This method can only be used when using the deprecated PasswordEncoder bean, otherwise an exception will be thrown.
The new PasswordEncoder bean requires passing in a Customer to find the appropriate token.
token - password reset tokenGenericResponse checkPasswordResetToken(String token, Customer customer)
token - password reset tokencustomer - Customer who owns the tokenLong findNextCustomerId()
@Deprecated String getSalt()
getSaltSource() instead, this will be removed in 4.2@Deprecated void setSalt(String salt)
setSaltSource(SaltSource) instead, this will be removed in 4.2salt - new salt string to use@Deprecated org.springframework.security.authentication.dao.SaltSource getSaltSource()
PasswordEncoder handles salting internally, this will be removed in 4.2SaltSource used with the blPasswordEncoder to encrypt the user password. Usually configured in
applicationContext-security.xml. This is not a required property and will return null if not configuredSaltSource@Deprecated void setSaltSource(org.springframework.security.authentication.dao.SaltSource saltSource)
PasswordEncoder handles salting internally, this will be removed in 4.2SaltSource used with blPasswordEncoder to encrypt the user password. Usually configured within
applicationContext-security.xmlsaltSource - the new SaltSource to use@Deprecated Object getSalt(Customer customer)
getSalt(Customer, String) instead, this will be removed in 4.2@Deprecated Object getSalt(Customer customer, String unencodedPassword)
PasswordEncoder handles salting internally, this will be removed in 4.2getSaltSource(). If there is
not a SaltSource configured (getSaltSource() returns null) then this also returns null.customer - the Customer to get UserDetails fromunencodedPassword - the unencoded password@Deprecated String encodePassword(String rawPassword, Customer customer)
PasswordEncoder handles salting internally, this will be removed in 4.2
The externally salted PasswordEncoder support is
being deprecated, following in Spring Security's footsteps, in order to move towards self salting hashing algorithms such as bcrypt.
Bcrypt is a superior hashing algorithm that randomly generates a salt per password in order to protect against rainbow table attacks
and is an intentionally expensive algorithm to further guard against brute force attempts to crack hashed passwords.
Additionally, having the encoding algorithm handle the salt internally reduces code complexity and dependencies such as SaltSource.
rawPassword - the unencoded passwordcustomer - the Customer to use for the saltString encodePassword(String rawPassword)
This method can only be called once per password. The salt is randomly generated internally in the PasswordEncoder
and appended to the hash to provide the resulting encoded password. Once this has been called on a password,
going forward all checks for authenticity must be done by isPasswordValid(String, String) as encoding the
same password twice will result in different encoded passwords.
rawPassword - the unencoded password@Deprecated boolean isPasswordValid(String rawPassword, String encodedPassword, Customer customer)
PasswordEncoder handles salting internally, this will be removed in 4.2Customer for salting. Don't encode the password separately since sometimes salts
are generated randomly and stored with the password.
The externally salted PasswordEncoder support is
being deprecated, following in Spring Security's footsteps, in order to move towards self salting hashing algorithms such as bcrypt.
Bcrypt is a superior hashing algorithm that randomly generates a salt per password in order to protect against rainbow table attacks
and is an intentionally expensive algorithm to further guard against brute force attempts to crack hashed passwords.
Additionally, having the encoding algorithm handle the salt internally reduces code complexity and dependencies such as SaltSource.
rawPassword - the unencoded passwordencodedPassword - the encoded password to compare againstcustomer - the Customer to use for the saltboolean isPasswordValid(String rawPassword, String encodedPassword)
PasswordEncoder.
This method must always be called to verify if a password is valid after the original encoded password is generated
due to PasswordEncoder randomly generating salts internally and appending them to the resulting hash.
rawPassword - the unencoded passwordencodedPassword - the encoded password to compare againstCopyright © 2015. All Rights Reserved.