Class AtlassianSHA1PasswordEncoder
java.lang.Object
com.atlassian.crowd.password.encoder.AtlassianSHA1PasswordEncoder
- All Implemented Interfaces:
InternalPasswordEncoder
,PasswordEncoder
The Atlassian implementation of the SHA-1 password encoder, based on the OSUser implementation.
It uses the Bouncy Castle SHA-512 digest, followed by the commons-codec base64 encoding.
Note: the password String is converted to bytes using the platform encoding, to preserve the same behaviour as OSUser.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionencodePassword
(String password, Object salt) This method will handle the hashing of the passed inpassword
paramgetKey()
The key to define this password encoderboolean
isPasswordValid
(String encPass, String rawPass, Object salt) Validates a specified "raw" password against an encoded password.
-
Field Details
-
ATLASSIAN_SHA1_KEY
- See Also:
-
-
Constructor Details
-
AtlassianSHA1PasswordEncoder
public AtlassianSHA1PasswordEncoder()
-
-
Method Details
-
encodePassword
This method will handle the hashing of the passed inpassword
param- Specified by:
encodePassword
in interfacePasswordEncoder
- Parameters:
password
- the password to encryptsalt
- can be null, and is not currently used by the underlying implementation- Returns:
- java.util.String the hashed password
-
isPasswordValid
Description copied from interface:PasswordEncoder
Validates a specified "raw" password against an encoded password.
The encoded password should have previously been generated by
PasswordEncoder.encodePassword(String, Object)
. This method will encode therawPass
(using the optionalsalt
), and then compared it with the presentedencPass
.For a discussion of salts, please refer to
PasswordEncoder.encodePassword(String, Object)
.- Specified by:
isPasswordValid
in interfacePasswordEncoder
- Parameters:
encPass
- a pre-encoded passwordrawPass
- a raw password to encode and compare against the pre-encoded passwordsalt
- optionally used by the implementation to "salt" the raw password before encoding. Anull
value is legal.- Returns:
- true if the password is valid , false otherwise
- See Also:
-
org.springframework.security.providers.encoding.PasswordEncoder#isPasswordValid(String, String, Object)
-
getKey
Description copied from interface:PasswordEncoder
The key to define this password encoder- Specified by:
getKey
in interfacePasswordEncoder
-