Package com.unboundid.ldap.sdk
Class PasswordExpirationLDAPConnectionPoolHealthCheck
- java.lang.Object
-
- com.unboundid.ldap.sdk.LDAPConnectionPoolHealthCheck
-
- com.unboundid.ldap.sdk.PasswordExpirationLDAPConnectionPoolHealthCheck
-
@ThreadSafety(level=COMPLETELY_THREADSAFE) public final class PasswordExpirationLDAPConnectionPoolHealthCheck extends LDAPConnectionPoolHealthCheck
This class provides anLDAPConnectionPoolHealthCheck
implementation that may be used to output a warning message about a password expiration that has occurred or is about to occur. It examines a bind result to see if it includes aPasswordExpiringControl
, aPasswordExpiredControl
, or aDraftBeheraLDAPPasswordPolicy10ResponseControl
that might indicate that the user's password is about to expire, has already expired, or is in a state that requires the user to change the password before they will be allowed to perform any other operation. In the event of a warning about an upcoming problem, the health check may write a message to a givenOutputStream
orWriter
. In the event of a problem that will interfere with connection use, it will throw an exception to indicate that the connection is not valid.
-
-
Constructor Summary
Constructors Constructor Description PasswordExpirationLDAPConnectionPoolHealthCheck()
Creates a new instance of this health check that will throw an exception for any password policy-related warnings or errors encountered.PasswordExpirationLDAPConnectionPoolHealthCheck(java.io.OutputStream outputStream)
Creates a new instance of this health check that will write any password policy-related warning message to the providedOutputStream
.PasswordExpirationLDAPConnectionPoolHealthCheck(java.io.OutputStream outputStream, java.lang.Long millisBetweenRepeatWarnings)
Creates a new instance of this health check that will write any password policy-related warning messages to the providedOutputStream
.PasswordExpirationLDAPConnectionPoolHealthCheck(java.io.Writer writer)
Creates a new instance of this health check that will write any password policy-related warning message to the providedWriter
.PasswordExpirationLDAPConnectionPoolHealthCheck(java.io.Writer writer, java.lang.Long millisBetweenRepeatWarnings)
Creates a new instance of this health check that will write any password policy-related warning messages to the providedOutputStream
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
ensureConnectionValidAfterAuthentication(LDAPConnection connection, BindResult bindResult)
Performs any desired processing to determine whether the provided connection is valid after processing a bind operation with the provided result.void
toString(java.lang.StringBuilder buffer)
Appends a string representation of this LDAP connection pool health check to the provided buffer.-
Methods inherited from class com.unboundid.ldap.sdk.LDAPConnectionPoolHealthCheck
ensureConnectionValidAfterException, ensureConnectionValidForCheckout, ensureConnectionValidForContinuedUse, ensureConnectionValidForRelease, ensureNewConnectionValid, performPoolMaintenance, toString
-
-
-
-
Constructor Detail
-
PasswordExpirationLDAPConnectionPoolHealthCheck
public PasswordExpirationLDAPConnectionPoolHealthCheck()
Creates a new instance of this health check that will throw an exception for any password policy-related warnings or errors encountered.
-
PasswordExpirationLDAPConnectionPoolHealthCheck
public PasswordExpirationLDAPConnectionPoolHealthCheck(java.io.OutputStream outputStream)
Creates a new instance of this health check that will write any password policy-related warning message to the providedOutputStream
. It will only write the first warning and will suppress all subsequent warnings. It will throw an exception for any password policy-related errors encountered.- Parameters:
outputStream
- The output stream to which a warning message should be written.
-
PasswordExpirationLDAPConnectionPoolHealthCheck
public PasswordExpirationLDAPConnectionPoolHealthCheck(java.io.Writer writer)
Creates a new instance of this health check that will write any password policy-related warning message to the providedWriter
. It will only write the first warning and will suppress all subsequent warnings. It will throw an exception for any password policy-related errors encountered.- Parameters:
writer
- The writer to which a warning message should be written.
-
PasswordExpirationLDAPConnectionPoolHealthCheck
public PasswordExpirationLDAPConnectionPoolHealthCheck(java.io.OutputStream outputStream, java.lang.Long millisBetweenRepeatWarnings)
Creates a new instance of this health check that will write any password policy-related warning messages to the providedOutputStream
. It may write or suppress some or all subsequent warnings. It will throw an exception for any password-policy related errors encountered.- Parameters:
outputStream
- The output stream to which warning messages should be written.millisBetweenRepeatWarnings
- The minimum length of time in milliseconds that should be allowed to elapse between repeat warning messages. A value that is less than or equal to zero indicates that all warning messages should always be written. A positive value indicates that some warning messages may be suppressed if they are encountered too soon after writing a previous warning. A value ofnull
indicates that only the first warning message should be written and all subsequent warnings should be suppressed.
-
PasswordExpirationLDAPConnectionPoolHealthCheck
public PasswordExpirationLDAPConnectionPoolHealthCheck(java.io.Writer writer, java.lang.Long millisBetweenRepeatWarnings)
Creates a new instance of this health check that will write any password policy-related warning messages to the providedOutputStream
. It may write or suppress some or all subsequent warnings. It will throw an exception for any password-policy related errors encountered.- Parameters:
writer
- The writer to which warning messages should be written.millisBetweenRepeatWarnings
- The minimum length of time in milliseconds that should be allowed to elapse between repeat warning messages. A value that is less than or equal to zero indicates that all warning messages should always be written. A positive value indicates that some warning messages may be suppressed if they are encountered too soon after writing a previous warning. A value ofnull
indicates that only the first warning message should be written and all subsequent warnings should be suppressed.
-
-
Method Detail
-
ensureConnectionValidAfterAuthentication
public void ensureConnectionValidAfterAuthentication(LDAPConnection connection, BindResult bindResult) throws LDAPException
Performs any desired processing to determine whether the provided connection is valid after processing a bind operation with the provided result.
This method will be invoked under the following circumstances:-
If you create a connection pool with a
ServerSet
and a non-null
BindRequest
, then this health check method will be invoked for every new connection created by the pool after processing thatBindRequest
on the connection. If you create a connection pool with aServerSet
but anull
BindRequest
, then no authentication will be attempted (and therefore this health check method will not be invoked for) newly-created connections. -
If you create a connection pool with an
LDAPConnection
after having performed a bind operation on that connection, then every new connection created by the pool will attempt to perform the same type of bind operation and this health check method will be invoked after that bind attempt has completed. If you create a connection pool with anLDAPConnection
that has not been authenticated, then no authentication will be attempted (and therefore this health check method will not be invoked for) newly-created connections. -
If you call a connection pool's
bindAndRevertAuthentication
method, then this health check method will be called after the second bind operation (the one used to revert authentication) has completed. In this case, this health check method will be called even if the connection pool was created with anull
BindRequest
or with an unauthenticatedLDAPConnection
. In that case, the bind operation used to revert authentication will be aSimpleBindRequest
with an empty DN and password. -
If you call a connection pool's
releaseAndReAuthenticateConnection
method, then this health check method will be called after the bind operation has completed. As withbindAndRevertAuthentication
, this health check method will be called even if the connection pool was created with anull
BindRequest
or with an unauthenticatedLDAPConnection
.
Note that this health check method may be invoked even if the bind attempt was not successful. This is useful because it allows the health check to intercept a failed authentication attempt and differentiate it from other types of failures in the course of trying to create or check out a connection. In the event that it is invoked with aBindResult
that has a result code other thanResultCode.SUCCESS
, if this method throws an exception then that exception will be propagated to the caller. If this method does not throw an exception when provided with a non-SUCCESS
result, then the connection pool itself will throw an exception using the information in the bind result.- Overrides:
ensureConnectionValidAfterAuthentication
in classLDAPConnectionPoolHealthCheck
- Parameters:
connection
- The connection to be examined.bindResult
- The bind result obtained from the authentication process.- Throws:
LDAPException
- If a problem is detected that suggests that the provided connection is not suitable for use.
-
If you create a connection pool with a
-
toString
public void toString(java.lang.StringBuilder buffer)
Appends a string representation of this LDAP connection pool health check to the provided buffer.- Overrides:
toString
in classLDAPConnectionPoolHealthCheck
- Parameters:
buffer
- The buffer to which the information should be appended.
-
-