Skip to content

Commit

Permalink
Cleanup construction of interceptors (#38388)
Browse files Browse the repository at this point in the history
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: #38294
  • Loading branch information
tvernum committed Feb 5, 2019
1 parent d0aaf14 commit 2937151
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -509,17 +509,17 @@ Collection<Object> createComponents(Client client, ThreadPool threadPool, Cluste
securityInterceptor.set(new SecurityServerTransportInterceptor(settings, threadPool, authcService.get(),
authzService, getLicenseState(), getSslService(), securityContext.get(), destructiveOperations, clusterService));

final Set<RequestInterceptor> requestInterceptors;
Set<RequestInterceptor> requestInterceptors = Sets.newHashSet(
new ResizeRequestInterceptor(threadPool, getLicenseState(), auditTrailService),
new IndicesAliasesRequestInterceptor(threadPool.getThreadContext(), getLicenseState(), auditTrailService));
if (XPackSettings.DLS_FLS_ENABLED.get(settings)) {
requestInterceptors = Collections.unmodifiableSet(Sets.newHashSet(
new SearchRequestInterceptor(threadPool, getLicenseState()),
new UpdateRequestInterceptor(threadPool, getLicenseState()),
new BulkShardRequestInterceptor(threadPool, getLicenseState()),
new ResizeRequestInterceptor(threadPool, getLicenseState(), auditTrailService),
new IndicesAliasesRequestInterceptor(threadPool.getThreadContext(), getLicenseState(), auditTrailService)));
} else {
requestInterceptors = Collections.emptySet();
requestInterceptors.addAll(Arrays.asList(
new SearchRequestInterceptor(threadPool, getLicenseState()),
new UpdateRequestInterceptor(threadPool, getLicenseState()),
new BulkShardRequestInterceptor(threadPool, getLicenseState())
));
}
requestInterceptors = Collections.unmodifiableSet(requestInterceptors);

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

0 comments on commit 2937151

Please sign in to comment.