Skip to content

Commit 87f0598

Browse files
committed
Cleanup construction of interceptors
It would be beneficial to apply some of the request interceptors even when features are disabled. This change reworks the way we build that list so that the interceptors we always want to use are constructed outside of the settings check. Backport of: elastic#38294
1 parent 3e2da3c commit 87f0598

File tree

1 file changed

+9
-9
lines changed
  • x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security

1 file changed

+9
-9
lines changed

x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/Security.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -513,17 +513,17 @@ Collection<Object> createComponents(Client client, ThreadPool threadPool, Cluste
513513
securityInterceptor.set(new SecurityServerTransportInterceptor(settings, threadPool, authcService.get(),
514514
authzService, getLicenseState(), getSslService(), securityContext.get(), destructiveOperations, clusterService));
515515

516-
final Set<RequestInterceptor> requestInterceptors;
516+
Set<RequestInterceptor> requestInterceptors = Sets.newHashSet(
517+
new ResizeRequestInterceptor(threadPool, getLicenseState(), auditTrailService),
518+
new IndicesAliasesRequestInterceptor(threadPool.getThreadContext(), getLicenseState(), auditTrailService));
517519
if (XPackSettings.DLS_FLS_ENABLED.get(settings)) {
518-
requestInterceptors = Collections.unmodifiableSet(Sets.newHashSet(
519-
new SearchRequestInterceptor(threadPool, getLicenseState()),
520-
new UpdateRequestInterceptor(threadPool, getLicenseState()),
521-
new BulkShardRequestInterceptor(threadPool, getLicenseState()),
522-
new ResizeRequestInterceptor(threadPool, getLicenseState(), auditTrailService),
523-
new IndicesAliasesRequestInterceptor(threadPool.getThreadContext(), getLicenseState(), auditTrailService)));
524-
} else {
525-
requestInterceptors = Collections.emptySet();
520+
requestInterceptors.addAll(Arrays.asList(
521+
new SearchRequestInterceptor(threadPool, getLicenseState()),
522+
new UpdateRequestInterceptor(threadPool, getLicenseState()),
523+
new BulkShardRequestInterceptor(threadPool, getLicenseState())
524+
));
526525
}
526+
requestInterceptors = Collections.unmodifiableSet(requestInterceptors);
527527

528528
securityActionFilter.set(new SecurityActionFilter(authcService.get(), authzService, getLicenseState(),
529529
requestInterceptors, threadPool, securityContext.get(), destructiveOperations));

0 commit comments

Comments
 (0)