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)
          Build a new instance of CryptedSimpleCredentials from the given SimpleCredentials and create the crypted password field using the default digest.
CryptedSimpleCredentials(String userId, String cryptedPassword)
          Create a new instanceof CryptedSimpleCredentials from the given userId and cryptedPassword strings.
 
Method Summary
 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
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 cryptedPassword)
                         throws NoSuchAlgorithmException,
                                UnsupportedEncodingException
Create a new instanceof CryptedSimpleCredentials from the given userId and cryptedPassword 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(String, byte[]) using the default digest in case the given password is found to be plain text.

Parameters:
userId -
cryptedPassword -
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


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