Followup for elastic/elasticsearchelastic/elasticsearch#22618 (elastic/elasticsearch#4625)
Original commit: elastic/x-pack-elasticsearch@366253f46f
This commit is contained in:
parent
1ee5ac8a89
commit
507e8d5461
|
@ -459,8 +459,8 @@ public class XPackPlugin extends Plugin implements ScriptPlugin, ActionPlugin, I
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TransportInterceptor> getTransportInterceptors(NamedWriteableRegistry namedWriteableRegistry) {
|
public List<TransportInterceptor> getTransportInterceptors(NamedWriteableRegistry namedWriteableRegistry, ThreadContext threadContext) {
|
||||||
return security.getTransportInterceptors(namedWriteableRegistry);
|
return security.getTransportInterceptors(namedWriteableRegistry, threadContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -166,7 +166,7 @@ public class Security implements ActionPlugin, IngestPlugin, NetworkPlugin {
|
||||||
/* what a PITA that we need an extra indirection to initialize this. Yet, once we got rid of guice we can thing about how
|
/* what a PITA that we need an extra indirection to initialize this. Yet, once we got rid of guice we can thing about how
|
||||||
* to fix this or make it simpler. Today we need several service that are created in createComponents but we need to register
|
* to fix this or make it simpler. Today we need several service that are created in createComponents but we need to register
|
||||||
* an instance of TransportInterceptor way earlier before createComponents is called. */
|
* an instance of TransportInterceptor way earlier before createComponents is called. */
|
||||||
private final SetOnce<TransportInterceptor> securityIntercepter = new SetOnce<>();
|
private final SetOnce<TransportInterceptor> securityInterceptor = new SetOnce<>();
|
||||||
private final SetOnce<IPFilter> ipFilter = new SetOnce<>();
|
private final SetOnce<IPFilter> ipFilter = new SetOnce<>();
|
||||||
private final SetOnce<AuthenticationService> authcService = new SetOnce<>();
|
private final SetOnce<AuthenticationService> authcService = new SetOnce<>();
|
||||||
|
|
||||||
|
@ -334,7 +334,7 @@ public class Security implements ActionPlugin, IngestPlugin, NetworkPlugin {
|
||||||
ipFilter.set(new IPFilter(settings, auditTrailService, clusterService.getClusterSettings(), licenseState));
|
ipFilter.set(new IPFilter(settings, auditTrailService, clusterService.getClusterSettings(), licenseState));
|
||||||
components.add(ipFilter.get());
|
components.add(ipFilter.get());
|
||||||
DestructiveOperations destructiveOperations = new DestructiveOperations(settings, clusterService.getClusterSettings());
|
DestructiveOperations destructiveOperations = new DestructiveOperations(settings, clusterService.getClusterSettings());
|
||||||
securityIntercepter.set(new SecurityServerTransportInterceptor(settings, threadPool, authcService.get(), authzService, licenseState,
|
securityInterceptor.set(new SecurityServerTransportInterceptor(settings, threadPool, authcService.get(), authzService, licenseState,
|
||||||
sslService, securityContext, destructiveOperations));
|
sslService, securityContext, destructiveOperations));
|
||||||
return components;
|
return components;
|
||||||
}
|
}
|
||||||
|
@ -686,7 +686,7 @@ public class Security implements ActionPlugin, IngestPlugin, NetworkPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TransportInterceptor> getTransportInterceptors(NamedWriteableRegistry namedWriteableRegistry) {
|
public List<TransportInterceptor> getTransportInterceptors(NamedWriteableRegistry namedWriteableRegistry, ThreadContext threadContext) {
|
||||||
if (transportClientMode || enabled == false) { // don't register anything if we are not enabled
|
if (transportClientMode || enabled == false) { // don't register anything if we are not enabled
|
||||||
// interceptors are not installed if we are running on the transport client
|
// interceptors are not installed if we are running on the transport client
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
@ -695,14 +695,14 @@ public class Security implements ActionPlugin, IngestPlugin, NetworkPlugin {
|
||||||
@Override
|
@Override
|
||||||
public <T extends TransportRequest> TransportRequestHandler<T> interceptHandler(String action, String executor,
|
public <T extends TransportRequest> TransportRequestHandler<T> interceptHandler(String action, String executor,
|
||||||
TransportRequestHandler<T> actualHandler) {
|
TransportRequestHandler<T> actualHandler) {
|
||||||
assert securityIntercepter.get() != null;
|
assert securityInterceptor.get() != null;
|
||||||
return securityIntercepter.get().interceptHandler(action, executor, actualHandler);
|
return securityInterceptor.get().interceptHandler(action, executor, actualHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AsyncSender interceptSender(AsyncSender sender) {
|
public AsyncSender interceptSender(AsyncSender sender) {
|
||||||
assert securityIntercepter.get() != null;
|
assert securityInterceptor.get() != null;
|
||||||
return securityIntercepter.get().interceptSender(sender);
|
return securityInterceptor.get().interceptSender(sender);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue