use of org.apache.storm.messaging.netty.ISaslServer in project storm by apache.
the class ThriftNettyServerCodec method pipelineFactory.
public ChannelPipelineFactory pipelineFactory() {
return new ChannelPipelineFactory() {
public ChannelPipeline getPipeline() {
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("encoder", new ThriftEncoder());
pipeline.addLast("decoder", new ThriftDecoder());
if (authMethod == AuthMethod.DIGEST) {
try {
LOG.debug("Adding SaslStormServerHandler to pacemaker server pipeline.");
pipeline.addLast(SASL_HANDLER, new SaslStormServerHandler((ISaslServer) server));
} catch (IOException e) {
throw new RuntimeException(e);
}
} else if (authMethod == AuthMethod.KERBEROS) {
try {
LOG.debug("Adding KerberosSaslServerHandler to pacemaker server pipeline.");
ArrayList<String> authorizedUsers = new ArrayList(1);
authorizedUsers.add((String) storm_conf.get(Config.NIMBUS_DAEMON_USER));
pipeline.addLast(KERBEROS_HANDLER, new KerberosSaslServerHandler((ISaslServer) server, storm_conf, AuthUtils.LOGIN_CONTEXT_PACEMAKER_SERVER, authorizedUsers));
} catch (IOException e) {
throw new RuntimeException(e);
}
} else if (authMethod == AuthMethod.NONE) {
LOG.debug("Not authenticating any clients. AuthMethod is NONE");
}
pipeline.addLast("handler", new StormServerHandler(server));
return pipeline;
}
};
}
Aggregations