Class SHAMD5PasswordEncoder

All Implemented Interfaces:
PasswordEncoder

public class SHAMD5PasswordEncoder extends SHAPasswordEncoder
Author:
Titouan COMPIEGNE (titouan.compiegne at graviteesource.com), GraviteeSource Team
  • Constructor Details

    • SHAMD5PasswordEncoder

      public SHAMD5PasswordEncoder()
    • SHAMD5PasswordEncoder

      public SHAMD5PasswordEncoder(String algorithm)
  • Method Details

    • encode

      public String encode(CharSequence rawPassword)
      Description copied from interface: PasswordEncoder
      Encode the raw password. Generally, a good encoding algorithm applies a SHA-1 or greater hash combined with an 8-byte or greater randomly generated salt.
      Specified by:
      encode in interface PasswordEncoder
      Overrides:
      encode in class MessageDigestPasswordEncoder
      Parameters:
      rawPassword - the raw password to encode
    • encode

      public String encode(CharSequence rawPassword, byte[] salt)
      Description copied from interface: PasswordEncoder
      Encode the raw password. Generally, a good encoding algorithm applies a SHA-1 or greater hash combined with an 8-byte or greater randomly generated salt.
      Specified by:
      encode in interface PasswordEncoder
      Overrides:
      encode in class MessageDigestPasswordEncoder
      Parameters:
      rawPassword - the raw password to encode
      salt - the salt use to encode the rawPassword
    • matches

      public boolean matches(CharSequence rawPassword, String encodedPassword)
      Description copied from interface: PasswordEncoder
      Verify the encoded password obtained from storage matches the submitted raw password after it too is encoded. Returns true if the passwords match, false if they do not. The stored password itself is never decoded.
      Specified by:
      matches in interface PasswordEncoder
      Overrides:
      matches in class MessageDigestPasswordEncoder
      Parameters:
      rawPassword - the raw password to encode and match
      encodedPassword - the encoded password from storage to compare with
      Returns:
      true if the raw password, after encoding, matches the encoded password from storage
    • matches

      public boolean matches(CharSequence rawPassword, String encodedPassword, byte[] salt)
      Description copied from interface: PasswordEncoder
      Verify the encoded password obtained from storage matches the submitted raw password after it too is encoded. Returns true if the passwords match, false if they do not. The stored password itself is never decoded.
      Specified by:
      matches in interface PasswordEncoder
      Overrides:
      matches in class MessageDigestPasswordEncoder
      Parameters:
      rawPassword - the raw password to encode and match
      encodedPassword - the encoded password from storage to compare with
      salt - the salt use to compare the rawPassword and the encodedPassword
      Returns:
    • setEncodeSaltAsBase64

      public void setEncodeSaltAsBase64(boolean encodeSaltAsBase64)
      Overrides:
      setEncodeSaltAsBase64 in class MessageDigestPasswordEncoder
    • setSaltLength

      public void setSaltLength(int saltLength)
      Overrides:
      setSaltLength in class MessageDigestPasswordEncoder