com.atlassian.crowd.integration.authentication
Class PasswordHelper

java.lang.Object
  extended by com.atlassian.crowd.integration.authentication.PasswordHelper

public class PasswordHelper
extends Object

Various password helper methods.

Version:
1.0
Author:
Justen Stepka

Field Summary
protected static String ERROR_PASSWORD_ALREADY_USED
          Exception message when a password has already been used.
static String PASSWORD_ENCRYPTION_ALGORITHM
          The password encryption algorithm.
 
Constructor Summary
PasswordHelper()
           
 
Method Summary
 void authenticate(PasswordCredential[] providedCredentials, List storedCredentials)
          Checks if the supplied credentials match the stored credentials.
 void encrypt(List credentials)
          Encrypts the list of passwords.
 String encrypt(String password)
          Encrypts the password.
 void isUniquePasssword(PasswordCredential newCredential, RemotePrincipal principal)
          Checks if the new credential has already been used by the the principal.
 void setPropertyManager(PropertyManager propertyManager)
           
 void validateRegex(String regex, PasswordCredential credential)
          Validates the password meets the expected regex restriction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERROR_PASSWORD_ALREADY_USED

protected static final String ERROR_PASSWORD_ALREADY_USED
Exception message when a password has already been used.

See Also:
Constant Field Values

PASSWORD_ENCRYPTION_ALGORITHM

public static final String PASSWORD_ENCRYPTION_ALGORITHM
The password encryption algorithm.

See Also:
Constant Field Values
Constructor Detail

PasswordHelper

public PasswordHelper()
Method Detail

validateRegex

public void validateRegex(String regex,
                          PasswordCredential credential)
                   throws InvalidCredentialException
Validates the password meets the expected regex restriction.

Parameters:
regex - The regex pattern.
credential - The password to check.
Throws:
InvalidCredentialException - The password failed the regex check.

isUniquePasssword

public void isUniquePasssword(PasswordCredential newCredential,
                              RemotePrincipal principal)
                       throws InvalidCredentialException
Checks if the new credential has already been used by the the principal.

Parameters:
newCredential - The new credential.
principal - The principal.
Throws:
InvalidCredentialException - The password has already been used.

encrypt

public String encrypt(String password)
               throws InvalidCredentialException
Encrypts the password.

Parameters:
password - The password.
Returns:
The encrypted password.
Throws:
InvalidCredentialException - The password could not be encrypted.

encrypt

public void encrypt(List credentials)
             throws InvalidCredentialException
Encrypts the list of passwords.

Parameters:
credentials - The passwords.
Throws:
InvalidCredentialException - The passwords could not be encrypted.

authenticate

public void authenticate(PasswordCredential[] providedCredentials,
                         List storedCredentials)
                  throws InvalidAuthenticationException
Checks if the supplied credentials match the stored credentials.

Parameters:
providedCredentials - The supplied credentials.
storedCredentials - The valid credentials.
Throws:
InvalidAuthenticationException - Invalid authentication.

setPropertyManager

public void setPropertyManager(PropertyManager propertyManager)


Copyright © 2006 Atlassian Software Systems. All Rights Reserved.