Package de.terrestris.shoguncore.service
Class PasswordResetTokenService<E extends PasswordResetToken,D extends PasswordResetTokenDao<E>>
- java.lang.Object
-
- de.terrestris.shoguncore.service.AbstractDaoService<E,D>
-
- de.terrestris.shoguncore.service.AbstractCrudService<E,D>
-
- de.terrestris.shoguncore.service.PermissionAwareCrudService<E,D>
-
- de.terrestris.shoguncore.service.AbstractTokenService<E,D>
-
- de.terrestris.shoguncore.service.AbstractUserTokenService<E,D>
-
- de.terrestris.shoguncore.service.PasswordResetTokenService<E,D>
-
@Service("passwordResetTokenService") public class PasswordResetTokenService<E extends PasswordResetToken,D extends PasswordResetTokenDao<E>> extends AbstractUserTokenService<E,D>- Author:
- Daniel Koch, Nils Bühner
-
-
Field Summary
-
Fields inherited from class de.terrestris.shoguncore.service.PermissionAwareCrudService
permissionCollectionService
-
Fields inherited from class de.terrestris.shoguncore.service.AbstractDaoService
dao, logger
-
-
Constructor Summary
Constructors Modifier Constructor Description PasswordResetTokenService()Default constructor, which calls the type-constructorprotectedPasswordResetTokenService(Class<E> entityClass)Constructor that sets the concrete entity class for the service.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected EbuildConcreteInstance(User user, Integer expirationTimeInMinutes)Builds a concrete instance of this class.StringgetChangePasswordPath()MailPublishergetMailPublisher()org.springframework.security.crypto.password.PasswordEncodergetPasswordEncoder()org.springframework.mail.SimpleMailMessagegetResetPasswordMailMessageTemplate()voidsendResetPasswordMail(javax.servlet.http.HttpServletRequest request, String email)voidsetChangePasswordPath(String changePasswordPath)voidsetDao(D dao)We have to useQualifierto define the correct dao here.voidsetMailPublisher(MailPublisher mailPublisher)voidsetPasswordEncoder(org.springframework.security.crypto.password.PasswordEncoder passwordEncoder)voidsetResetPasswordMailMessageTemplate(org.springframework.mail.SimpleMailMessage resetPasswordMailMessageTemplate)voidvalidateTokenAndUpdatePassword(String rawPassword, String token)-
Methods inherited from class de.terrestris.shoguncore.service.AbstractUserTokenService
findByUser, getValidTokenForUser, validateToken
-
Methods inherited from class de.terrestris.shoguncore.service.AbstractTokenService
findByTokenValue
-
Methods inherited from class de.terrestris.shoguncore.service.PermissionAwareCrudService
addAndSaveGroupPermissions, addAndSaveUserPermissions, findAllUserGroupPermissionsOfUserGroup, findAllUserPermissionsOfUser, getPermissionCollectionService, removeAndSaveGroupPermissions, removeAndSaveUserPermissions, setPermissionCollectionService
-
Methods inherited from class de.terrestris.shoguncore.service.AbstractCrudService
delete, findAll, findAllRestricted, findAllWhereFieldEquals, findAllWithCollectionContaining, findById, findBySimpleFilter, loadById, saveOrUpdate, updatePartialWithJsonNode
-
Methods inherited from class de.terrestris.shoguncore.service.AbstractDaoService
getDao, getEntityClass
-
-
-
-
Method Detail
-
setDao
@Autowired @Qualifier("passwordResetTokenDao") public void setDao(D dao)We have to useQualifierto define the correct dao here. Otherwise, spring can not decide which dao has to be autowired here as there are multiple candidates.- Overrides:
setDaoin classPermissionAwareCrudService<E extends PasswordResetToken,D extends PasswordResetTokenDao<E>>- Parameters:
dao- the dao to set
-
buildConcreteInstance
protected E buildConcreteInstance(User user, Integer expirationTimeInMinutes)
Builds a concrete instance of this class.- Specified by:
buildConcreteInstancein classAbstractUserTokenService<E extends PasswordResetToken,D extends PasswordResetTokenDao<E>>- Returns:
-
sendResetPasswordMail
public void sendResetPasswordMail(javax.servlet.http.HttpServletRequest request, String email) throws NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, URISyntaxException, UnsupportedEncodingException- Parameters:
request-email-- Throws:
InvocationTargetExceptionIllegalArgumentExceptionIllegalAccessExceptionInstantiationExceptionSecurityExceptionNoSuchMethodExceptionURISyntaxExceptionUnsupportedEncodingException
-
validateTokenAndUpdatePassword
public void validateTokenAndUpdatePassword(String rawPassword, String token) throws Exception
- Parameters:
rawPassword-token-- Throws:
Exception
-
getMailPublisher
public MailPublisher getMailPublisher()
- Returns:
- the mailPublisher
-
setMailPublisher
public void setMailPublisher(MailPublisher mailPublisher)
- Parameters:
mailPublisher- the mailPublisher to set
-
getPasswordEncoder
public org.springframework.security.crypto.password.PasswordEncoder getPasswordEncoder()
- Returns:
- the passwordEncoder
-
setPasswordEncoder
public void setPasswordEncoder(org.springframework.security.crypto.password.PasswordEncoder passwordEncoder)
- Parameters:
passwordEncoder- the passwordEncoder to set
-
getResetPasswordMailMessageTemplate
public org.springframework.mail.SimpleMailMessage getResetPasswordMailMessageTemplate()
- Returns:
- the resetPasswordMailMessageTemplate
-
setResetPasswordMailMessageTemplate
public void setResetPasswordMailMessageTemplate(org.springframework.mail.SimpleMailMessage resetPasswordMailMessageTemplate)
- Parameters:
resetPasswordMailMessageTemplate- the resetPasswordMailMessageTemplate to set
-
getChangePasswordPath
public String getChangePasswordPath()
- Returns:
- the changePasswordPath
-
setChangePasswordPath
public void setChangePasswordPath(String changePasswordPath)
- Parameters:
changePasswordPath- the changePasswordPath to set
-
-