Class CryptedSimpleCredentials
- java.lang.Object
-
- org.apache.jackrabbit.core.security.authentication.CryptedSimpleCredentials
-
- All Implemented Interfaces:
Serializable
,Credentials
public class CryptedSimpleCredentials extends Object implements Credentials
Crypted variant of theSimpleCredentials
.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CryptedSimpleCredentials(String userId, String hashedPassword)
Create a new instanceofCryptedSimpleCredentials
from the givenuserId
andhashedPassword
strings.CryptedSimpleCredentials(SimpleCredentials credentials)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getAlgorithm()
Object
getAttribute(String name)
String[]
getAttributeNames()
String
getPassword()
String
getUserID()
boolean
matches(SimpleCredentials credentials)
Compares this instance with the givenSimpleCredentials
and returnstrue
if both match.
-
-
-
Constructor Detail
-
CryptedSimpleCredentials
@Deprecated public CryptedSimpleCredentials(SimpleCredentials credentials) throws NoSuchAlgorithmException, UnsupportedEncodingException
Deprecated.Build a new instance ofCryptedSimpleCredentials
from the givenSimpleCredentials
and create the crypted password field using thedefault digest
.- Parameters:
credentials
-- Throws:
NoSuchAlgorithmException
UnsupportedEncodingException
-
CryptedSimpleCredentials
public CryptedSimpleCredentials(String userId, String hashedPassword) throws NoSuchAlgorithmException, UnsupportedEncodingException
Create a new instanceofCryptedSimpleCredentials
from the givenuserId
andhashedPassword
strings. In contrast toCryptedSimpleCredentials(javax.jcr.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 callsPasswordUtility.buildPasswordHash(String)
in case the given password is found to be plain text.- Parameters:
userId
-hashedPassword
-- Throws:
NoSuchAlgorithmException
UnsupportedEncodingException
-
-
Method Detail
-
getUserID
public String getUserID()
-
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 givenSimpleCredentials
and returnstrue
if both match. Successful match is defined to be the result of- Case-insensitive comparison of the UserIDs
- Equality of the passwords if the password contained in the simple credentials is hashed with the algorithm defined in this credentials object.
- Parameters:
credentials
- An instance of simple credentials.- Returns:
- true if
UserID
andPassword
match. - Throws:
NoSuchAlgorithmException
UnsupportedEncodingException
-
-