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 instanceofCryptedSimpleCredentialsfrom the givenuserIdandhashedPasswordstrings.CryptedSimpleCredentials(SimpleCredentials credentials)Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetAlgorithm()ObjectgetAttribute(String name)String[]getAttributeNames()StringgetPassword()StringgetUserID()booleanmatches(SimpleCredentials credentials)Compares this instance with the givenSimpleCredentialsand returnstrueif both match.
-
-
-
Constructor Detail
-
CryptedSimpleCredentials
@Deprecated public CryptedSimpleCredentials(SimpleCredentials credentials) throws NoSuchAlgorithmException, UnsupportedEncodingException
Deprecated.Build a new instance ofCryptedSimpleCredentialsfrom the givenSimpleCredentialsand create the crypted password field using thedefault digest.- Parameters:
credentials-- Throws:
NoSuchAlgorithmExceptionUnsupportedEncodingException
-
CryptedSimpleCredentials
public CryptedSimpleCredentials(String userId, String hashedPassword) throws NoSuchAlgorithmException, UnsupportedEncodingException
Create a new instanceofCryptedSimpleCredentialsfrom the givenuserIdandhashedPasswordstrings. 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:
NoSuchAlgorithmExceptionUnsupportedEncodingException
-
-
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 givenSimpleCredentialsand returnstrueif 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
UserIDandPasswordmatch. - Throws:
NoSuchAlgorithmExceptionUnsupportedEncodingException
-
-