Package com.avoka.fc.core.security
Class ShaPasswordEncoder
- java.lang.Object
-
- com.avoka.fc.core.security.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 Summary
Constructors Constructor Description ShaPasswordEncoder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
encodePassword(String plaintxtPassword, Object salt)
Return a Hex encoded SHA-256 hash of the given plaintext password.com.avoka.core.storage.IPasswordService
getPasswordService()
Return the password service.boolean
isPasswordValid(String hashvalue, String plaintxtPassword, Object salt)
Compare a given password to a stored hash valuevoid
setPasswordService(com.avoka.core.storage.IPasswordService passwordService)
Set the password service.
-
-
-
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 interfaceorg.springframework.security.authentication.encoding.PasswordEncoder
- Parameters:
plaintxtPassword
- the non-null password to be encodedsalt
- 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 interfaceorg.springframework.security.authentication.encoding.PasswordEncoder
- Parameters:
hashvalue
- the non-null hash value to compare againstplaintxtPassword
- the non-null passwordsalt
- the salt value to use during encoding (currently unused)- Returns:
- true if the password matches the hash value
-
-