public final class PasswordPolicyState extends AuthenticationPolicyState
isDisabled, userEntry
Modifier and Type | Method and Description |
---|---|
void |
clearAccountExpirationTime()
Clears the user's account expiration time.
|
void |
clearFailureLockout()
Updates the user account to remove any record of a previous lockout due to failed authentications.
|
void |
clearGraceLoginTimes()
Updates the user entry to remove any record of previous grace logins.
|
void |
clearLastLoginTime()
Clears the last login time from the user's entry.
|
void |
clearPasswordChangedTime()
Removes the password changed time value from the user's entry.
|
void |
clearPasswordHistory()
Clears the password history state information for the user.
|
void |
clearRequiredChangeTime()
Updates the user entry to remove any timestamp indicating that the password has been changed in accordance with
the required change time.
|
void |
clearWarnedTime()
Updates the user entry to clear the warned time.
|
List<ByteString> |
encodePassword(ByteString password)
Encodes the provided password using the default storage schemes (using the appropriate syntax for the password
attribute).
|
void |
finalizeStateAfterBind()
Performs any finalization required after a bind operation has completed.
|
void |
generateAccountStatusNotification(AccountStatusNotificationType notificationType,
Entry userEntry,
LocalizableMessage message,
Map<AccountStatusNotificationProperty,List<String>> notificationProperties)
Generates an account status notification for this user.
|
ByteString |
generatePassword()
Generates a new password for the user.
|
long |
getAccountExpirationTime()
Retrieves the time at which the user's account will expire.
|
PasswordPolicy |
getAuthenticationPolicy()
Returns the authentication policy associated with this state.
|
List<Long> |
getAuthFailureTimes()
Retrieves the set of times of failed authentication attempts for the user.
|
List<ByteString> |
getClearPasswords()
Retrieves a list of the clear-text passwords for the user.
|
long |
getCurrentTime()
Retrieves the time that this password policy state object was created.
|
int |
getGraceLoginsRemaining()
Retrieves the number of grace logins that the user has left.
|
List<Long> |
getGraceLoginTimes()
Retrieves the times that the user has authenticated to the server using a grace login.
|
long |
getLastLoginTime()
Retrieves the time that the user last authenticated to the Directory Server.
|
List<Modification> |
getModifications()
Retrieves the set of modifications that correspond to changes made in password policy processing that may need to
be applied to the user entry.
|
long |
getPasswordChangedTime()
Retrieves the time that the password was last changed.
|
long |
getPasswordExpirationTime()
Retrieves the time that the user's password should expire (if the expiration is in the future) or did expire (if
the expiration was in the past).
|
List<String> |
getPasswordHistoryValues()
Retrieves the password history state values for the user.
|
Collection<ByteString> |
getPasswordValues()
Retrieves the unmodifiable set of values for the password attribute from the user entry.
|
long |
getRequiredChangeTime()
Retrieves the timestamp for the last required change time that the user complied with.
|
int |
getSecondsUntilExpiration()
Retrieves the length of time in seconds until the user's password expires.
|
int |
getSecondsUntilUnlock()
Retrieves the length of time in seconds until the user's account is automatically unlocked.
|
long |
getWarnedTime()
Retrieves the time that the user was first warned about an upcoming expiration.
|
void |
handleDeprecatedStorageSchemes(ByteString password)
Performs any processing that may be necessary to remove deprecated storage schemes from the user's entry that
match the provided password and re-encodes them using the default schemes.
|
boolean |
isAccountExpired()
Indicates whether the user's account is currently expired.
|
boolean |
isFirstWarning()
Indicates whether the warning that the user should receive would be the first warning for the user.
|
boolean |
isLocked()
Returns whether the account was locked for any reason.
|
boolean |
isPasswordExpired()
Indicates whether the user's password is currently expired.
|
boolean |
isPasswordInHistory(ByteString password)
Indicates whether the provided password is equal to any of the current passwords, or any of the passwords in the
history.
|
boolean |
isWithinMinimumAge()
Indicates whether the user's last password change was within the minimum password age.
|
boolean |
lockedDueToFailures()
Indicates whether the associated user should be considered locked out as a result of too many authentication
failures.
|
boolean |
lockedDueToIdleInterval()
Indicates whether the user's account is currently locked because it has been idle for too long.
|
boolean |
lockedDueToMaximumResetAge()
Indicates whether the user's account is locked because the password has been reset by an administrator but the
user did not change the password in a timely manner.
|
boolean |
maintainHistory()
Indicates whether password history information should be maintained for this user.
|
boolean |
mayUseGraceLogin()
Indicates whether the user may use a grace login if the password is expired and there is at least one grace login
remaining.
|
boolean |
mustChangePassword()
Indicates whether the user's password must be changed before any other operation can be performed.
|
boolean |
passwordIsAcceptable(Operation operation,
Entry userEntry,
ByteString newPassword,
Set<ByteString> currentPasswords,
LocalizableMessageBuilder invalidReason)
Indicates whether the provided password appears to be acceptable according to the password validators.
|
boolean |
passwordIsPreEncoded(ByteString passwordValue)
Indicates whether the provided password value is pre-encoded.
|
boolean |
passwordMatches(ByteString password)
Returns
true if the provided password value matches any of the user's passwords. |
boolean |
passwordMatches(ByteString password,
Entry entry)
Returns
true if the provided password value matches any of the user's passwords in the given entry. |
void |
setAccountExpirationTime(long accountExpirationTime)
Sets the user's account expiration time to the specified value.
|
void |
setAuthFailureTimes(List<Long> authFailureTimes)
Explicitly specifies the auth failure times for the associated user.
|
void |
setDisabled(boolean isDisabled)
Updates the user entry to indicate whether user account has been administratively disabled.
|
void |
setGraceLoginTimes(List<Long> graceLoginTimes)
Specifies the set of grace login use times for the associated user.
|
void |
setLastLoginTime()
Updates the user entry to set the current time as the last login time.
|
void |
setLastLoginTime(long lastLoginTime)
Updates the user entry to use the specified last login time.
|
void |
setMustChangePassword(boolean mustChangePassword)
Updates the user entry to indicate whether the user's password must be changed.
|
void |
setPasswordChangedTime()
Sets a new value for the password changed time equal to the current time.
|
void |
setPasswordChangedTime(long passwordChangedTime)
Sets a new value for the password changed time equal to the specified time.
|
void |
setRequiredChangeTime()
Updates the user entry with a timestamp indicating that the password has been changed in accordance with the
require change time.
|
void |
setRequiredChangeTime(long requiredChangeTime)
Updates the user entry with a timestamp indicating that the password has been changed in accordance with the
require change time.
|
void |
setWarnedTime()
Updates the user entry to set the warned time to the current time.
|
void |
setWarnedTime(long warnedTime)
Updates the user entry to set the warned time to the specified time.
|
boolean |
shouldWarn()
Indicates whether the user should receive a warning notification that the password is about to expire.
|
void |
updateAuthFailureTimes()
Updates the set of authentication failure times to include the current time.
|
void |
updateGraceLoginTimes()
Updates the set of grace login times for the user to include the current time.
|
void |
updatePasswordHistory()
Updates the password history information for this user by adding one of the passwords to it.
|
forUser, getBoolean, getGeneralizedTime, isDisabled, isPasswordPolicy
public PasswordPolicy getAuthenticationPolicy()
AuthenticationPolicyState
getAuthenticationPolicy
in class AuthenticationPolicyState
public long getPasswordChangedTime()
public long getCurrentTime()
public Collection<ByteString> getPasswordValues()
public void setPasswordChangedTime()
public void setPasswordChangedTime(long passwordChangedTime)
passwordChangedTime
- The time to usepublic void clearPasswordChangedTime()
public void setDisabled(boolean isDisabled)
isDisabled
- Indicates whether the user account has been administratively disabled.public boolean isAccountExpired()
true
if the user's account is expired, or false
if not.public long getAccountExpirationTime()
public void setAccountExpirationTime(long accountExpirationTime)
accountExpirationTime
- The time that the user's account should expire.public void clearAccountExpirationTime()
public List<Long> getAuthFailureTimes()
public void updateAuthFailureTimes()
public void setAuthFailureTimes(List<Long> authFailureTimes)
authFailureTimes
- The set of auth failure times to use for the account. An empty list or null
will clear the
account of any existing failures.public boolean lockedDueToFailures()
true
if the user is currently locked out due to too many authentication failures, or
false
if not.public int getSecondsUntilUnlock()
lockedDueToFailures
.public void clearFailureLockout()
public long getLastLoginTime()
public void setLastLoginTime()
public void setLastLoginTime(long lastLoginTime)
lastLoginTime
- The last login time to set in the user entry.public void clearLastLoginTime()
public boolean lockedDueToIdleInterval()
true
if the user's account is locked because it has been idle for too long, or
false
if not.public boolean mustChangePassword()
true
if the user's password must be changed before any other operation can be performed.public void setMustChangePassword(boolean mustChangePassword)
mustChangePassword
- Indicates whether the user's password must be changed.public boolean lockedDueToMaximumResetAge()
true
if the user's account is locked because of the maximum reset age, or >false
if not.public boolean isLocked()
public long getPasswordExpirationTime()
lockedDueToMaximumResetAge
method because grace logins will not be allowed in the case that the
maximum reset age has passed whereas they may be used for expiration due to maximum password age or forced change
time.public boolean isPasswordExpired()
true
if the user's password is currently expired, or false
if not.public boolean isWithinMinimumAge()
true
if the password minimum age is nonzero, the account is not in force-change mode,
and the last password change was within the minimum age, or false
otherwise.public boolean mayUseGraceLogin()
true
if the user may use a grace login if the password is expired and there is at least one
grace login remaining, or false
if the user may not use a grace login for some reason.public boolean shouldWarn()
true
if the user should receive a warning notification that the password is about to expire,
or false
if not.public boolean isFirstWarning()
true
if the warning that should be sent to the user would be the first warning,
or false
if not.public int getSecondsUntilExpiration()
public long getRequiredChangeTime()
public void setRequiredChangeTime()
public void setRequiredChangeTime(long requiredChangeTime)
requiredChangeTime
- The timestamp to use for the required change time value.public void clearRequiredChangeTime()
public long getWarnedTime()
public void setWarnedTime()
public void setWarnedTime(long warnedTime)
warnedTime
- The value to use for the warned time.public void clearWarnedTime()
public List<Long> getGraceLoginTimes()
public int getGraceLoginsRemaining()
public void updateGraceLoginTimes()
public void setGraceLoginTimes(List<Long> graceLoginTimes)
null
, then the set will be cleared.graceLoginTimes
- The grace login use times for the associated user.public void clearGraceLoginTimes()
public List<ByteString> getClearPasswords()
public boolean passwordMatches(ByteString password)
AuthenticationPolicyState
true
if the provided password value matches any of the user's passwords.passwordMatches
in class AuthenticationPolicyState
password
- The user-provided password to verify.true
if the provided password value matches any of the user's passwords.public boolean passwordMatches(ByteString password, Entry entry)
true
if the provided password value matches any of the user's passwords in the given entry.password
- The user-provided password to verify.entry
- The user's entry.true
if the provided password value matches any of the user's passwords.public boolean passwordIsPreEncoded(ByteString passwordValue)
passwordValue
- The value for which to make the determination.true
if the provided password value is pre-encoded, or false
if it is not.public List<ByteString> encodePassword(ByteString password) throws LdapException
password
- The password to be encoded.LdapException
- If a problem occurs while attempting to encode the password.public boolean passwordIsAcceptable(Operation operation, Entry userEntry, ByteString newPassword, Set<ByteString> currentPasswords, LocalizableMessageBuilder invalidReason)
operation
- The operation that provided the password.userEntry
- The user entry in which the password is used.newPassword
- The password to be validated.currentPasswords
- The set of clear-text current passwords for the user (this may be a subset if not all of them are
available in the clear, or empty if none of them are available in the clear).invalidReason
- A buffer that may be used to hold the invalid reason if the password is rejected.true
if the password is acceptable for use, or false
if it is not.public void handleDeprecatedStorageSchemes(ByteString password)
password
- The clear-text password provided by the user.public boolean maintainHistory()
true
if password history information should be maintained for this user, or false
if not.public boolean isPasswordInHistory(ByteString password)
password
- The password for which to make the determination.true
if the provided password is equal to any of the current passwords or any of the passwords in
the history, or false
if not.public void updatePasswordHistory()
public List<String> getPasswordHistoryValues()
public void clearPasswordHistory()
public ByteString generatePassword() throws LdapException
null
if no password generator has been defined.LdapException
- If an error occurs while attempting to generate the new password.public void generateAccountStatusNotification(AccountStatusNotificationType notificationType, Entry userEntry, LocalizableMessage message, Map<AccountStatusNotificationProperty,List<String>> notificationProperties)
notificationType
- The type for the account status notification.userEntry
- The entry for the user to which this notification applies.message
- The human-readable message for the notification.notificationProperties
- The set of properties for the notification.public List<Modification> getModifications()
public void finalizeStateAfterBind() throws LdapException
AuthenticationPolicyState
finalizeStateAfterBind
in class AuthenticationPolicyState
LdapException
- If a problem occurs during finalization.Copyright 2010-2022 ForgeRock AS.