org.opends.server.controls
Class AccountUsableResponseControl

java.lang.Object
  extended by org.opends.server.types.Control
      extended by org.opends.server.controls.AccountUsableResponseControl

public class AccountUsableResponseControl
extends Control

This class implements the account usable response control. This is a Sun-defined control with OID 1.3.6.1.4.1.42.2.27.9.5.8. The value of this control is composed according to the following BNF:

 ACCOUNT_USABLE_RESPONSE ::= CHOICE {
      is_available           [0] INTEGER, -- Seconds before expiration --
      is_not_available       [1] MORE_INFO }

 MORE_INFO ::= SEQUENCE {
      inactive               [0] BOOLEAN DEFAULT FALSE,
      reset                  [1] BOOLEAN DEFAULT FALSE,
      expired                [2] BOOLEAN DEFAULT_FALSE,
      remaining_grace        [3] INTEGER OPTIONAL,
      seconds_before_unlock  [4] INTEGER OPTIONAL }
 


Field Summary
static byte TYPE_EXPIRED
          The BER type to use for the MORE_INFO element that indicates that the user's password is expired.
static byte TYPE_INACTIVE
          The BER type to use for the MORE_INFO element that indicates that the account has been inactivated.
static byte TYPE_MORE_INFO
          The BER type to use for the MORE_INFO sequence when the account is not available.
static byte TYPE_REMAINING_GRACE_LOGINS
          The BER type to use for the MORE_INFO element that provides the number of remaining grace logins.
static byte TYPE_RESET
          The BER type to use for the MORE_INFO element that indicates that the password has been administratively reset.
static byte TYPE_SECONDS_BEFORE_EXPIRATION
          The BER type to use for the seconds before expiration when the account is available.
static byte TYPE_SECONDS_BEFORE_UNLOCK
          The BER type to use for the MORE_INFO element that indicates that the password has been administratively reset.
 
Constructor Summary
AccountUsableResponseControl(boolean isInactive, boolean isReset, boolean isExpired, int remainingGraceLogins, boolean isLocked, int secondsBeforeUnlock)
          Creates a new account usability response control that may be used to indicate that the account is not available and provide information about the underlying reason.
AccountUsableResponseControl(int secondsBeforeExpiration)
          Creates a new account usability response control that may be used to indicate that the account is available and provide the number of seconds until expiration.
AccountUsableResponseControl(java.lang.String oid, boolean isCritical, boolean isInactive, boolean isReset, boolean isExpired, int remainingGraceLogins, boolean isLocked, int secondsBeforeUnlock)
          Creates a new account usability response control that may be used to indicate that the account is not available and provide information about the underlying reason.
AccountUsableResponseControl(java.lang.String oid, boolean isCritical, int secondsBeforeExpiration)
          Creates a new account usability response control that may be used to indicate that the account is available and provide the number of seconds until expiration.
 
Method Summary
static AccountUsableResponseControl decodeControl(Control control)
          Creates a new account usable response control from the contents of the provided control.
 int getRemainingGraceLogins()
          Retrieves the number of remaining grace logins for the user.
 int getSecondsBeforeExpiration()
          Retrieves the length of time in seconds before the user's password expires.
 int getSecondsBeforeUnlock()
          Retrieves the length of time in seconds before the user's account is automatically unlocked.
 boolean isExpired()
          Indicates whether the user's password is expired.
 boolean isInactive()
          Indicates whether the user's account has been inactivated by an administrator.
 boolean isLocked()
          Indicates whether the user's account is locked for some reason.
 boolean isReset()
          Indicates whether the user's password has been administratively reset and the user must change that password before any other operations will be allowed.
 boolean isUsable()
          Indicates whether the associated user account is available for use.
 java.lang.String toString()
          Retrieves a string representation of this password policy response control.
 void toString(java.lang.StringBuilder buffer)
          Appends a string representation of this password policy response control to the provided buffer.
 
Methods inherited from class org.opends.server.types.Control
getOID, getValue, hasValue, isCritical, setCritical, setOID, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_SECONDS_BEFORE_EXPIRATION

public static final byte TYPE_SECONDS_BEFORE_EXPIRATION
The BER type to use for the seconds before expiration when the account is available.

See Also:
Constant Field Values

TYPE_MORE_INFO

public static final byte TYPE_MORE_INFO
The BER type to use for the MORE_INFO sequence when the account is not available.

See Also:
Constant Field Values

TYPE_INACTIVE

public static final byte TYPE_INACTIVE
The BER type to use for the MORE_INFO element that indicates that the account has been inactivated.

See Also:
Constant Field Values

TYPE_RESET

public static final byte TYPE_RESET
The BER type to use for the MORE_INFO element that indicates that the password has been administratively reset.

See Also:
Constant Field Values

TYPE_EXPIRED

public static final byte TYPE_EXPIRED
The BER type to use for the MORE_INFO element that indicates that the user's password is expired.

See Also:
Constant Field Values

TYPE_REMAINING_GRACE_LOGINS

public static final byte TYPE_REMAINING_GRACE_LOGINS
The BER type to use for the MORE_INFO element that provides the number of remaining grace logins.

See Also:
Constant Field Values

TYPE_SECONDS_BEFORE_UNLOCK

public static final byte TYPE_SECONDS_BEFORE_UNLOCK
The BER type to use for the MORE_INFO element that indicates that the password has been administratively reset.

