Search in sources :

Example 1 with Hello

use of io.crossbar.autobahn.wamp.messages.Hello in project autobahn-java by crossbario.

the class Session method reallyJoin.

private CompletableFuture<SessionDetails> reallyJoin(String realm, List<IAuthenticator> authenticators) {
    LOGGER.d("Called join() with realm=" + realm);
    mRealm = realm;
    mAuthenticators = authenticators;
    mGoodbyeSent = false;
    Map<String, Map> roles = new HashMap<>();
    roles.put("publisher", new HashMap<>());
    roles.put("subscriber", new HashMap<>());
    roles.put("caller", new HashMap<>());
    roles.put("callee", new HashMap<>());
    if (mAuthenticators == null) {
        send(new Hello(realm, roles));
    } else {
        List<String> authMethods = new ArrayList<>();
        String authID = null;
        Map<String, Object> authextra = null;
        for (IAuthenticator authenticator : mAuthenticators) {
            authMethods.add(authenticator.getAuthMethod());
            if (authenticator.getAuthMethod().equals(TicketAuth.authmethod)) {
                TicketAuth auth = (TicketAuth) authenticator;
                authID = auth.authid;
            } else if (authenticator.getAuthMethod().equals(ChallengeResponseAuth.authmethod)) {
                ChallengeResponseAuth auth = (ChallengeResponseAuth) authenticator;
                authID = auth.authid;
            } else if (authenticator.getAuthMethod().equals(CryptosignAuth.authmethod)) {
                CryptosignAuth auth = (CryptosignAuth) authenticator;
                authID = auth.authid;
                authextra = auth.authextra;
            }
        }
        send(new Hello(realm, roles, authMethods, authID, authextra));
    }
    mJoinFuture = new CompletableFuture<>();
    mState = STATE_HELLO_SENT;
    return mJoinFuture;
}
Also used : TicketAuth(io.crossbar.autobahn.wamp.auth.TicketAuth) HashMap(java.util.HashMap) CryptosignAuth(io.crossbar.autobahn.wamp.auth.CryptosignAuth) IAuthenticator(io.crossbar.autobahn.wamp.interfaces.IAuthenticator) ArrayList(java.util.ArrayList) Hello(io.crossbar.autobahn.wamp.messages.Hello) ChallengeResponseAuth(io.crossbar.autobahn.wamp.auth.ChallengeResponseAuth) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

ChallengeResponseAuth (io.crossbar.autobahn.wamp.auth.ChallengeResponseAuth)1 CryptosignAuth (io.crossbar.autobahn.wamp.auth.CryptosignAuth)1 TicketAuth (io.crossbar.autobahn.wamp.auth.TicketAuth)1 IAuthenticator (io.crossbar.autobahn.wamp.interfaces.IAuthenticator)1 Hello (io.crossbar.autobahn.wamp.messages.Hello)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1