Class SpringPasswordHasher

java.lang.Object
com.irurueta.authserver.authorization.api.web.password.SpringPasswordHasher
All Implemented Interfaces:
PasswordHasher

@Component public class SpringPasswordHasher extends Object implements PasswordHasher
Adapter of the PasswordHasher port over Spring Security's PasswordEncoder.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final org.springframework.security.crypto.password.PasswordEncoder
    Encoder that does the work.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    encode(CharSequence rawPassword)
    Encodes a clear-text password (or a client secret) with the current algorithm.
    boolean
    matches(CharSequence rawPassword, String encodedPassword)
    Checks a clear-text password against an encoded one.
    boolean
    upgradeEncoding(String encodedPassword)
    Tells whether a stored encoding is weaker than the current algorithm and should be replaced the next time the clear-text password is known.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • passwordEncoder

      private final org.springframework.security.crypto.password.PasswordEncoder passwordEncoder
      Encoder that does the work.
  • Constructor Details

    • SpringPasswordHasher

      public SpringPasswordHasher()
  • Method Details

    • encode

      public String encode(CharSequence rawPassword)
      Description copied from interface: PasswordHasher
      Encodes a clear-text password (or a client secret) with the current algorithm.
      Specified by:
      encode in interface PasswordHasher
      Parameters:
      rawPassword - the clear-text value.
      Returns:
      the encoded value, including its encoding prefix.
    • matches

      public boolean matches(CharSequence rawPassword, String encodedPassword)
      Description copied from interface: PasswordHasher
      Checks a clear-text password against an encoded one.
      Specified by:
      matches in interface PasswordHasher
      Parameters:
      rawPassword - the clear-text value.
      encodedPassword - the stored encoded value.
      Returns:
      true when they match.
    • upgradeEncoding

      public boolean upgradeEncoding(String encodedPassword)
      Description copied from interface: PasswordHasher
      Tells whether a stored encoding is weaker than the current algorithm and should be replaced the next time the clear-text password is known.
      Specified by:
      upgradeEncoding in interface PasswordHasher
      Parameters:
      encodedPassword - the stored encoded value.
      Returns:
      true when the password should be re-encoded.