See Also:
Constant Field Values
Constructor Detail

AccountUsableResponseControl

public AccountUsableResponseControl(int secondsBeforeExpiration)
Creates a new account usability response control that may be used to indicate that the account is available and provide the number of seconds until expiration. It will use the default OID and criticality.

Parameters:
secondsBeforeExpiration - The length of time in seconds until the user's password expires, or -1 if the user's password will not expire or the expiration time is unknown.

AccountUsableResponseControl

public AccountUsableResponseControl(java.lang.String oid,
                                    boolean isCritical,
                                    int secondsBeforeExpiration)
Creates a new account usability response control that may be used to indicate that the account is available and provide the number of seconds until expiration.

Parameters:
oid - The OID for this account usability response control.
isCritical - Indicates whether this control should be marked critical.
secondsBeforeExpiration - The length of time in seconds until the user's password expires, or -1 if the user's password will not expire or the expiration time is unknown.

AccountUsableResponseControl

public AccountUsableResponseControl(boolean isInactive,
                                    boolean isReset,
                                    boolean isExpired,
                                    int remainingGraceLogins,
                                    boolean isLocked,
                                    int secondsBeforeUnlock)
Creates a new account usability response control that may be used to indicate that the account is not available and provide information about the underlying reason. It will use the default OID and criticality.

Parameters:
isInactive - Indicates whether the user's account has been inactivated by an administrator.
isReset - Indicates whether the user's password has been reset by an administrator.
isExpired - Indicates whether the user's password is expired.
remainingGraceLogins - The number of grace logins remaining. A value of zero indicates that there are none remaining. A value of -1 indicates that grace login functionality is not enabled.
isLocked - Indicates whether the user's account is currently locked out.
secondsBeforeUnlock - The length of time in seconds until the account is unlocked. A value of -1 indicates that the account will not be automatically unlocked and must be reset by an administrator.

AccountUsableResponseControl

public AccountUsableResponseControl(java.lang.String oid,
                                    boolean isCritical,
                                    boolean isInactive,
                                    boolean isReset,
                                    boolean isExpired,
                                    int remainingGraceLogins,
                                    boolean isLocked,
                                    int secondsBeforeUnlock)
Creates a new account usability response control that may be used to indicate that the account is not available and provide information about the underlying reason.

Parameters:
oid - The OID for this account usability response control.
isCritical - Indicates whether this control should be marked critical.
isInactive - Indicates whether the user's account has been inactivated by an administrator.
isReset - Indicates whether the user's password has been reset by an administrator.
isExpired - Indicates whether the user's password is expired.
remainingGraceLogins - The number of grace logins remaining. A value of zero indicates that there are none remaining. A value of -1 indicates that grace login functionality is not enabled.
isLocked - Indicates whether the user's account is currently locked out.
secondsBeforeUnlock - The length of time in seconds until the account is unlocked. A value of -1 indicates that the account will not be automatically unlocked and must be reset by an administrator.
Method Detail

decodeControl

public static AccountUsableResponseControl decodeControl(Control control)
                                                  throws LDAPException
Creates a new account usable response control from the contents of the provided control.

Parameters:
control - The generic control containing the information to use to create this account usable response control.
Returns:
The account usable response control decoded from the provided control.
Throws:
LDAPException - If this control cannot be decoded as a valid account usable response control.

isUsable

public boolean isUsable()
Indicates whether the associated user account is available for use.

Returns:
true if the associated user account is available, or false if not.

getSecondsBeforeExpiration

public int getSecondsBeforeExpiration()
Retrieves the length of time in seconds before the user's password expires. This value is unreliable if the account is not available.

Returns:
The length of time in seconds before the user's password expires, or -1 if it is unknown or password expiration is not enabled for the user.

isInactive

public boolean isInactive()
Indicates whether the user's account has been inactivated by an administrator.

Returns:
true if the user's account has been inactivated by an administrator, or false if not.

isReset

public boolean isReset()
Indicates whether the user's password has been administratively reset and the user must change that password before any other operations will be allowed.

Returns:
true if the user's password has been administratively reset, or false if not.

isExpired

public boolean isExpired()
Indicates whether the user's password is expired.

Returns:
true if the user's password is expired, or false if not.

getRemainingGraceLogins

public int getRemainingGraceLogins()
Retrieves the number of remaining grace logins for the user. This value is unreliable if the user's password is not expired.

Returns:
The number of remaining grace logins for the user, or -1 if the grace logins feature is not enabled for the user.

isLocked

public boolean isLocked()
Indicates whether the user's account is locked for some reason.

Returns:
true if the user's account is locked, or false if it is not.

getSecondsBeforeUnlock

public int getSecondsBeforeUnlock()
Retrieves the length of time in seconds before the user's account is automatically unlocked. This value is unreliable is the user's account is not locked.

Returns:
The length of time in seconds before the user's account is automatically unlocked, or -1 if it requires administrative action to unlock the account.

toString

public java.lang.String toString()
Retrieves a string representation of this password policy response control.

Overrides:
toString in class Control
Returns:
A string representation of this password policy response control.

toString

public void toString(java.lang.StringBuilder buffer)
Appends a string representation of this password policy response control to the provided buffer.

Overrides:
toString in class Control
Parameters:
buffer - The buffer to which the information should be appended.