Package com.unboundid.ldap.listener
Class InMemoryDirectoryServerPassword
- java.lang.Object
-
- com.unboundid.ldap.listener.InMemoryDirectoryServerPassword
-
@ThreadSafety(level=COMPLETELY_THREADSAFE) public final class InMemoryDirectoryServerPassword extends java.lang.Object
This class provides a data structure that encapsulates a password used by the in-memory directory server. It may be optionally associated with anInMemoryPasswordEncoder
.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getAttributeName()
Retrieves the name of the attribute with which the stored password is associated.ASN1OctetString
getClearPassword()
Retrieves the clear-text representation of the stored password, if it is possible to obtain it.InMemoryPasswordEncoder
getPasswordEncoder()
Retrieves the password encoder that should be used to interact with the stored password.ASN1OctetString
getStoredPassword()
Retrieves the password as it is (or has the potential to be) stored in the in-memory directory server.boolean
isEncoded()
Indicates whether the stored password is encoded or in the clear.boolean
matchesClearPassword(ASN1OctetString clearPassword)
Indicates whether this password matches the provided clear-text password.
-
-
-
Method Detail
-
getStoredPassword
public ASN1OctetString getStoredPassword()
Retrieves the password as it is (or has the potential to be) stored in the in-memory directory server. If theisEncoded()
method returnstrue
, then the stored password will be treated as an encoded password. Otherwise, it will be treated as a clear-text password with no encoding or output formatting.- Returns:
- The password as it is (or has the potential to be) stored in the in-memory directory server.
-
getAttributeName
public java.lang.String getAttributeName()
Retrieves the name of the attribute with which the stored password is associated.- Returns:
- The name of the attribute with which the stored password is associated.
-
isEncoded
public boolean isEncoded()
Indicates whether the stored password is encoded or in the clear.- Returns:
true
if the stored password is encoded, orfalse
if it is the clear.
-
getPasswordEncoder
public InMemoryPasswordEncoder getPasswordEncoder()
Retrieves the password encoder that should be used to interact with the stored password.- Returns:
- The password encoder that should be used to interact with the
stored password, or
null
if the password is not encoded.
-
getClearPassword
public ASN1OctetString getClearPassword() throws LDAPException
Retrieves the clear-text representation of the stored password, if it is possible to obtain it. If the password is not encoded, then the stored password will be returned as-is. If the stored password is encoded, then theInMemoryPasswordEncoder.extractClearPasswordFromEncodedPassword(com.unboundid.asn1.ASN1OctetString, com.unboundid.ldap.sdk.ReadOnlyEntry)
method will be used in an attempt to- Returns:
- The clear-text representation of the stored password.
- Throws:
LDAPException
- If the stored password is encoded using a mechanism that does not permit extracting the clear-text password.
-
matchesClearPassword
public boolean matchesClearPassword(ASN1OctetString clearPassword) throws LDAPException
Indicates whether this password matches the provided clear-text password.- Parameters:
clearPassword
- The clear-text password for which to make the determination.- Returns:
true
if this password matches the provided clear-text password, orfalse
if not.- Throws:
LDAPException
- If a problem is encountered while trying to make the determination.
-
-