Examples of SASLMechanism


Examples of com.rabbitmq.client.SaslMechanism

                throw new ProtocolVersionMismatchException(clientVersion,
                                                           serverVersion);
            }

            String[] mechanisms = connStart.getMechanisms().toString().split(" ");
            SaslMechanism sm = this.saslConfig.getSaslMechanism(mechanisms);
            if (sm == null) {
                throw new IOException("No compatible authentication mechanism found - " +
                        "server offered [" + connStart.getMechanisms() + "]");
            }

            LongString challenge = null;
            LongString response = sm.handleChallenge(null, this.username, this.password);

            do {
                Method method = (challenge == null)
                    ? new AMQP.Connection.StartOk.Builder()
                                    .clientProperties(_clientProperties)
                                    .mechanism(sm.getName())
                                    .response(response)
                          .build()
                    : new AMQP.Connection.SecureOk.Builder().response(response).build();

                try {
                    Method serverResponse = _channel0.rpc(method).getMethod();
                    if (serverResponse instanceof AMQP.Connection.Tune) {
                        connTune = (AMQP.Connection.Tune) serverResponse;
                    } else {
                        challenge = ((AMQP.Connection.Secure) serverResponse).getChallenge();
                        response = sm.handleChallenge(challenge, this.username, this.password);
                    }
                } catch (ShutdownSignalException e) {
                    throw new PossibleAuthenticationFailureException(e);
                }
            } while (connTune == null);
View Full Code Here

Examples of com.rabbitmq.client.SaslMechanism

                throw new ProtocolVersionMismatchException(clientVersion,
                                                           serverVersion);
            }

            String[] mechanisms = connStart.getMechanisms().toString().split(" ");
            SaslMechanism sm = this.saslConfig.getSaslMechanism(mechanisms);
            if (sm == null) {
                throw new IOException("No compatible authentication mechanism found - " +
                        "server offered [" + connStart.getMechanisms() + "]");
            }

            LongString challenge = null;
            LongString response = sm.handleChallenge(null, this.username, this.password);

            do {
                Method method = (challenge == null)
                    ? new AMQP.Connection.StartOk.Builder()
                                    .clientProperties(_clientProperties)
                                    .mechanism(sm.getName())
                                    .response(response)
                          .build()
                    : new AMQP.Connection.SecureOk.Builder().response(response).build();

                try {
                    Method serverResponse = _channel0.rpc(method).getMethod();
                    if (serverResponse instanceof AMQP.Connection.Tune) {
                        connTune = (AMQP.Connection.Tune) serverResponse;
                    } else {
                        challenge = ((AMQP.Connection.Secure) serverResponse).getChallenge();
                        response = sm.handleChallenge(challenge, this.username, this.password);
                    }
                } catch (ShutdownSignalException e) {
                    Method shutdownMethod = e.getReason();
                    if (shutdownMethod instanceof AMQP.Connection.Close) {
                        AMQP.Connection.Close shutdownClose =  (AMQP.Connection.Close) shutdownMethod;
View Full Code Here

Examples of org.apache.vysper.xmpp.authorization.SASLMechanism

        String requestedMechanism = stanza.getAttributeValue("mechanism");
        if (requestedMechanism == null) {
            return respondSASLFailure();
        }

        SASLMechanism identifiedMechanism = null;

        List<SASLMechanism> list = sessionContext.getServerRuntimeContext().getServerFeatures().getAuthenticationMethods();
        for (SASLMechanism saslMechanism : list) {
            if (saslMechanism.getName().equals(requestedMechanism)) {
                identifiedMechanism = saslMechanism;
                break;
            }
        }
        if (identifiedMechanism == null) throw new RuntimeException("return error");

        Stanza responseStanza = identifiedMechanism.started(sessionContext, sessionStateHolder, stanza);
        if (sessionStateHolder.getState() == SessionState.AUTHENTICATED) {
            AuthorizationRetriesCounter.removeFromSession(sessionContext);
        } else {
            AuthorizationRetriesCounter.getFromSession(sessionContext).countFailedTry();
        }
View Full Code Here

Examples of org.apache.vysper.xmpp.authorization.SASLMechanism

        String requestedMechanism = stanza.getAttributeValue("mechanism");
        if (requestedMechanism == null) {
            return respondSASLFailure();
        }

        SASLMechanism identifiedMechanism = null;

        List<SASLMechanism> list = sessionContext.getServerRuntimeContext().getServerFeatures()
                .getAuthenticationMethods();
        for (SASLMechanism saslMechanism : list) {
            if (saslMechanism.getName().equals(requestedMechanism)) {
                identifiedMechanism = saslMechanism;
                break;
            }
        }
        if (identifiedMechanism == null)
            throw new RuntimeException("return error");

        Stanza responseStanza = identifiedMechanism.started(sessionContext, sessionStateHolder, stanza);
        if (sessionStateHolder.getState() == SessionState.AUTHENTICATED) {
            AuthorizationRetriesCounter.removeFromSession(sessionContext);
        } else {
            AuthorizationRetriesCounter.getFromSession(sessionContext).countFailedTry();
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.