Class ShaPasswordEncoder

  • All Implemented Interfaces:
    org.springframework.security.authentication.encoding.PasswordEncoder

    public class ShaPasswordEncoder
    extends Object
    implements org.springframework.security.authentication.encoding.PasswordEncoder
    Provides a password encoder using SHA hashing algorithms.
    See Also:
    PasswordEncoder
    • Constructor Detail

      • ShaPasswordEncoder

        public ShaPasswordEncoder()
    • Method Detail

      • setPasswordService

        public void setPasswordService​(com.avoka.core.storage.IPasswordService passwordService)
        Set the password service.
        Parameters:
        passwordService - the password service
      • getPasswordService

        public com.avoka.core.storage.IPasswordService getPasswordService()
        Return the password service.
        Returns:
        the password service
      • encodePassword

        public String encodePassword​(String plaintxtPassword,
                                     Object salt)
        Return a Hex encoded SHA-256 hash of the given plaintext password.
        Specified by:
        encodePassword in interface org.springframework.security.authentication.encoding.PasswordEncoder
        Parameters:
        plaintxtPassword - the non-null password to be encoded
        salt - the salt value to use during encoding (currently unused)
        Returns:
        the hash value for the password
      • isPasswordValid

        public boolean isPasswordValid​(String hashvalue,
                                       String plaintxtPassword,
                                       Object salt)
        Compare a given password to a stored hash value
        Specified by:
        isPasswordValid in interface org.springframework.security.authentication.encoding.PasswordEncoder
        Parameters:
        hashvalue - the non-null hash value to compare against
        plaintxtPassword - the non-null password
        salt - the salt value to use during encoding (currently unused)
        Returns:
        true if the password matches the hash value