public class CryptedSimpleCredentials extends Object implements Credentials
SimpleCredentials
.Constructor and Description |
---|
CryptedSimpleCredentials(SimpleCredentials credentials)
Deprecated.
|
CryptedSimpleCredentials(String userId,
String hashedPassword)
Create a new instanceof
CryptedSimpleCredentials from the
given userId and hashedPassword strings. |
Modifier and Type | Method and Description |
---|---|
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. |
public CryptedSimpleCredentials(SimpleCredentials credentials) throws NoSuchAlgorithmException, UnsupportedEncodingException
CryptedSimpleCredentials
from the
given SimpleCredentials
and create
the crypted password field using the default digest
.credentials
- NoSuchAlgorithmException
UnsupportedEncodingException
public CryptedSimpleCredentials(String userId, String hashedPassword) throws NoSuchAlgorithmException, UnsupportedEncodingException
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 PasswordUtility.buildPasswordHash(String)
in case the
given password is found to be plain text.userId
- hashedPassword
- NoSuchAlgorithmException
UnsupportedEncodingException
public String getUserID()
public String[] getAttributeNames()
public String getAlgorithm()
public String getPassword()
public boolean matches(SimpleCredentials credentials) throws NoSuchAlgorithmException, UnsupportedEncodingException
SimpleCredentials
and
returns true
if both match. Successful match is defined to
be the result of
credentials
- An instance of simple credentials.UserID
and
Password
match.NoSuchAlgorithmException
UnsupportedEncodingException
Copyright © 2004–2021 The Apache Software Foundation. All rights reserved.