Class AccountUsableResponseControl
- java.lang.Object
-
- com.unboundid.ldap.sdk.Control
-
- com.unboundid.ldap.sdk.unboundidds.controls.AccountUsableResponseControl
-
- All Implemented Interfaces:
DecodeableControl,java.io.Serializable
@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class AccountUsableResponseControl extends Control implements DecodeableControl
This class provides an implementation of the account usable response control, which may be returned with search result entries to provide information about the usability of the associated user accounts.
NOTE: This class, and other classes within the
com.unboundid.ldap.sdk.unboundiddspackage structure, are only supported for use against Ping Identity, UnboundID, and Nokia/Alcatel-Lucent 8661 server products. These classes provide support for proprietary functionality or for external specifications that are not considered stable or mature enough to be guaranteed to work in an interoperable way with other types of LDAP servers.
Information that may be included in the account usable response control includes:accountIsActive-- Indicates that the account is active and may include the length of time in seconds until the password expires.accountIsInactive-- Indicates that the account has been locked or deactivated.mustChangePassword-- Indicates that the user must change his or her password before being allowed to perform any other operations.passwordIsExpired-- Indicates that the user's password has expired.remainingGraceLogins-- Indicates the number of grace logins remaining for the user.secondsUntilUnlock-- Indicates the length of time in seconds until the account will be automatically unlocked.
AccountUsableRequestControldocumentation for an example demonstrating the use of the account usable request and response controls.
This control was designed by Sun Microsystems and is not based on any RFC or Internet draft. The value of this control is encoded as follows:
ACCOUNT_USABLE_RESPONSE ::= CHOICE { isUsable [0] INTEGER, -- Seconds until password expiration -- isNotUsable [1] MORE_INFO } MORE_INFO ::= SEQUENCE { accountIsInactive [0] BOOLEAN DEFAULT FALSE, mustChangePassword [1] BOOLEAN DEFAULT FALSE, passwordIsExpired [2] BOOLEAN DEFAULT FALSE, remainingGraceLogins [3] INTEGER OPTIONAL, secondsUntilUnlock [4] INTEGER OPTIONAL }- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringACCOUNT_USABLE_RESPONSE_OIDThe OID (1.3.6.1.4.1.42.2.27.9.5.8) for the account usable response control.
-
Constructor Summary
Constructors Constructor Description AccountUsableResponseControl(boolean isInactive, boolean mustChangePassword, boolean passwordIsExpired, int remainingGraceLogins, int secondsUntilUnlock)Creates a new account usable response control which indicates that the account is not usable.AccountUsableResponseControl(int secondsUntilExpiration)Creates a new account usable response control which indicates that the account is usable.AccountUsableResponseControl(java.lang.String oid, boolean isCritical, ASN1OctetString value)Creates a new account usable response control with the provided information.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AccountUsableResponseControldecodeControl(java.lang.String oid, boolean isCritical, ASN1OctetString value)Creates a new instance of this decodeable control from the provided information.static AccountUsableResponseControldecodeJSONControl(JSONObject controlObject, boolean strict)Attempts to decode the provided object as a JSON representation of an account usable response control.static AccountUsableResponseControlget(SearchResultEntry entry)Extracts an account usable response control from the provided search result entry.java.lang.StringgetControlName()Retrieves the user-friendly name for this control, if available.intgetRemainingGraceLogins()Retrieves the number of remaining grace logins for the user.intgetSecondsUntilExpiration()Retrieves the number of seconds until the user's password expires.intgetSecondsUntilUnlock()Retrieves the length of time in seconds until the user's account is automatically unlocked.java.util.List<java.lang.String>getUnusableReasons()Retrieves the list of reasons that this account may be unusable.booleanisInactive()Indicates whether the user account has been inactivated by a server administrator.booleanisUsable()Indicates whether the associated user account is usable.booleanmustChangePassword()Indicates whether the user must change his or her password before being allowed to perform any other operations.booleanpasswordIsExpired()Indicates whether the user's password is expired.JSONObjecttoJSONControl()Retrieves a representation of this account usable response control as a JSON object.voidtoString(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, decodeJSONControl, deregisterDecodeableControl, encode, encodeControls, equals, getOID, getValue, hashCode, hasValue, isCritical, readFrom, registerDecodeableControl, registerDecodeableControl, toString, writeTo
-
-
-
-
Field Detail
-
ACCOUNT_USABLE_RESPONSE_OID
@NotNull public static final java.lang.String ACCOUNT_USABLE_RESPONSE_OID
The OID (1.3.6.1.4.1.42.2.27.9.5.8) for the account usable response control.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AccountUsableResponseControl
public AccountUsableResponseControl(int secondsUntilExpiration)
Creates a new account usable response control which indicates that the account is usable.- Parameters:
secondsUntilExpiration- The length of time in seconds until the user's password expires, or -1 if password expiration is not enabled for the user.
-
AccountUsableResponseControl
public AccountUsableResponseControl(boolean isInactive, boolean mustChangePassword, boolean passwordIsExpired, int remainingGraceLogins, int secondsUntilUnlock)
Creates a new account usable response control which indicates that the account is not usable.- Parameters:
isInactive- Indicates whether the user account has been inactivated.mustChangePassword- Indicates whether the user is required to change his/her password before any other operations will be allowed.passwordIsExpired- Indicates whether the user's password has expired.remainingGraceLogins- The number of remaining grace logins for the user.secondsUntilUnlock- The length of time in seconds until the user's account will be automatically unlocked.
-
AccountUsableResponseControl
public AccountUsableResponseControl(@NotNull java.lang.String oid, boolean isCritical, @Nullable ASN1OctetString value) throws LDAPException
Creates a new account usable response control with the provided information.- Parameters:
oid- The OID for the control.isCritical- Indicates whether the control should be marked critical.value- The encoded value for the control. This may benullif no value was provided.- Throws:
LDAPException- If the provided control cannot be decoded as an account usable response control.
-
-
Method Detail
-
decodeControl
@NotNull public AccountUsableResponseControl decodeControl(@NotNull java.lang.String oid, boolean isCritical, @Nullable ASN1OctetString value) throws LDAPException
Creates a new instance of this decodeable control from the provided information.- Specified by:
decodeControlin interfaceDecodeableControl- Parameters:
oid- The OID for the control.isCritical- Indicates whether the control should be marked critical.value- The encoded value for the control. This may benullif no value was provided.- Returns:
- The decoded representation of this control.
- Throws:
LDAPException- If the provided information cannot be decoded as a valid instance of this decodeable control.
-
get
@Nullable public static AccountUsableResponseControl get(@NotNull SearchResultEntry entry) throws LDAPException
Extracts an account usable response control from the provided search result entry.- Parameters:
entry- The search result entry from which to retrieve the account usable response control.- Returns:
- The account usable response control contained in the provided
search result entry, or
nullif the entry did not contain an account usable response control. - Throws:
LDAPException- If a problem is encountered while attempting to decode the account usable response control contained in the provided result.
-
isUsable
public boolean isUsable()
Indicates whether the associated user account is usable.- Returns:
trueif the user account is usable, orfalseif not.
-
getUnusableReasons
@NotNull public java.util.List<java.lang.String> getUnusableReasons()
Retrieves the list of reasons that this account may be unusable.- Returns:
- The list of reasons that this account may be unusable, or an empty list if the account is usable or no reasons are available.
-
getSecondsUntilExpiration
public int getSecondsUntilExpiration()
Retrieves the number of seconds until the user's password expires. This will only available if the account is usable.- Returns:
- The number of seconds until the user's password expires, or -1 if the user account is not usable, or if password expiration is not enabled in the directory server.
-
isInactive
public boolean isInactive()
Indicates whether the user account has been inactivated by a server administrator.- Returns:
trueif the user account has been inactivated by a server administrator, orfalseif not.
-
mustChangePassword
public boolean mustChangePassword()
Indicates whether the user must change his or her password before being allowed to perform any other operations.- Returns:
trueif the user must change his or her password before being allowed to perform any other operations, orfalseif not.
-
passwordIsExpired
public boolean passwordIsExpired()
Indicates whether the user's password is expired.- Returns:
trueif the user's password is expired, orfalseif not.
-
getRemainingGraceLogins
public int getRemainingGraceLogins()
Retrieves the number of remaining grace logins for the user. This will only be available if the user account is not usable.- Returns:
- The number of remaining grace logins for the user, or -1 if this is not available (e.g., because the account is usable or grace login functionality is disabled on the server).
-
getSecondsUntilUnlock
public int getSecondsUntilUnlock()
Retrieves the length of time in seconds until the user's account is automatically unlocked. This will only be available if the user account is not usable.- Returns:
- The length of time in seconds until the user's account is automatically unlocked, or -1 if this is not available (e.g., because the account is usable, or because the account is not locked, or because automatic unlocking is disabled on the server).
-
getControlName
@NotNull public java.lang.String getControlName()
Retrieves the user-friendly name for this control, if available. If no user-friendly name has been defined, then the OID will be returned.- Overrides:
getControlNamein classControl- Returns:
- The user-friendly name for this control, or the OID if no user-friendly name is available.
-
toJSONControl
@NotNull public JSONObject toJSONControl()
Retrieves a representation of this account usable response control as a JSON object. The JSON object uses the following fields:-
oid-- A mandatory string field whose value is the object identifier for this control. For the account usable response control, the OID is "1.3.6.1.4.1.42.2.27.9.5.8". -
control-name-- An optional string field whose value is a human-readable name for this control. This field is only intended for descriptive purposes, and when decoding a control, theoidfield should be used to identify the type of control. -
criticality-- A mandatory Boolean field used to indicate whether this control is considered critical. -
value-base64-- An optional string field whose value is a base64-encoded representation of the raw value for this account usable response control. Exactly one of thevalue-base64andvalue-jsonfields must be present. -
value-json-- An optional JSON object field whose value is a user-friendly representation of the value for this account usable response control. Exactly one of thevalue-base64andvalue-jsonfields must be present, and if thevalue-jsonfield is used, then it will use the following fields:-
account-is-usable-- A Boolean field that indicates whether the account is in a usable state. -
seconds-until-password-expiration-- An optional integer field whose value is the number of seconds until the user's password expires. -
account-is-inactive-- A Boolean field that indicates whether the account has been administratively disabled. -
must-change-password-- A Boolean field that indicates whether the user must change their password before they can request any other operations -
password-is-expired-- A Boolean field that indicates whether the user's password is expired. -
remaining-grace-logins-- An optional integer field whose value is the number of remaining grace logins for the user. -
seconds-until-unlock-- An optional integer field whose value is the number of seconds until the user's account will be automatically unlocked.
-
- Overrides:
toJSONControlin classControl- Returns:
- A JSON object that contains a representation of this control.
-
-
decodeJSONControl
@NotNull public static AccountUsableResponseControl decodeJSONControl(@NotNull JSONObject controlObject, boolean strict) throws LDAPException
Attempts to decode the provided object as a JSON representation of an account usable response control.- Parameters:
controlObject- The JSON object to be decoded. It must not benull.strict- Indicates whether to use strict mode when decoding the provided JSON object. If this istrue, then this method will throw an exception if the provided JSON object contains any unrecognized fields. If this isfalse, then unrecognized fields will be ignored.- Returns:
- The account usable response control that was decoded from the provided JSON object.
- Throws:
LDAPException- If the provided JSON object cannot be parsed as a valid account usable response control.
-
-