Class CachingUsernamePasswordRealm

java.lang.Object
org.elasticsearch.xpack.core.security.authc.Realm
org.elasticsearch.xpack.security.authc.support.CachingUsernamePasswordRealm
All Implemented Interfaces:
Comparable<org.elasticsearch.xpack.core.security.authc.Realm>, org.elasticsearch.xpack.core.security.authc.support.CachingRealm
Direct Known Subclasses:
FileRealm, LdapRealm, NativeRealm, ReservedRealm

public abstract class CachingUsernamePasswordRealm extends org.elasticsearch.xpack.core.security.authc.Realm implements org.elasticsearch.xpack.core.security.authc.support.CachingRealm
  • 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
    Modifier
    Constructor
    Description
    protected
    CachingUsernamePasswordRealm(org.elasticsearch.xpack.core.security.authc.RealmConfig config, org.elasticsearch.threadpool.ThreadPool threadPool)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    authenticate(org.elasticsearch.xpack.core.security.authc.AuthenticationToken authToken, org.elasticsearch.action.ActionListener<org.elasticsearch.xpack.core.security.authc.AuthenticationResult<org.elasticsearch.xpack.core.security.user.User>> listener)
    If the user exists in the cache (keyed by the principle name), then the password is validated against a hash also stored in the cache.
    protected abstract 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)
     
    protected abstract void
    doLookupUser(String username, org.elasticsearch.action.ActionListener<org.elasticsearch.xpack.core.security.user.User> listener)
     
    final void
    expire(String username)
     
    final void
     
    protected int
     
    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.
    final void
    lookupUser(String username, org.elasticsearch.action.ActionListener<org.elasticsearch.xpack.core.security.user.User> listener)
     
    boolean
    supports(org.elasticsearch.xpack.core.security.authc.AuthenticationToken token)
     
    org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken
    token(org.elasticsearch.common.util.concurrent.ThreadContext threadContext)
     
    void
    usageStats(org.elasticsearch.action.ActionListener<Map<String,Object>> listener)
     

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

    compareTo, domain, getAuthenticationFailureHeaders, initialize, 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

    • CachingUsernamePasswordRealm

      protected CachingUsernamePasswordRealm(org.elasticsearch.xpack.core.security.authc.RealmConfig config, org.elasticsearch.threadpool.ThreadPool threadPool)
  • Method Details

    • expire

      public final void expire(String username)
      Specified by:
      expire in interface org.elasticsearch.xpack.core.security.authc.support.CachingRealm
    • expireAll

      public final void expireAll()
      Specified by:
      expireAll in interface org.elasticsearch.xpack.core.security.authc.support.CachingRealm
    • token

      public org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken token(org.elasticsearch.common.util.concurrent.ThreadContext threadContext)
    • supports

      public boolean supports(org.elasticsearch.xpack.core.security.authc.AuthenticationToken token)
    • authenticate

      public final void authenticate(org.elasticsearch.xpack.core.security.authc.AuthenticationToken authToken, org.elasticsearch.action.ActionListener<org.elasticsearch.xpack.core.security.authc.AuthenticationResult<org.elasticsearch.xpack.core.security.user.User>> listener)
      If the user exists in the cache (keyed by the principle name), then the password is validated against a hash also stored in the cache. Otherwise the subclass authenticates the user via doAuthenticate. This method will respond with AuthenticationResult.notHandled() if authentication is not enabled.
      Specified by:
      authenticate in class org.elasticsearch.xpack.core.security.authc.Realm
      Parameters:
      authToken - The authentication token
      listener - to be called at completion
    • 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)
      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.
    • usageStats

      public void usageStats(org.elasticsearch.action.ActionListener<Map<String,Object>> listener)
      Overrides:
      usageStats in class org.elasticsearch.xpack.core.security.authc.Realm
    • getCacheSize

      protected int getCacheSize()
    • doAuthenticate

      protected abstract 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)
    • lookupUser

      public final void lookupUser(String username, org.elasticsearch.action.ActionListener<org.elasticsearch.xpack.core.security.user.User> listener)
      Specified by:
      lookupUser in class org.elasticsearch.xpack.core.security.authc.Realm
    • doLookupUser

      protected abstract void doLookupUser(String username, org.elasticsearch.action.ActionListener<org.elasticsearch.xpack.core.security.user.User> listener)