Package org.ldaptive.control
Class PasswordPolicyControl
java.lang.Object
org.ldaptive.control.AbstractControl
org.ldaptive.control.PasswordPolicyControl
- All Implemented Interfaces:
Control
,RequestControl
,ResponseControl
public class PasswordPolicyControl
extends AbstractControl
implements RequestControl, ResponseControl
Request/response control for password policy. See http://tools.ietf.org/html/draft-behera-ldap-password-policy-10.
Control is defined as:
PasswordPolicyResponseValue ::= SEQUENCE { warning [0] CHOICE { timeBeforeExpiration [0] INTEGER (0 .. maxInt), graceAuthNsRemaining [1] INTEGER (0 .. maxInt) } OPTIONAL, error [1] ENUMERATED { passwordExpired (0), accountLocked (1), changeAfterReset (2), passwordModNotAllowed (3), mustSupplyOldPassword (4), insufficientPasswordQuality (5), passwordTooShort (6), passwordTooYoung (7), passwordInHistory (8) } OPTIONAL }
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enum for ppolicy errors.private static class
Parse handler implementation for the error.private static class
Parse handler implementation for the grace authns remaining.private static class
Parse handler implementation for the time before expiration. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate PasswordPolicyControl.Error
Ppolicy error.private int
Ppolicy warning.private static final int
hash code seed.static final String
OID of this control.private int
Ppolicy warning.Fields inherited from class org.ldaptive.control.AbstractControl
logger
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.PasswordPolicyControl
(boolean critical) Creates a new password policy control. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Initializes this response control with the supplied BER encoded data.byte[]
encode()
Provides the BER encoding of this control.boolean
getError()
Returns the password policy error.int
Returns the number of grace authentications remaining.int
Returns the time before expiration in seconds.int
hashCode()
Returns the hash code for this object.boolean
hasValue()
Returns whether the control has a value associated with it.void
Sets the password policy error.void
setGraceAuthNsRemaining
(int count) Sets the number of grace authentications remaining.void
setTimeBeforeExpiration
(int time) Sets the time before expiration in seconds.toString()
Methods inherited from class org.ldaptive.control.AbstractControl
getCriticality, getOID
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.ldaptive.control.Control
getCriticality, getOID
-
Field Details
-
OID
OID of this control.- See Also:
-
HASH_CODE_SEED
private static final int HASH_CODE_SEEDhash code seed.- See Also:
-
timeBeforeExpiration
private int timeBeforeExpirationPpolicy warning. -
graceAuthNsRemaining
private int graceAuthNsRemainingPpolicy warning. -
error
Ppolicy error.
-
-
Constructor Details
-
PasswordPolicyControl
public PasswordPolicyControl()Default constructor. -
PasswordPolicyControl
public PasswordPolicyControl(boolean critical) Creates a new password policy control.- Parameters:
critical
- whether this control is critical
-
-
Method Details
-
hasValue
public boolean hasValue()Description copied from interface:RequestControl
Returns whether the control has a value associated with it.- Specified by:
hasValue
in interfaceRequestControl
- Returns:
- whether the control has a value
-
getTimeBeforeExpiration
public int getTimeBeforeExpiration()Returns the time before expiration in seconds.- Returns:
- time before expiration
-
setTimeBeforeExpiration
public void setTimeBeforeExpiration(int time) Sets the time before expiration in seconds.- Parameters:
time
- before expiration
-
getGraceAuthNsRemaining
public int getGraceAuthNsRemaining()Returns the number of grace authentications remaining.- Returns:
- number of grace authentications remaining
-
setGraceAuthNsRemaining
public void setGraceAuthNsRemaining(int count) Sets the number of grace authentications remaining.- Parameters:
count
- number of grace authentications remaining
-
getError
Returns the password policy error.- Returns:
- password policy error
-
setError
Sets the password policy error.- Parameters:
e
- password policy error
-
equals
- Overrides:
equals
in classAbstractControl
-
hashCode
public int hashCode()Description copied from class:AbstractControl
Returns the hash code for this object.- Specified by:
hashCode
in classAbstractControl
- Returns:
- hash code
-
toString
- Overrides:
toString
in classAbstractControl
-
encode
public byte[] encode()Description copied from interface:RequestControl
Provides the BER encoding of this control.- Specified by:
encode
in interfaceRequestControl
- Returns:
- BER encoded request control
-
decode
Description copied from interface:ResponseControl
Initializes this response control with the supplied BER encoded data.- Specified by:
decode
in interfaceResponseControl
- Parameters:
encoded
- BER encoded response control
-