public function handleAuthenticateMessage(Realm $realm, Session $session, AuthenticateMessage $msg)
    {
        if ($session->getAuthenticationDetails() === null) {
            throw new \Exception('Authenticate with no previous auth details');
        }

        $authMethod = $session->getAuthenticationDetails()->getAuthMethod();

        // find the auth method
        foreach ($this->authMethods as $am => $authMethodInfo) {
            if ($authMethod == $am) {
                $this->onAuthenticateHandler($authMethod, $authMethodInfo, $realm, $session, $msg);
            }
        }
    }