Thruway\Connection::handleOnChallenge PHP Method

handleOnChallenge() private method

Setup the onChallenge callback
private handleOnChallenge ( )
    private function handleOnChallenge()
    {
        $options = $this->options;
        if (isset($options['onChallenge']) && is_callable($options['onChallenge']) && isset($options['authmethods']) && is_array($options['authmethods'])) {
            $this->client->setAuthMethods($options['authmethods']);
            $this->client->on('challenge', function (ClientSession $session, ChallengeMessage $msg) use($options) {
                $token = call_user_func_array($options['onChallenge'], [$session, $msg->getAuthMethod(), $msg]);
                $session->sendMessage(new AuthenticateMessage($token));
            });
        }
    }