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 Details

  • Constructor Details

  • 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 interface ResetPasswordFormValidator<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 interface ResetPasswordFormValidator<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

      protected void validatePasswordToken(@NonNull @NonNull List<P> passwordTokens, String token, @NonNull @NonNull org.springframework.validation.Errors errors)
    • 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 the historical passwords. The number of passwords to compare to is managed by PasswordValidatorProperties.getPreviousPasswordsToRemember(). If that is zero, then this method does nothing.
      Parameters:
      user - The user whose password is changing.
      password - The new password. Plaintext.
    • getPasswordValidatorProperties

      protected PasswordValidatorProperties 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)