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
ConstructorsModifierConstructorDescriptionprotectedCachingUsernamePasswordRealm(org.elasticsearch.xpack.core.security.authc.RealmConfig config, org.elasticsearch.threadpool.ThreadPool threadPool) -
Method Summary
Modifier and TypeMethodDescriptionfinal voidauthenticate(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 voiddoAuthenticate(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 voiddoLookupUser(String username, org.elasticsearch.action.ActionListener<org.elasticsearch.xpack.core.security.user.User> listener) final voidfinal voidprotected intprotected voidhandleCachedAuthentication(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) handleCachedAuthenticationis called when aUseris retrieved from the cache.final voidlookupUser(String username, org.elasticsearch.action.ActionListener<org.elasticsearch.xpack.core.security.user.User> listener) booleansupports(org.elasticsearch.xpack.core.security.authc.AuthenticationToken token) org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordTokentoken(org.elasticsearch.common.util.concurrent.ThreadContext threadContext) voidusageStats(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, typeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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
- Specified by:
expirein interfaceorg.elasticsearch.xpack.core.security.authc.support.CachingRealm
-
expireAll
public final void expireAll()- Specified by:
expireAllin interfaceorg.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 withAuthenticationResult.notHandled()ifauthentication is not enabled.- Specified by:
authenticatein classorg.elasticsearch.xpack.core.security.authc.Realm- Parameters:
authToken- The authentication tokenlistener- 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) handleCachedAuthenticationis called when aUseris retrieved from the cache. The firstuserparameter is the user object that was found in the cache. The default implementation returns asuccess resultwith the provided user, but sub-classes can return a differentUserobject, or an unsuccessful result. -
usageStats
- Overrides:
usageStatsin classorg.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:
lookupUserin classorg.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)
-