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 Details

    • addListener

      Register a listener which will be notified when this LDAPClientContext changes state.
      Parameters:
      listener - The LDAPClientContextEventListener to register.
    • disconnect

      void disconnect()
      Disconnects the client without sending a disconnect notification. Invoking this method causes LDAPClientContextEventListener.handleConnectionDisconnected(LDAPClientContext, ResultCode, String) to be called before this method returns.
    • disconnect

      void disconnect(ResultCode resultCode, String diagnosticMessage)
      Disconnects the client and sends a disconnect notification, containing the provided result code and diagnostic message. Invoking this method causes LDAPClientContextEventListener.handleConnectionDisconnected(LDAPClientContext, ResultCode, String) to be called before this method returns.
      Parameters:
      resultCode - The result code to include with the disconnect notification
      diagnosticMessage - The diagnostic message to include with the disconnect notification
    • getLocalAddress

      Returns the InetSocketAddress associated with the local system.
      Returns:
      The InetSocketAddress associated with the local system.
    • getPeerAddress

      Returns the InetSocketAddress associated with the remote system.
      Returns:
      The InetSocketAddress associated with the remote system.
    • getSecurityStrengthFactor

      Returns the cipher strength, in bits, currently in use by the underlying connection. This value is analogous to the jakarta.servlet.request.key_size property 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, or null if SSL/TLS is not enabled.
      Returns:
      The SSL session currently in use by the underlying connection, or null if SSL/TLS is not enabled.
    • getSASLServer

      Returns the SaslServer currently in use by the underlying connection, or null if SASL integrity and/or privacy protection is not enabled.
      Returns:
      The SaslServer currently in use by the underlying connection, or null if SASL integrity and/or privacy protection is not enabled.
    • isClosed

      boolean isClosed()
      Returns true if the underlying connection has been closed as a result of a client disconnect, a fatal connection error, or a server-side disconnect().

      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 true when called from within handleConnectionClosed, handleConnectionDisconnected, or handleConnectionError.

      Returns:
      true if the underlying connection has been closed.
    • sendUnsolicitedNotification

      com.forgerock.reactive.Completable sendUnsolicitedNotification(ExtendedResult notification)
      Sends an unsolicited notification to the client.
      Parameters:
      notification - The notification to send.
      Returns:
      A Completable which will be completed once the notification has been sent.
    • enableTLS

      boolean enableTLS(SSLEngine sslEngine, boolean startTls)
      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 - The SSLEngine which should be used to secure the connection.
      startTls - Must be true if the TLS filter has to be installed as a consequence of a StartTLS request performed by a client. When true the TLS filter will be installed atomically after the first message sent to prevent race-condition.
      Returns:
      true if the TLS filter has been enabled, false if it was already enabled.
      Throws:
      NullPointerException - if sslEngine is null
    • enableSASL

      boolean enableSASL(SaslServer saslServer)
      Installs the SASL security layer on the underlying connection.
      Parameters:
      saslServer - The SaslServer which should be used to secure the connection.
      Returns:
      true if the SASL filter has been enabled, false if it was already enabled.
      Throws:
      NullPointerException - if saslServer is null