fromMessage() static public method

static public fromMessage ( $message )
Beispiel #1
0
function Auth_OpenID_associate($qs, $assoc_secret, $assoc_handle)
{
    $query_data = Auth_OpenID_parse($qs);
    assert($query_data['openid.mode'] == 'associate');
    assert($query_data['openid.assoc_type'] == 'HMAC-SHA1');
    $reply_dict = array('assoc_type' => 'HMAC-SHA1', 'assoc_handle' => $assoc_handle, 'expires_in' => '600');
    if (defined('Auth_OpenID_NO_MATH_SUPPORT')) {
        assert(count($query_data) == 2);
        $message = Auth_OpenID_Message::fromPostArgs($query_data);
        $session = Auth_OpenID_PlainTextServerSession::fromMessage($message);
    } else {
        assert(count($query_data) == 6 || count($query_data) == 4);
        assert($query_data['openid.mode'] == 'associate');
        assert($query_data['openid.session_type'] == 'DH-SHA1');
        $message = Auth_OpenID_Message::fromPostArgs($query_data);
        $session = Auth_OpenID_DiffieHellmanSHA1ServerSession::fromMessage($message);
        $reply_dict['session_type'] = 'DH-SHA1';
    }
    $reply_dict = array_merge($reply_dict, $session->answer($assoc_secret));
    return Auth_OpenID_KVForm::fromArray($reply_dict);
}
 function _setUpDH()
 {
     list($sess, $message) = $this->consumer->_createAssociateRequest($this->endpoint, 'HMAC-SHA1', 'DH-SHA1');
     // XXX: this is testing _createAssociateRequest
     $this->assertEquals($this->endpoint->compatibilityMode(), $message->isOpenID1());
     $server_sess = Auth_OpenID_DiffieHellmanSHA1ServerSession::fromMessage($message);
     $server_resp = $server_sess->answer($this->secret);
     $server_resp['assoc_type'] = 'HMAC-SHA1';
     $server_resp['assoc_handle'] = 'handle';
     $server_resp['expires_in'] = '1000';
     $server_resp['session_type'] = 'DH-SHA1';
     return array($sess, Auth_OpenID_Message::fromOpenIDArgs($server_resp));
 }