private function onAuthenticateHandler($authMethod, $authMethodInfo, Realm $realm, Session $session, AuthenticateMessage $msg)
    {

        $onAuthenticateSuccess = function ($res) use ($realm, $session) {

            if (count($res) < 1) {
                $session->abort(new \stdClass(), 'thruway.error.authentication_failure');

                return;
            }

            // we should figure out a way to have the router send the welcome
            // message so that the roles and extras that go along with it can be
            // filled in
            if ($res[0] === 'SUCCESS') {
                $this->sendWelcomeMessage($session, $res[1]);
            } elseif (isset($res[0]) && $res[0] === 'FAILURE') {
                $this->abortSessionUsingResponse($session, $res);
            } else {
                $session->abort(new \stdClass(), 'thruway.error.authentication_failure');
            }
        };

        $onAuthenticateError = function () use ($session) {
            Logger::error($this, 'onauthenticate rejected the promise');
            $session->abort(new \stdClass(), 'thruway.error.unknown');
        };

        $extra                    = new \stdClass();
        $extra->challenge_details = $session->getAuthenticationDetails()->getChallengeDetails();

        $arguments                = new \stdClass();
        $arguments->extra         = $extra;
        $arguments->authid        = $session->getAuthenticationDetails()->getAuthId();
        $arguments->challenge     = $session->getAuthenticationDetails()->getChallenge();
        $arguments->signature     = $msg->getSignature();
        $arguments->authmethod    = $authMethod;
        $arguments->hello_message = $session->getHelloMessage();

        // now we send our authenticate information to the RPC
        $onAuthenticateHandler = $authMethodInfo['handlers']->onauthenticate;

        $this->session->call($onAuthenticateHandler, [$arguments])
            ->then($onAuthenticateSuccess, $onAuthenticateError);

    }
private function onAuthenticateHandler($authMethod, $authMethodInfo, Realm $realm, Session $session, AuthenticateMessage $msg)
    {

        $onAuthenticateSuccess = function ($res) use ($realm, $session) {

            if (count($res) < 1) {
                $session->abort(new \stdClass(), 'thruway.error.authentication_failure');

                return;
            }

            // we should figure out a way to have the router send the welcome
            // message so that the roles and extras that go along with it can be
            // filled in
            if ($res[0] === 'SUCCESS') {
                $this->sendWelcomeMessage($session, $res[1]);
            } elseif (isset($res[0]) && $res[0] === 'FAILURE') {
                $this->abortSessionUsingResponse($session, $res);
            } else {
                $session->abort(new \stdClass(), 'thruway.error.authentication_failure');
            }
        };

        $onAuthenticateError = function () use ($session) {
            Logger::error($this, 'onauthenticate rejected the promise');
            $session->abort(new \stdClass(), 'thruway.error.unknown');
        };

        $extra                    = new \stdClass();
        $extra->challenge_details = $session->getAuthenticationDetails()->getChallengeDetails();

        $arguments                = new \stdClass();
        $arguments->extra         = $extra;
        $arguments->authid        = $session->getAuthenticationDetails()->getAuthId();
        $arguments->challenge     = $session->getAuthenticationDetails()->getChallenge();
        $arguments->signature     = $msg->getSignature();
        $arguments->authmethod    = $authMethod;
        $arguments->hello_message = $session->getHelloMessage();

        // now we send our authenticate information to the RPC
        $onAuthenticateHandler = $authMethodInfo['handlers']->onauthenticate;

        $this->session->call($onAuthenticateHandler, [$arguments])
            ->then($onAuthenticateSuccess, $onAuthenticateError);

    }
private function onAuthenticateHandler ( $ authMethod , $ authMethodInfo , Realm $ realm , Session $ session , AuthenticateMessage $ msg ) { $ onAuthenticateSuccess = function ( $ res ) use ( $ realm , $ session ) { if ( count ( $ res ) < 1 ) { $ session -> abort ( new \ stdClass ( ) , 'thruway.error.authentication_failure' ) ; return ; } // we should figure out a way to have the router send the welcome // message so that the roles and extras that go along with it can be // filled in if ( $ res [ 0 ] === 'SUCCESS' ) { $ this -> sendWelcomeMessage ( $ session , $ res [ 1 ] ) ; } elseif ( isset ( $ res [ 0 ] ) && $ res [ 0 ] === 'FAILURE' ) { $ this -> abortSessionUsingResponse ( $ session , $ res ) ; } else { $ session -> abort ( new \ stdClass ( ) , 'thruway.error.authentication_failure' ) ; } } ; $ onAuthenticateError = function ( ) use ( $ session ) { Logger :: error ( $ this , 'onauthenticate rejected the promise' ) ; $ session -> abort ( new \ stdClass ( ) , 'thruway.error.unknown' ) ; } ; $ extra = new \ stdClass ( ) ; $ extra -> challenge_details = $ session -> getAuthenticationDetails ( ) -> getChallengeDetails ( ) ; $ arguments = new \ stdClass ( ) ; $ arguments -> extra = $ extra ; $ arguments -> authid = $ session -> getAuthenticationDetails ( ) -> getAuthId ( ) ; $ arguments -> challenge = $ session -> getAuthenticationDetails ( ) -> getChallenge ( ) ; $ arguments -> signature = $ msg -> getSignature ( ) ; $ arguments -> authmethod = $ authMethod ; $ arguments -> hello_message = $ session -> getHelloMessage ( ) ; // now we send our authenticate information to the RPC $ onAuthenticateHandler = $ authMethodInfo [ 'handlers' ] -> onauthenticate ; $ this -> session -> call ( $ onAuthenticateHandler , [ $ arguments ] ) -> then ( $ onAuthenticateSuccess , $ onAuthenticateError ) ; }
Call the handler that was registered to handle the Authenticate Message

@param $authMethod
@param $authMethodInfo
@param Realm $realm
@param Session $session
@param AuthenticateMessage $msg
Call the handler that was registered to handle the Authenticate Message