Class SecuritySearchOperationListener
java.lang.Object
org.elasticsearch.xpack.security.authz.SecuritySearchOperationListener
- All Implemented Interfaces:
org.elasticsearch.index.shard.SearchOperationListener
public final class SecuritySearchOperationListener
extends Object
implements org.elasticsearch.index.shard.SearchOperationListener
A
SearchOperationListener that is used to provide authorization for scroll requests.
In order to identify the user associated with a scroll request, we replace the ReaderContext
on creation with a custom implementation that holds the Authentication object. When
this context is accessed again in SearchOperationListener.onPreQueryPhase(SearchContext)
the ScrollContext is inspected for the authentication, which is compared to the currently
authentication.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.index.shard.SearchOperationListener
org.elasticsearch.index.shard.SearchOperationListener.CompositeListener -
Constructor Summary
ConstructorsConstructorDescriptionSecuritySearchOperationListener(org.elasticsearch.xpack.core.security.SecurityContext securityContext, AuditTrailService auditTrail) -
Method Summary
Modifier and TypeMethodDescriptionvoidonNewScrollContext(org.elasticsearch.search.internal.ReaderContext readerContext) Adds theAuthenticationto theScrollContextvoidonPreFetchPhase(org.elasticsearch.search.internal.SearchContext searchContext) voidonPreQueryPhase(org.elasticsearch.search.internal.SearchContext searchContext) voidvalidateReaderContext(org.elasticsearch.search.internal.ReaderContext readerContext, org.elasticsearch.transport.TransportRequest request) Checks for theReaderContextif it exists and compares theAuthenticationobject from the scroll context with the current authentication contextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.index.shard.SearchOperationListener
onFailedFetchPhase, onFailedQueryPhase, onFetchPhase, onFreeReaderContext, onFreeScrollContext, onNewReaderContext, onQueryPhase
-
Constructor Details
-
SecuritySearchOperationListener
public SecuritySearchOperationListener(org.elasticsearch.xpack.core.security.SecurityContext securityContext, AuditTrailService auditTrail)
-
-
Method Details
-
onNewScrollContext
public void onNewScrollContext(org.elasticsearch.search.internal.ReaderContext readerContext) Adds theAuthenticationto theScrollContext- Specified by:
onNewScrollContextin interfaceorg.elasticsearch.index.shard.SearchOperationListener
-
validateReaderContext
public void validateReaderContext(org.elasticsearch.search.internal.ReaderContext readerContext, org.elasticsearch.transport.TransportRequest request) Checks for theReaderContextif it exists and compares theAuthenticationobject from the scroll context with the current authentication context- Specified by:
validateReaderContextin interfaceorg.elasticsearch.index.shard.SearchOperationListener
-
onPreFetchPhase
public void onPreFetchPhase(org.elasticsearch.search.internal.SearchContext searchContext) - Specified by:
onPreFetchPhasein interfaceorg.elasticsearch.index.shard.SearchOperationListener
-
onPreQueryPhase
public void onPreQueryPhase(org.elasticsearch.search.internal.SearchContext searchContext) - Specified by:
onPreQueryPhasein interfaceorg.elasticsearch.index.shard.SearchOperationListener
-