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
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected final PasswordTokenValidator<P>protected final PasswordRequestValidatorprotected final UsernameValidator -
Constructor Summary
ConstructorsConstructorDescriptionDefaultResetPasswordFormValidator(UsernameValidator usernameValidator, PasswordRequestValidator passwordValidator, PasswordTokenValidator<P> passwordTokenValidator) -
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.security.crypto.password.PasswordEncoderprotected PasswordValidatorPropertiesvoidsetPasswordEncoder(org.springframework.security.crypto.password.PasswordEncoder passwordEncoder) voidsetPasswordValidatorProperties(PasswordValidatorProperties passwordValidatorProperties) voidvalidate(@NonNull List<P> passwordTokens, @NonNull ResetPasswordForm resetPasswordForm, @NonNull org.springframework.validation.Errors errors, @NonNull User user) Validates a password reset form.voidvalidate(List<P> passwordTokens, ResetPasswordForm resetPasswordForm, org.springframework.validation.Errors errors) Validates a password reset form.protected voidvalidatedNewPasswordIsNotReused(@NonNull User user, String password, @NonNull org.springframework.validation.Errors errors) Validates that the new password does not match any of thehistorical passwords.protected voidvalidatePasswordFormat(@NonNull String password, @NonNull org.springframework.validation.Errors errors) protected voidvalidatePasswordToken(@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:ResetPasswordFormValidatorValidates a password reset form. When resetting a password, this is where validation of password requirements should be performed.- Specified by:
validatein 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:ResetPasswordFormValidatorValidates a password reset form. When resetting a password, this is where validation of password requirements should be performed.- Specified by:
validatein 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)
-