org.apache.jackrabbit.core.security.authentication
Class CryptedSimpleCredentials

java.lang.Object
  extended by org.apache.jackrabbit.core.security.authentication.CryptedSimpleCredentials
All Implemented Interfaces:
Serializable, Credentials

public class CryptedSimpleCredentials
extends Object
implements Credentials

Crypted variant of the SimpleCredentials.

See Also:
Serialized Form

Constructor Summary
CryptedSimpleCredentials(SimpleCredentials credentials)
          Deprecated.  
CryptedSimpleCredentials(String userId, String hashedPassword)
          Create a new instanceof CryptedSimpleCredentials from the given userId and hashedPassword strings.
 
Method Summary
static String buildPasswordHash(String password)
          Creates a hash of the specified password if it is found to be plain text.
 String getAlgorithm()
           
 Object getAttribute(String name)
           
 String[] getAttributeNames()
           
 String getPassword()
           
 String getUserID()
           
 boolean matches(SimpleCredentials credentials)
          Compares this instance with the given SimpleCredentials and returns true if both match.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CryptedSimpleCredentials

public CryptedSimpleCredentials(SimpleCredentials credentials)
                         throws NoSuchAlgorithmException,
                                UnsupportedEncodingException
Deprecated. 

Build a new instance of CryptedSimpleCredentials from the given SimpleCredentials and create the crypted password field using the default digest.

Parameters:
credentials -
Throws:
NoSuchAlgorithmException
UnsupportedEncodingException

CryptedSimpleCredentials

public CryptedSimpleCredentials(String userId,
                                String hashedPassword)
                         throws NoSuchAlgorithmException,
                                UnsupportedEncodingException
Create a new instanceof CryptedSimpleCredentials from the given userId and hashedPassword strings. In contrast to CryptedSimpleCredentials(SimpleCredentials) that expects the password to be plain text this constructor expects the password to be already crypted. However, it performs a simple validation and calls Text.digest(java.lang.String, java.lang.String, java.lang.String) using the default digest in case the given password is found to be plain text.

Parameters:
userId -
hashedPassword -
Throws:
NoSuchAlgorithmException
UnsupportedEncodingException
Method Detail

getUserID

public String getUserID()

getAttribute

public Object getAttribute(String name)

getAttributeNames

public String[] getAttributeNames()

getAlgorithm

public String getAlgorithm()

getPassword

public String getPassword()

matches

public boolean matches(SimpleCredentials credentials)
                throws NoSuchAlgorithmException,
                       UnsupportedEncodingException
Compares this instance with the given SimpleCredentials and returns true if both match. Successful match is defined to be the result of NOTE, that the simple credentials are exptected to contain the plain text password.

Parameters:
credentials - An instance of simple credentials.
Returns:
true if UserID and Password match.
Throws:
NoSuchAlgorithmException
UnsupportedEncodingException

buildPasswordHash

public static String buildPasswordHash(String password)
                                throws RepositoryException
Creates a hash of the specified password if it is found to be plain text.

Parameters:
password -
Returns:
Throws:
RepositoryException


Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.