public AmqpAuthenticator(AmqpTransport transport, Sasl sasl, BrokerService brokerService) { this.brokerService = brokerService; this.transport = transport; this.sasl = sasl; sasl.setMechanisms(mechanisms); sasl.server(); }
public AmqpAuthenticator(AmqpTransport transport, Sasl sasl, BrokerService brokerService) { this.brokerService = brokerService; this.transport = transport; this.sasl = sasl; sasl.setMechanisms(mechanisms); sasl.server(); }
@Override public void createServerSASL(ServerSASL[] handlers) { this.serverSasl = transport.sasl(); saslHandlers = new HashMap<>(); String[] names = new String[handlers.length]; int count = 0; for (ServerSASL handler : handlers) { saslHandlers.put(handler.getName(), handler); names[count++] = handler.getName(); } this.serverSasl.server(); serverSasl.setMechanisms(names); }
public void createServerSASL(String[] mechanisms) { Sasl sasl = transport.sasl(); sasl.server(); sasl.setMechanisms(mechanisms); sasl.setListener(this); }
@Override public void init(NetSocket socket, ProtonConnection protonConnection, Transport transport) { this.sasl = transport.sasl(); sasl.server(); sasl.allowSkip(false); sasl.setMechanisms(ProtonSaslAnonymousImpl.MECH_NAME); succeeded = false; }
@Override public void init(final NetSocket socket, final ProtonConnection protonConnection, final Transport transport) { LOG.debug("initializing SASL authenticator"); this.protonConnection = protonConnection; this.sasl = transport.sasl(); sasl.server(); sasl.allowSkip(false); sasl.setMechanisms(AuthenticationConstants.MECHANISM_PLAIN, AuthenticationConstants.MECHANISM_EXTERNAL); if (socket.isSsl()) { LOG.trace("Client connected through a secured port"); try { peerCertificateChain = socket.sslSession().getPeerCertificates(); } catch (SSLPeerUnverifiedException e) { LOG.debug("Device's Identity cannot be verified: " + e.getMessage()); } } }
@Override public void init(final NetSocket socket, final ProtonConnection protonConnection, final Transport transport) { LOG.debug("initializing SASL authenticator"); this.protonConnection = protonConnection; this.sasl = transport.sasl(); // TODO determine supported mechanisms dynamically based on registered AuthenticationService implementations sasl.server(); sasl.allowSkip(false); sasl.setMechanisms(MECHANISM_EXTERNAL, MECHANISM_PLAIN); if (socket.isSsl()) { LOG.debug("client connected using TLS, extracting client certificate chain"); try { peerCertificateChain = socket.peerCertificateChain(); LOG.debug("found valid client certificate DN [{}]", peerCertificateChain[0].getSubjectDN()); } catch (SSLPeerUnverifiedException e) { LOG.debug("could not extract client certificate chain, maybe TLS based client auth is not required"); } } }
@Override public void init(final NetSocket socket, final ProtonConnection protonConnection, final Transport transport) { LOG.debug("initializing SASL authenticator"); this.protonConnection = protonConnection; this.sasl = transport.sasl(); // TODO determine supported mechanisms dynamically based on registered AuthenticationService implementations sasl.server(); sasl.allowSkip(false); sasl.setMechanisms(MECHANISM_EXTERNAL, MECHANISM_PLAIN); if (socket.isSsl()) { LOG.debug("client connected using TLS, extracting client certificate chain"); try { peerCertificateChain = socket.peerCertificateChain(); LOG.debug("found valid client certificate DN [{}]", peerCertificateChain[0].getSubjectDN()); } catch (final SSLPeerUnverifiedException e) { LOG.debug("could not extract client certificate chain, maybe TLS based client auth is not required"); } } }
@Override public void init(final NetSocket socket, final ProtonConnection protonConnection, final Transport transport) { LOG.debug("initializing SASL authenticator"); this.protonConnection = protonConnection; this.sasl = transport.sasl(); // TODO determine supported mechanisms dynamically based on registered AuthenticationService implementations sasl.server(); sasl.allowSkip(false); sasl.setMechanisms(MECHANISM_EXTERNAL, MECHANISM_PLAIN); if (socket.isSsl()) { LOG.debug("client connected using TLS, extracting client certificate chain"); try { peerCertificateChain = socket.peerCertificateChain(); LOG.debug("found valid client certificate DN [{}]", peerCertificateChain[0].getSubjectDN()); } catch (final SSLPeerUnverifiedException e) { LOG.debug("could not extract client certificate chain, maybe TLS based client auth is not required"); } } }
public void createServerSASL(String[] mechanisms) { requireHandler(); Sasl sasl = transport.sasl(); sasl.server(); sasl.setMechanisms(mechanisms); sasl.setListener(this); }
@Override public void init(final NetSocket socket, final ProtonConnection protonConnection, final Transport transport) { // allow for frames bigger than 512 bytes to support mechanisms that send (for instance) tokens transport.setInitialRemoteMaxFrameSize(1024*1024); this.sasl = transport.sasl(); sasl.server(); sasl.allowSkip(false); sasl.setMechanisms(getValidMechanisms(getPasswordHashAlgorithms())); connection = protonConnection; }
@Override public void run(Selectable selectable) { Reactor reactor = selectable.getReactor(); try { SocketChannel socketChannel = ((ServerSocketChannel)selectable.getChannel()).accept(); if (socketChannel == null) { throw new ReactorInternalException("Selectable readable, but no socket to accept"); } Handler handler = BaseHandler.getHandler(AcceptorImpl.this); if (handler == null) { handler = reactor.getHandler(); } Connection conn = reactor.connection(handler); Transport trans = Proton.transport(); Sasl sasl = trans.sasl(); sasl.server(); sasl.setMechanisms("ANONYMOUS"); sasl.done(SaslOutcome.PN_SASL_OK); trans.bind(conn); IOHandler.selectableTransport(reactor, socketChannel.socket(), trans); } catch(IOException ioException) { sel.error(); } } }
@Override public void handle(AmqpEvent event) { switch( event.type ) { case HEADER: AmqpHeader header = (AmqpHeader) event.decodedFrame; switch (header.getProtocolId()) { case 0: // amqpTransport.sendToAmqp(new AmqpHeader()); break; // nothing to do.. case 3: // Client will be using SASL for auth.. sasl = protonTransport.sasl(); // sasl.setMechanisms(new String[] { "ANONYMOUS", "PLAIN" }); sasl.server(); break; default: } processEvent(event); // Les send back the AMQP response headers so that the client // can send us the SASL init or AMQP open frames. Buffer buffer = toBuffer(protonTransport.getOutputBuffer()); protonTransport.outputConsumed(); socket.write(buffer); break; default: processEvent(event); } }
@Override public void handle(AmqpEvent event) { switch( event.type ) { case HEADER: AmqpHeader header = (AmqpHeader) event.decodedFrame; switch (header.getProtocolId()) { case 0: // amqpTransport.sendToAmqp(new AmqpHeader()); break; // nothing to do.. case 3: // Client will be using SASL for auth.. sasl = protonTransport.sasl(); // sasl.setMechanisms(new String[] { "ANONYMOUS", "PLAIN" }); sasl.server(); break; default: } processEvent(event); // Les send back the AMQP response headers so that the client // can send us the SASL init or AMQP open frames. Buffer buffer = toBuffer(protonTransport.getOutputBuffer()); protonTransport.outputConsumed(); socket.write(buffer); break; default: processEvent(event); } }
sasl.server(); sasl.setMechanisms("ANONYMOUS"); sasl.done(SaslOutcome.PN_SASL_OK);
if (sasl != null) sasl.server(); sasl.setMechanisms(new String[]{"ANONYMOUS"}); sasl.done(Sasl.SaslOutcome.PN_SASL_OK);
if (sasl != null) sasl.server(); sasl.setMechanisms(new String[]{"ANONYMOUS"}); sasl.done(Sasl.SaslOutcome.PN_SASL_OK);
if (sasl != null) sasl.server(); sasl.setMechanisms(new String[]{"ANONYMOUS"}); sasl.done(Sasl.SaslOutcome.PN_SASL_OK);