com.atlassian.crowd.password.encoder
Class AtlassianSHA1PasswordEncoder

java.lang.Object
  extended by com.atlassian.crowd.password.encoder.AtlassianSHA1PasswordEncoder
All Implemented Interfaces:
InternalPasswordEncoder, PasswordEncoder

public class AtlassianSHA1PasswordEncoder
extends java.lang.Object
implements InternalPasswordEncoder

The Atlassian implementation of the SHA-1 password encoder, based on the OSUser implementation that is based on the Bouncey Castle implementation


Field Summary
static java.lang.String ATLASSIAN_SHA1_KEY
           
 
Constructor Summary
AtlassianSHA1PasswordEncoder()
           
AtlassianSHA1PasswordEncoder(com.atlassian.user.security.password.PasswordEncryptor passwordEncryptor)
           
 
Method Summary
 java.lang.String encodePassword(java.lang.String password, java.lang.Object salt)
          This method will handle the hashing of the passed in password param
 java.lang.String getKey()
          The key to define this password encoder
 boolean isPasswordValid(java.lang.String encPass, java.lang.String rawPass, java.lang.Object salt)
          Validates a specified "raw" password against an encoded password.
 void setPasswordEncryptor(com.atlassian.user.security.password.PasswordEncryptor passwordEncryptor)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATLASSIAN_SHA1_KEY

public static final java.lang.String ATLASSIAN_SHA1_KEY
See Also:
Constant Field Values
Constructor Detail

AtlassianSHA1PasswordEncoder

public AtlassianSHA1PasswordEncoder()

AtlassianSHA1PasswordEncoder

public AtlassianSHA1PasswordEncoder(com.atlassian.user.security.password.PasswordEncryptor passwordEncryptor)
Method Detail

encodePassword

public java.lang.String encodePassword(java.lang.String password,
                                       java.lang.Object salt)
This method will handle the hashing of the passed in password param

Specified by:
encodePassword in interface PasswordEncoder
Parameters:
password - the password to encrypt
salt - can be null, and is not currently used by the underlying implementation
Returns:
java.util.String the hashed password

isPasswordValid

public boolean isPasswordValid(java.lang.String encPass,
                               java.lang.String rawPass,
                               java.lang.Object salt)
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 the rawPass (using the optional salt), and then compared it with the presented encPass.

For a discussion of salts, please refer to PasswordEncoder.encodePassword(String, Object).

Specified by:
isPasswordValid in interface PasswordEncoder
Parameters:
encPass - a pre-encoded password
rawPass - a raw password to encode and compare against the pre-encoded password
salt - optionally used by the implementation to "salt" the raw password before encoding. A null value is legal.
Returns:
true if the password is valid , false otherwise
See Also:
PasswordEncoder.isPasswordValid(String, String, Object)

getKey

public java.lang.String getKey()
Description copied from interface: PasswordEncoder
The key to define this password encoder

Specified by:
getKey in interface PasswordEncoder
Returns:

setPasswordEncryptor

public void setPasswordEncryptor(com.atlassian.user.security.password.PasswordEncryptor passwordEncryptor)


Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.