|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.unboundid.ldap.sdk.Control
com.unboundid.ldap.sdk.controls.PasswordExpiredControl
@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class PasswordExpiredControl
This class provides an implementation of the password expired control as
described in draft-vchu-ldap-pwd-policy. It may be included in the response
for an unsuccessful bind operation to indicate that the reason for the
failure is that the target user's password has expired and must be reset
before the user will be allowed to authenticate. Some servers may also
include this control in a successful bind response to indicate that the
authenticated user must change his or her password before being allowed to
perform any other operation.
No request control is required to trigger the server to send the password
expired response control. If the server supports the use of this control and
the corresponding bind operation meets the criteria for this control to be
included in the response, then it will be returned to the client.
BindRequest bindRequest =
new SimpleBindRequest("uid=john.doe,ou=People,dc=example,dc=com",
"password");
try
{
BindResult bindResult = connection.bind(bindRequest);
for (Control c : bindResult.getResponseControls())
{
if (c instanceof PasswordExpiringControl)
{
System.err.println("WARNING: Your password will expire in " +
((PasswordExpiringControl) c).getSecondsUntilExpiration() +
" seconds.");
}
else if (c instanceof PasswordExpiredControl)
{
System.err.println("WARNING: You must change your password " +
"before you will be allowed to perform any other operations.");
}
}
}
catch (LDAPException le)
{
for (Control c : le.getResponseControls())
{
if (c instanceof PasswordExpiredControl)
{
System.err.println("ERROR: Your password is expired.");
}
}
}
| Field Summary | |
|---|---|
static java.lang.String |
PASSWORD_EXPIRED_OID
The OID (2.16.840.1.113730.3.4.4) for the password expired response control. |
| Constructor Summary | |
|---|---|
PasswordExpiredControl()
Creates a new password expired control. |
|
PasswordExpiredControl(java.lang.String oid,
boolean isCritical,
ASN1OctetString value)
Creates a new password expired control with the provided information. |
|
| Method Summary | |
|---|---|
PasswordExpiredControl |
decodeControl(java.lang.String oid,
boolean isCritical,
ASN1OctetString value)
Creates a new instance of this decodeable control from the provided information. |
static PasswordExpiredControl |
get(LDAPResult result)
Extracts a password expired control from the provided result. |
java.lang.String |
getControlName()
Retrieves the user-friendly name for this control, if available. |
void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of this LDAP control to the provided buffer. |
| Methods inherited from class com.unboundid.ldap.sdk.Control |
|---|
decode, decode, decodeControls, deregisterDecodeableControl, encode, encodeControls, equals, getOID, getValue, hashCode, hasValue, isCritical, readFrom, registerDecodeableControl, toString, writeTo |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String PASSWORD_EXPIRED_OID
| Constructor Detail |
|---|
public PasswordExpiredControl()
public PasswordExpiredControl(java.lang.String oid,
boolean isCritical,
ASN1OctetString value)
throws LDAPException
oid - The OID for the control.isCritical - Indicates whether the control should be marked
critical.value - The encoded value for the control. This may be
null if no value was provided.
LDAPException - If the provided control cannot be decoded as a
password expired response control.| Method Detail |
|---|
public PasswordExpiredControl decodeControl(java.lang.String oid,
boolean isCritical,
ASN1OctetString value)
throws LDAPException
decodeControl in interface DecodeableControloid - The OID for the control.isCritical - Indicates whether the control should be marked
critical.value - The encoded value for the control. This may be
null if no value was provided.
LDAPException - If the provided information cannot be decoded as a
valid instance of this decodeable control.
public static PasswordExpiredControl get(LDAPResult result)
throws LDAPException
result - The result from which to retrieve the password expired
control.
null if the result did not contain a password expired
control.
LDAPException - If a problem is encountered while attempting to
decode the password expired control contained in
the provided result.public java.lang.String getControlName()
getControlName in class Controlpublic void toString(java.lang.StringBuilder buffer)
toString in class Controlbuffer - The buffer to which to append the string representation of
this buffer.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||