Class ForgottenPasswordInstanceService
java.lang.Object
com.bluebell.greenhouse.radicle.services.AbstractGenericEntityService<ForgottenPasswordInstance, ForgottenPasswordInstanceRepository>
com.bluebell.greenhouse.radicle.services.security.ForgottenPasswordInstanceService
@Service
public class ForgottenPasswordInstanceService
extends AbstractGenericEntityService<ForgottenPasswordInstance, ForgottenPasswordInstanceRepository>
Service-layer for
ForgottenPasswordInstance.- Version:
- 3.0.5
- Author:
- Stephen Prizio
-
Constructor Summary
ConstructorsConstructorDescriptionForgottenPasswordInstanceService(ApiTokenServiceStrategy apiTokenServiceStrategy, ForgottenPasswordInstanceRepository forgottenPasswordInstanceRepository, SimpleEmailService simpleEmailService, UserRepository userRepository, UserService userService) Creates the service. -
Method Summary
Modifier and TypeMethodDescriptionintCleans up stale instances that have lived beyond their TTL.When given an email, this method will look up the associatedUserinstance.voidvalidateAndResetPassword(String token, String password) Ensures the given token maps to a user and is not expired.Methods inherited from class AbstractGenericEntityService
refreshEntity, resolveEntity, resolveEntity, resolveEntity
-
Constructor Details
-
ForgottenPasswordInstanceService
public ForgottenPasswordInstanceService(ApiTokenServiceStrategy apiTokenServiceStrategy, ForgottenPasswordInstanceRepository forgottenPasswordInstanceRepository, SimpleEmailService simpleEmailService, UserRepository userRepository, UserService userService) Creates the service.- Parameters:
apiTokenServiceStrategy-ApiTokenServiceStrategyforgottenPasswordInstanceRepository-ForgottenPasswordInstanceRepositorysimpleEmailService-SimpleEmailServiceuserRepository-UserRepositoryuserService-UserService
-
-
Method Details
-
generateForgottenPasswordInstance
@Transactional public Optional<ForgottenPasswordInstance> generateForgottenPasswordInstance(String email) When given an email, this method will look up the associatedUserinstance. If one is present, a newForgottenPasswordInstanceis created and an email notification is sent to the email containing the reset token. If no user is found, nothing occurs. Tokens live for a maximum of 15 minutes.- Parameters:
email- email- Returns:
OptionalForgottenPasswordInstance
-
validateAndResetPassword
-
cleanupStaleInstances
@Transactional public int cleanupStaleInstances()Cleans up stale instances that have lived beyond their TTL.- Returns:
- number of entries removed
-