org.apache.geode.security.templates

## Class LdapUserAuthenticator

- java.lang.Object
- - org.apache.geode.security.templates.LdapUserAuthenticator

- All Implemented Interfaces:
    CacheCallback, Declarable, Authenticator

      public class LdapUserAuthenticator
      extends java.lang.Object
      implements Authenticator

  An implementation of `Authenticator` that uses LDAP.
  Since:
    GemFire 5.5

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `LDAP_BASEDN_NAME`
    `static java.lang.String` | `LDAP_SERVER_NAME`
    `static java.lang.String` | `LDAP_SSL_NAME`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LdapUserAuthenticator()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.security.Principal` | `authenticate(java.util.Properties credentials, DistributedMember member)` Verify the credentials provided in the properties for the client/peer as specified in member ID and returns the principal associated with the client/peer.
    `void` | `close()` Called when the region containing this callback is closed or destroyed, when the cache is closed, or when a callback is removed from a region using an `AttributesMutator`.
    `static Authenticator` | `create()`
    `void` | `init(java.util.Properties securityProps, LogWriter systemLogWriter, LogWriter securityLogWriter)` Initialize the callback for a client/peer.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.geode.security.Authenticator

      `authenticate, init`

    - ### Methods inherited from interface org.apache.geode.cache.Declarable

      `initialize`

- - ### Field Detail

    - #### LDAP_SERVER_NAME

          public static final java.lang.String LDAP_SERVER_NAME

      See Also:
        Constant Field Values

    - #### LDAP_BASEDN_NAME

          public static final java.lang.String LDAP_BASEDN_NAME

      See Also:
        Constant Field Values

    - #### LDAP_SSL_NAME

          public static final java.lang.String LDAP_SSL_NAME

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### LdapUserAuthenticator

          public LdapUserAuthenticator()

  - ### Method Detail

    - #### create

          public static Authenticator create()

    - #### init

          public void init(java.util.Properties securityProps,
                           LogWriter systemLogWriter,
                           LogWriter securityLogWriter)
                    throws AuthenticationFailedException

      Description copied from interface: `Authenticator`
      Initialize the callback for a client/peer. This is invoked when a new connection from a client/peer is created with the host.
      Specified by:
        `init` in interface `Authenticator`
      Parameters:
        `securityProps` - the security properties obtained using a call to `DistributedSystem.getSecurityProperties()`
        `systemLogWriter` - `LogWriter` for system logs
        `securityLogWriter` - `LogWriter` for security logs
      Throws:
        `AuthenticationFailedException` - if some exception occurs during the initialization

    - #### authenticate

          public java.security.Principal authenticate(java.util.Properties credentials,
                                                      DistributedMember member)

      Description copied from interface: `Authenticator`
      Verify the credentials provided in the properties for the client/peer as specified in member ID and returns the principal associated with the client/peer.
      Specified by:
        `authenticate` in interface `Authenticator`
      Parameters:
        `credentials` - the credentials of the client/peer as a set of property key/values
        `member` - the `DistributedMember` object of the connecting client/peer member. NULL when invoked locally on the member initiating the authentication request.
      Returns:
        the principal for the client/peer when authentication succeeded

    - #### close

          public void close()

      Description copied from interface: `CacheCallback`
      Called when the region containing this callback is closed or destroyed, when the cache is closed, or when a callback is removed from a region using an `AttributesMutator`.

      Implementations should cleanup any external resources such as database connections. Any runtime exceptions this method throws will be logged.

      It is possible for this method to be called multiple times on a single callback instance, so implementations must be tolerant of this.

      Specified by:
        `close` in interface `CacheCallback`
      See Also:
        `RegionService.close()`, `Region.close()`, `Region.localDestroyRegion()`, `Region.destroyRegion()`, `AttributesMutator`