java.lang.Object
org.elasticsearch.xpack.core.security.authc.Realm
org.elasticsearch.xpack.security.authc.support.CachingUsernamePasswordRealm
org.elasticsearch.xpack.security.authc.ldap.LdapRealm
All Implemented Interfaces:
Comparable<org.elasticsearch.xpack.core.security.authc.Realm>, org.elasticsearch.xpack.core.security.authc.support.CachingRealm

public final class LdapRealm extends CachingUsernamePasswordRealm
Authenticates username/password tokens against ldap, locates groups and maps them to roles.
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.elasticsearch.xpack.core.security.authc.Realm

    org.elasticsearch.xpack.core.security.authc.Realm.Factory
  • Field Summary

    Fields inherited from class org.elasticsearch.xpack.core.security.authc.Realm

    config, logger
  • Constructor Summary

    Constructors
    Constructor
    Description
    LdapRealm(org.elasticsearch.xpack.core.security.authc.RealmConfig config, org.elasticsearch.xpack.core.ssl.SSLService sslService, org.elasticsearch.watcher.ResourceWatcherService watcherService, NativeRoleMappingStore nativeRoleMappingStore, org.elasticsearch.threadpool.ThreadPool threadPool)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    doAuthenticate(org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken token, org.elasticsearch.action.ActionListener<org.elasticsearch.xpack.core.security.authc.AuthenticationResult<org.elasticsearch.xpack.core.security.user.User>> listener)
    Given a username and password, open a connection to ldap, bind to authenticate, retrieve groups, map to roles and build the user.
    protected void
    doLookupUser(String username, org.elasticsearch.action.ActionListener<org.elasticsearch.xpack.core.security.user.User> userActionListener)
     
    protected void
    handleCachedAuthentication(org.elasticsearch.xpack.core.security.user.User user, org.elasticsearch.action.ActionListener<org.elasticsearch.xpack.core.security.authc.AuthenticationResult<org.elasticsearch.xpack.core.security.user.User>> listener)
    handleCachedAuthentication is called when a User is retrieved from the cache.
    void
    initialize(Iterable<org.elasticsearch.xpack.core.security.authc.Realm> realms, org.elasticsearch.license.XPackLicenseState licenseState)
     
    void
    usageStats(org.elasticsearch.action.ActionListener<Map<String,Object>> listener)
     

    Methods inherited from class org.elasticsearch.xpack.security.authc.support.CachingUsernamePasswordRealm

    authenticate, expire, expireAll, getCacheSize, lookupUser, supports, token

    Methods inherited from class org.elasticsearch.xpack.core.security.authc.Realm

    compareTo, domain, getAuthenticationFailureHeaders, name, order, toString, type

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface org.elasticsearch.xpack.core.security.authc.support.CachingRealm

    name
  • Constructor Details

    • LdapRealm

      public LdapRealm(org.elasticsearch.xpack.core.security.authc.RealmConfig config, org.elasticsearch.xpack.core.ssl.SSLService sslService, org.elasticsearch.watcher.ResourceWatcherService watcherService, NativeRoleMappingStore nativeRoleMappingStore, org.elasticsearch.threadpool.ThreadPool threadPool) throws com.unboundid.ldap.sdk.LDAPException
      Throws:
      com.unboundid.ldap.sdk.LDAPException
  • Method Details

    • doAuthenticate

      protected void doAuthenticate(org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken token, org.elasticsearch.action.ActionListener<org.elasticsearch.xpack.core.security.authc.AuthenticationResult<org.elasticsearch.xpack.core.security.user.User>> listener)
      Given a username and password, open a connection to ldap, bind to authenticate, retrieve groups, map to roles and build the user. This user will then be passed to the listener
      Specified by:
      doAuthenticate in class CachingUsernamePasswordRealm
    • doLookupUser

      protected void doLookupUser(String username, org.elasticsearch.action.ActionListener<org.elasticsearch.xpack.core.security.user.User> userActionListener)
      Specified by:
      doLookupUser in class CachingUsernamePasswordRealm
    • initialize

      public void initialize(Iterable<org.elasticsearch.xpack.core.security.authc.Realm> realms, org.elasticsearch.license.XPackLicenseState licenseState)
      Overrides:
      initialize in class org.elasticsearch.xpack.core.security.authc.Realm
    • usageStats

      public void usageStats(org.elasticsearch.action.ActionListener<Map<String,Object>> listener)
      Overrides:
      usageStats in class CachingUsernamePasswordRealm
    • handleCachedAuthentication

      protected void handleCachedAuthentication(org.elasticsearch.xpack.core.security.user.User user, org.elasticsearch.action.ActionListener<org.elasticsearch.xpack.core.security.authc.AuthenticationResult<org.elasticsearch.xpack.core.security.user.User>> listener)
      Description copied from class: CachingUsernamePasswordRealm
      handleCachedAuthentication is called when a User is retrieved from the cache. The first user parameter is the user object that was found in the cache. The default implementation returns a success result with the provided user, but sub-classes can return a different User object, or an unsuccessful result.
      Overrides:
      handleCachedAuthentication in class CachingUsernamePasswordRealm