Add override of handler registration method to wrap handler

Original commit: elastic/x-pack-elasticsearch@4dcfb637c2
This commit is contained in:
Jason Tedor 2015-08-30 17:49:56 -04:00
parent 8cc9531bcb
commit c09c5611b8
1 changed files with 7 additions and 0 deletions

View File

@ -20,6 +20,7 @@ import org.elasticsearch.transport.netty.NettyTransport;
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.Callable;
import static org.elasticsearch.shield.transport.netty.ShieldNettyTransport.*;
@ -67,6 +68,12 @@ public class ShieldServerTransportService extends TransportService {
super.registerRequestHandler(action, request, executor, forceExecution, wrappedHandler);
}
@Override
public <Request extends TransportRequest> void registerRequestHandler(String action, Callable<Request> requestFactory, String executor, TransportRequestHandler<Request> handler) {
TransportRequestHandler<Request> wrappedHandler = new ProfileSecuredRequestHandler<>(action, handler, profileFilters);
super.registerRequestHandler(action, requestFactory, executor, wrappedHandler);
}
protected Map<String, ServerTransportFilter> initializeProfileFilters() {
if (!(transport instanceof ShieldNettyTransport)) {
return Collections.<String, ServerTransportFilter>singletonMap(NettyTransport.DEFAULT_PROFILE, new ServerTransportFilter.NodeProfile(authcService, authzService, actionMapper, false));