Class PasswordValidationService

java.lang.Object
com.fiap.tech_challenge.parte1.ms_users.services.validation.PasswordValidationService
All Implemented Interfaces:
PasswordValidator

@Component public class PasswordValidationService extends Object implements PasswordValidator
Service responsible for validating password change requests. It ensures that the old password matches and that the new password is different from the old one.
  • Constructor Details

    • PasswordValidationService

      public PasswordValidationService()
  • Method Details

    • validate

      public void validate(boolean oldPasswordMatches, boolean isSameAsOld)
      Validates the password change criteria.
      Specified by:
      validate in interface PasswordValidator
      Parameters:
      oldPasswordMatches - boolean indicating if the old password provided matches the current password
      isSameAsOld - boolean indicating if the new password is the same as the old password
      Throws:
      InvalidPasswordException - if the old password does not match or if the new password is the same as the old one