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;
}
Aggregations