Class DefaultResetPasswordFormValidator<P extends PasswordToken>
java.lang.Object
com.broadleafcommerce.auth.user.validation.DefaultResetPasswordFormValidator<P>
- All Implemented Interfaces:
ResetPasswordFormValidator<P>
public class DefaultResetPasswordFormValidator<P extends PasswordToken>
extends Object
implements ResetPasswordFormValidator<P>
- Author:
- Nathan Moore (nathanmoore).
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
protected final PasswordTokenValidator<P>
protected final PasswordRequestValidator
protected final UsernameValidator
-
Constructor Summary
ConstructorDescriptionDefaultResetPasswordFormValidator
(UsernameValidator usernameValidator, PasswordRequestValidator passwordValidator, PasswordTokenValidator<P> passwordTokenValidator) -
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.security.crypto.password.PasswordEncoder
protected PasswordValidatorProperties
void
setPasswordEncoder
(org.springframework.security.crypto.password.PasswordEncoder passwordEncoder) void
setPasswordValidatorProperties
(PasswordValidatorProperties passwordValidatorProperties) void
validate
(@NonNull List<P> passwordTokens, @NonNull ResetPasswordForm resetPasswordForm, @NonNull org.springframework.validation.Errors errors, @NonNull User user) Validates a password reset form.void
validate
(List<P> passwordTokens, ResetPasswordForm resetPasswordForm, org.springframework.validation.Errors errors) Validates a password reset form.protected void
validatedNewPasswordIsNotReused
(@NonNull User user, String password, @NonNull org.springframework.validation.Errors errors) Validates that the new password does not match any of thehistorical passwords
.protected void
validatePasswordFormat
(@NonNull String password, @NonNull org.springframework.validation.Errors errors) protected void
validatePasswordToken
(@NonNull List<P> passwordTokens, String token, @NonNull org.springframework.validation.Errors errors)
-
Field Details
-
usernameValidator
-
passwordValidator
-
passwordTokenValidator
-
PASSWORD_FIELD
- See Also:
-
-
Constructor Details
-
DefaultResetPasswordFormValidator
public DefaultResetPasswordFormValidator(UsernameValidator usernameValidator, PasswordRequestValidator passwordValidator, PasswordTokenValidator<P> passwordTokenValidator)
-
-
Method Details
-
validate
public void validate(List<P> passwordTokens, ResetPasswordForm resetPasswordForm, @NonNull org.springframework.validation.Errors errors) Description copied from interface:ResetPasswordFormValidator
Validates a password reset form. When resetting a password, this is where validation of password requirements should be performed.- Specified by:
validate
in interfaceResetPasswordFormValidator<P extends PasswordToken>
- Parameters:
passwordTokens
- A list of password tokens belonging to a user.resetPasswordForm
- The reset password form.errors
- An errors object to populate if validation fails.- See Also:
-
validate
public void validate(@NonNull @NonNull List<P> passwordTokens, @NonNull @NonNull ResetPasswordForm resetPasswordForm, @NonNull @NonNull org.springframework.validation.Errors errors, @NonNull @NonNull User user) Description copied from interface:ResetPasswordFormValidator
Validates a password reset form. When resetting a password, this is where validation of password requirements should be performed.- Specified by:
validate
in interfaceResetPasswordFormValidator<P extends PasswordToken>
- Parameters:
passwordTokens
- A list of password tokens belonging to a user.resetPasswordForm
- The reset password form.errors
- An errors object to populate if validation fails.user
- The user changing their password.- See Also:
-
validatePasswordToken
-
validatePasswordFormat
protected void validatePasswordFormat(@NonNull @NonNull String password, @NonNull @NonNull org.springframework.validation.Errors errors) -
validatedNewPasswordIsNotReused
protected void validatedNewPasswordIsNotReused(@NonNull @NonNull User user, String password, @NonNull @NonNull org.springframework.validation.Errors errors) Validates that the new password does not match any of thehistorical passwords
. The number of passwords to compare to is managed byPasswordValidatorProperties.getPreviousPasswordsToRemember()
. If that is zero, then this method does nothing.- Parameters:
user
- The user whose password is changing.password
- The new password. Plaintext.
-
getPasswordValidatorProperties
-
setPasswordValidatorProperties
@Autowired public void setPasswordValidatorProperties(PasswordValidatorProperties passwordValidatorProperties) -
getPasswordEncoder
protected org.springframework.security.crypto.password.PasswordEncoder getPasswordEncoder() -
setPasswordEncoder
@Autowired public void setPasswordEncoder(org.springframework.security.crypto.password.PasswordEncoder passwordEncoder)
-