public function handleHelloMessage(Realm $realm, Session $session, HelloMessage $msg)
{
$requestedMethods = $msg->getAuthMethods();
$sentMessage = false;
// Go through the authmethods and try to send a response message
foreach ($this->authMethods as $authMethod => $authMethodInfo) {
if (in_array($authMethod, $requestedMethods) && (in_array($realm->getRealmName(), $authMethodInfo['auth_realms']) || in_array("*", $authMethodInfo['auth_realms']))) {
$this->onHelloAuthHandler($authMethod, $authMethodInfo, $realm, $session, $msg);
$sentMessage = true;
}
}
//If we already replied with a message, we don't have to do anything else
if ($sentMessage) {
return;
}
// If no authentication providers are registered for this realm send an abort message
if ($this->realmHasAuthProvider($realm->getRealmName())) {
$session->abort(new \stdClass(), "wamp.error.not_authorized");
return;
}
//If we've gotten this far, it means that the user needs to be Logged in as anonymous
$session->setAuthenticationDetails(AuthenticationDetails::createAnonymous());
$details = new \stdClass();
$session->sendMessage(new WelcomeMessage($session->getSessionId(), $details));
$session->setAuthenticated(true);
}