Search in sources :

Example 1 with SaslStormServerHandler

use of org.apache.storm.messaging.netty.SaslStormServerHandler 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;
        }
    };
}
Also used : ISaslServer(org.apache.storm.messaging.netty.ISaslServer) KerberosSaslServerHandler(org.apache.storm.messaging.netty.KerberosSaslServerHandler) ArrayList(java.util.ArrayList) IOException(java.io.IOException) SaslStormServerHandler(org.apache.storm.messaging.netty.SaslStormServerHandler) StormServerHandler(org.apache.storm.messaging.netty.StormServerHandler) ChannelPipelineFactory(org.jboss.netty.channel.ChannelPipelineFactory) ChannelPipeline(org.jboss.netty.channel.ChannelPipeline) SaslStormServerHandler(org.apache.storm.messaging.netty.SaslStormServerHandler)

Aggregations

IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 ISaslServer (org.apache.storm.messaging.netty.ISaslServer)1 KerberosSaslServerHandler (org.apache.storm.messaging.netty.KerberosSaslServerHandler)1 SaslStormServerHandler (org.apache.storm.messaging.netty.SaslStormServerHandler)1 StormServerHandler (org.apache.storm.messaging.netty.StormServerHandler)1 ChannelPipeline (org.jboss.netty.channel.ChannelPipeline)1 ChannelPipelineFactory (org.jboss.netty.channel.ChannelPipelineFactory)1