Package org.forgerock.opendj.ldap
Interface LDAPClientContext
public interface LDAPClientContext
An LDAP client which has connected to a
ServerConnectionFactory. An
LDAP client context can be used to query information about the client's
connection such as their network address, as well as managing the state of
the connection.-
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(LDAPClientContextEventListener listener) Register a listener which will be notified when thisLDAPClientContextchanges state.voidDisconnects the client without sending a disconnect notification.voiddisconnect(ResultCode resultCode, String diagnosticMessage) Disconnects the client and sends a disconnect notification, containing the provided result code and diagnostic message.booleanenableSASL(SaslServer saslServer) Installs the SASL security layer on the underlying connection.booleanInstalls the TLS/SSL security layer on the underlying connection.Returns theInetSocketAddressassociated with the local system.Returns theInetSocketAddressassociated with the remote system.Returns theSaslServercurrently in use by the underlying connection, ornullif SASL integrity and/or privacy protection is not enabled.intReturns the cipher strength, in bits, currently in use by the underlying connection.Returns the SSL session currently in use by the underlying connection, ornullif SSL/TLS is not enabled.booleanisClosed()Returnstrueif the underlying connection has been closed as a result of a client disconnect, a fatal connection error, or a server-sidedisconnect().com.forgerock.reactive.CompletablesendUnsolicitedNotification(ExtendedResult notification) Sends an unsolicited notification to the client.
-
Method Details
-
addListener
Register a listener which will be notified when thisLDAPClientContextchanges state.- Parameters:
listener- TheLDAPClientContextEventListenerto register.
-
disconnect
void disconnect()Disconnects the client without sending a disconnect notification. Invoking this method causesLDAPClientContextEventListener.handleConnectionDisconnected(LDAPClientContext, ResultCode, String)to be called before this method returns. -
disconnect
Disconnects the client and sends a disconnect notification, containing the provided result code and diagnostic message. Invoking this method causesLDAPClientContextEventListener.handleConnectionDisconnected(LDAPClientContext, ResultCode, String)to be called before this method returns.- Parameters:
resultCode- The result code to include with the disconnect notificationdiagnosticMessage- The diagnostic message to include with the disconnect notification
-
getLocalAddress
Returns theInetSocketAddressassociated with the local system.- Returns:
- The
InetSocketAddressassociated with the local system.
-
getPeerAddress
Returns theInetSocketAddressassociated with the remote system.- Returns:
- The
InetSocketAddressassociated with the remote system.
-
getSecurityStrengthFactor
Returns the cipher strength, in bits, currently in use by the underlying connection. This value is analogous to thejakarta.servlet.request.key_sizeproperty defined in the Servlet specification (section 3.8 "SSL Attributes"). It provides no indication of the relative strength of different cipher algorithms, their known weaknesses, nor the strength of other cryptographic information used during SSL/TLS negotiation.- Returns:
- The cipher strength, in bits, currently in use by the underlying connection.
-
getSSLSession
Returns the SSL session currently in use by the underlying connection, ornullif SSL/TLS is not enabled.- Returns:
- The SSL session currently in use by the underlying connection, or
nullif SSL/TLS is not enabled.
-
getSASLServer
Returns theSaslServercurrently in use by the underlying connection, ornullif SASL integrity and/or privacy protection is not enabled.- Returns:
- The
SaslServercurrently in use by the underlying connection, ornullif SASL integrity and/or privacy protection is not enabled.
-
isClosed
boolean isClosed()Returnstrueif the underlying connection has been closed as a result of a client disconnect, a fatal connection error, or a server-sidedisconnect().This method provides a polling mechanism which can be used by synchronous request handler implementations to detect connection termination.
Server connections: this method will always return
truewhen called from withinhandleConnectionClosed,handleConnectionDisconnected, orhandleConnectionError.- Returns:
trueif the underlying connection has been closed.
-
sendUnsolicitedNotification
Sends an unsolicited notification to the client.- Parameters:
notification- The notification to send.- Returns:
- A
Completablewhich will be completed once the notification has been sent.
-
enableTLS
Installs the TLS/SSL security layer on the underlying connection. The TLS/SSL security layer will be installed beneath any existing connection security layers and can only be installed at most once.- Parameters:
sslEngine- TheSSLEnginewhich should be used to secure the connection.startTls- Must betrueif the TLS filter has to be installed as a consequence of a StartTLS request performed by a client. Whentruethe TLS filter will be installed atomically after the first message sent to prevent race-condition.- Returns:
trueif the TLS filter has been enabled,falseif it was already enabled.- Throws:
NullPointerException- if sslEngine is null
-
enableSASL
Installs the SASL security layer on the underlying connection.- Parameters:
saslServer- TheSaslServerwhich should be used to secure the connection.- Returns:
trueif the SASL filter has been enabled,falseif it was already enabled.- Throws:
NullPointerException- if saslServer is null
-