@Service(value="blCustomerService") public class CustomerServiceImpl extends Object implements CustomerService
| Modifier and Type | Field and Description |
|---|---|
protected EmailInfo |
changePasswordEmailInfo |
protected CustomerDao |
customerDao |
protected CustomerForgotPasswordSecurityTokenDao |
customerForgotPasswordSecurityTokenDao |
protected EmailService |
emailService |
protected EmailInfo |
forgotPasswordEmailInfo |
protected EmailInfo |
forgotUsernameEmailInfo |
protected IdGenerationService |
idGenerationService |
protected List<PasswordUpdatedHandler> |
passwordChangedHandlers |
protected org.springframework.security.authentication.encoding.PasswordEncoder |
passwordEncoder |
protected List<PasswordUpdatedHandler> |
passwordResetHandlers |
protected int |
passwordTokenLength |
protected List<PostRegistrationObserver> |
postRegisterListeners |
protected EmailInfo |
registrationEmailInfo |
protected RoleDao |
roleDao |
protected String |
salt
Deprecated.
utilize
saltSource instead so that it can be shared between this class as well as Spring's
authentication manager |
protected org.springframework.security.authentication.dao.SaltSource |
saltSource
Use a Salt Source ONLY if there's one configured
|
protected int |
tokenExpiredMinutes |
| Constructor and Description |
|---|
CustomerServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addPostRegisterListener(PostRegistrationObserver postRegisterListeners) |
Customer |
changePassword(PasswordChange passwordChange) |
protected void |
checkCustomer(Customer customer,
GenericResponse response) |
protected void |
checkPassword(String password,
String confirmPassword,
GenericResponse response) |
GenericResponse |
checkPasswordResetToken(String token)
Verifies that the passed in token is valid.
|
protected CustomerForgotPasswordSecurityToken |
checkPasswordResetToken(String token,
GenericResponse response) |
Customer |
createCustomer() |
Customer |
createCustomerFromId(Long customerId)
Returns a
Customer by first looking in the database, otherwise creating a new non-persisted Customer |
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 clearText,
Customer customer)
Encodes the clear text parameter, using the customer as a potential Salt.
|
Long |
findNextCustomerId()
Allow customers to call from subclassed service.
|
protected String |
generateSecurePassword() |
EmailInfo |
getChangePasswordEmailInfo() |
EmailInfo |
getForgotPasswordEmailInfo() |
EmailInfo |
getForgotUsernameEmailInfo() |
List<PasswordUpdatedHandler> |
getPasswordChangedHandlers() |
List<PasswordUpdatedHandler> |
getPasswordResetHandlers() |
int |
getPasswordTokenLength() |
EmailInfo |
getRegistrationEmailInfo() |
String |
getSalt()
Deprecated.
|
Object |
getSalt(Customer customer)
Deprecated.
use
getSalt(Customer, String) instead |
Object |
getSalt(Customer customer,
String unencodedPassword)
Optionally provide a salt based on a customer.
|
org.springframework.security.authentication.dao.SaltSource |
getSaltSource()
Returns the
SaltSource used with the blPasswordEncoder to encrypt the user password. |
int |
getTokenExpiredMinutes() |
boolean |
isPasswordValid(String rawPassword,
String encodedPassword,
Customer customer)
Use this to determine if passwords match.
|
protected boolean |
isTokenExpired(CustomerForgotPasswordSecurityToken fpst) |
protected void |
notifyPostRegisterListeners(Customer customer) |
Customer |
readCustomerByEmail(String emailAddress) |
Customer |
readCustomerById(Long id) |
Customer |
readCustomerByUsername(String username) |
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 resetPasswordUrl)
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 |
setChangePasswordEmailInfo(EmailInfo changePasswordEmailInfo) |
void |
setCustomerDao(CustomerDao customerDao) |
void |
setForgotPasswordEmailInfo(EmailInfo forgotPasswordEmailInfo) |
void |
setForgotUsernameEmailInfo(EmailInfo forgotUsernameEmailInfo) |
void |
setPasswordChangedHandlers(List<PasswordUpdatedHandler> passwordChangedHandlers) |
void |
setPasswordEncoder(org.springframework.security.authentication.encoding.PasswordEncoder passwordEncoder) |
void |
setPasswordResetHandlers(List<PasswordUpdatedHandler> passwordResetHandlers) |
void |
setPasswordTokenLength(int passwordTokenLength) |
void |
setRegistrationEmailInfo(EmailInfo registrationEmailInfo) |
void |
setSalt(String salt)
Deprecated.
|
void |
setSaltSource(org.springframework.security.authentication.dao.SaltSource saltSource)
Sets the
SaltSource used with blPasswordencoder to encrypt the user password. |
void |
setTokenExpiredMinutes(int tokenExpiredMinutes) |
protected CustomerDao customerDao
protected IdGenerationService idGenerationService
protected CustomerForgotPasswordSecurityTokenDao customerForgotPasswordSecurityTokenDao
protected org.springframework.security.authentication.encoding.PasswordEncoder passwordEncoder
@Deprecated protected String salt
saltSource instead so that it can be shared between this class as well as Spring's
authentication manager@Autowired(required=false) @Qualifier(value="blSaltSource") protected org.springframework.security.authentication.dao.SaltSource saltSource
protected RoleDao roleDao
protected EmailService emailService
protected EmailInfo forgotPasswordEmailInfo
protected EmailInfo forgotUsernameEmailInfo
protected EmailInfo registrationEmailInfo
protected EmailInfo changePasswordEmailInfo
protected int tokenExpiredMinutes
protected int passwordTokenLength
protected final List<PostRegistrationObserver> postRegisterListeners
protected List<PasswordUpdatedHandler> passwordResetHandlers
protected List<PasswordUpdatedHandler> passwordChangedHandlers
@Transactional(value="blTransactionManager") public Customer saveCustomer(Customer customer)
saveCustomer in interface CustomerService@Transactional(value="blTransactionManager") public Customer saveCustomer(Customer customer, boolean register)
saveCustomer in interface CustomerServiceprotected String generateSecurePassword()
@Transactional(value="blTransactionManager") public Customer registerCustomer(Customer customer, String password, String passwordConfirm)
registerCustomer in interface CustomerServicepublic void createRegisteredCustomerRoles(Customer customer)
CustomerServicecreateRegisteredCustomerRoles in interface CustomerServicepublic Customer readCustomerByEmail(String emailAddress)
readCustomerByEmail in interface CustomerService@Transactional(value="blTransactionManager") public Customer changePassword(PasswordChange passwordChange)
changePassword in interface CustomerService@Transactional(value="blTransactionManager") public Customer resetPassword(PasswordReset passwordReset)
resetPassword in interface CustomerServicepublic void addPostRegisterListener(PostRegistrationObserver postRegisterListeners)
addPostRegisterListener in interface CustomerServicepublic void removePostRegisterListener(PostRegistrationObserver postRegisterListeners)
removePostRegisterListener in interface CustomerServiceprotected void notifyPostRegisterListeners(Customer customer)
public Customer createCustomer()
createCustomer in interface CustomerServicepublic Customer createCustomerFromId(Long customerId)
CustomerServiceCustomer by first looking in the database, otherwise creating a new non-persisted CustomercreateCustomerFromId in interface CustomerServicecustomerId - the id of the customer to lookupCustomer from the database if it exists, or a new non-persisted Customerpublic Long findNextCustomerId()
findNextCustomerId in interface CustomerServicepublic Customer createNewCustomer()
CustomerServiceCustomer. Typically used with registering a new customer.createNewCustomer in interface CustomerServicepublic void deleteCustomer(Customer customer)
CustomerServicedeleteCustomer in interface CustomerServicecustomer - the customer entity to removepublic Customer readCustomerByUsername(String username)
readCustomerByUsername in interface CustomerServicepublic Customer readCustomerByUsername(String username, Boolean cacheable)
readCustomerByUsername in interface CustomerServicepublic Customer readCustomerById(Long id)
readCustomerById in interface CustomerServicepublic void setCustomerDao(CustomerDao customerDao)
public void setPasswordEncoder(org.springframework.security.authentication.encoding.PasswordEncoder passwordEncoder)
@Deprecated public Object getSalt(Customer customer)
getSalt(Customer, String) insteadgetSalt in interface CustomerServicepublic Object getSalt(Customer customer, String unencodedPassword)
getSalt in interface CustomerServicecustomer - CustomerServiceImpl#getSalt()}public String encodePassword(String clearText, Customer customer)
CustomerServiceencodePassword in interface CustomerServicepublic boolean isPasswordValid(String rawPassword, String encodedPassword, Customer customer)
CustomerServiceisPasswordValid in interface CustomerService@Deprecated public String getSalt()
getSalt in interface CustomerService@Deprecated public void setSalt(String salt)
setSalt in interface CustomerServicepublic org.springframework.security.authentication.dao.SaltSource getSaltSource()
CustomerServiceSaltSource 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 configuredgetSaltSource in interface CustomerServicepublic void setSaltSource(org.springframework.security.authentication.dao.SaltSource saltSource)
CustomerServiceSaltSource used with blPasswordencoder to encrypt the user password. Usually configured within
applicationContext-security.xmlsetSaltSource in interface CustomerServicepublic List<PasswordUpdatedHandler> getPasswordResetHandlers()
getPasswordResetHandlers in interface CustomerServicepublic void setPasswordResetHandlers(List<PasswordUpdatedHandler> passwordResetHandlers)
setPasswordResetHandlers in interface CustomerServicepublic List<PasswordUpdatedHandler> getPasswordChangedHandlers()
getPasswordChangedHandlers in interface CustomerServicepublic void setPasswordChangedHandlers(List<PasswordUpdatedHandler> passwordChangedHandlers)
setPasswordChangedHandlers in interface CustomerService@Transactional(value="blTransactionManager") public GenericResponse sendForgotUsernameNotification(String emailAddress)
CustomerServicesendForgotUsernameNotification in interface CustomerService@Transactional(value="blTransactionManager") public GenericResponse sendForgotPasswordNotification(String username, String resetPasswordUrl)
CustomerServicesendForgotPasswordNotification in interface CustomerServiceusername - - the user to send a reset password email to.resetPasswordUrl - - Base url to include in the email.public GenericResponse checkPasswordResetToken(String token)
CustomerServicecheckPasswordResetToken in interface CustomerServiceprotected CustomerForgotPasswordSecurityToken checkPasswordResetToken(String token, GenericResponse response)
@Transactional(value="blTransactionManager") public GenericResponse resetPasswordUsingToken(String username, String token, String password, String confirmPassword)
CustomerServiceresetPasswordUsingToken in interface CustomerServiceusername - Username of the customertoken - Valid reset tokenpassword - new passwordprotected void checkCustomer(Customer customer, GenericResponse response)
protected void checkPassword(String password, String confirmPassword, GenericResponse response)
protected boolean isTokenExpired(CustomerForgotPasswordSecurityToken fpst)
public int getTokenExpiredMinutes()
public void setTokenExpiredMinutes(int tokenExpiredMinutes)
public int getPasswordTokenLength()
public void setPasswordTokenLength(int passwordTokenLength)
public EmailInfo getForgotPasswordEmailInfo()
public void setForgotPasswordEmailInfo(EmailInfo forgotPasswordEmailInfo)
public EmailInfo getForgotUsernameEmailInfo()
public void setForgotUsernameEmailInfo(EmailInfo forgotUsernameEmailInfo)
public EmailInfo getRegistrationEmailInfo()
public void setRegistrationEmailInfo(EmailInfo registrationEmailInfo)
public EmailInfo getChangePasswordEmailInfo()
public void setChangePasswordEmailInfo(EmailInfo changePasswordEmailInfo)
Copyright © 2015. All Rights Reserved.