setArg() public method

public setArg ( $namespace, $key, $value )
Beispiel #1
0
	function getCancelURL()
	{
		if (!$this->return_to) {
			return new Auth_OpenID_NoReturnToError();
		}

		if ($this->immediate) {
			return new Auth_OpenID_ServerError(null,
                                               "Cancel is not an appropriate \
                                               response to immediate mode \
                                               requests.");
		}

		$response = new Auth_OpenID_Message(
		$this->message->getOpenIDNamespace());
		$response->setArg(Auth_OpenID_OPENID_NS, 'mode', 'cancel');
		return $response->toURL($this->return_to);
	}
Beispiel #2
0
 function testUnsupportedWithRetry()
 {
     $msg = new Auth_OpenID_Message($this->endpoint->preferredNamespace());
     $msg->setArg(Auth_OpenID_OPENID_NS, 'error', 'Unsupported type');
     $msg->setArg(Auth_OpenID_OPENID_NS, 'error_code', 'unsupported-type');
     $msg->setArg(Auth_OpenID_OPENID_NS, 'assoc_type', 'HMAC-SHA1');
     $msg->setArg(Auth_OpenID_OPENID_NS, 'session_type', 'DH-SHA1');
     $assoc = new Auth_OpenID_Association('handle', 'secretxx', 'issued', 10000, 'HMAC-SHA1');
     $this->consumer->return_messages = array($assoc, $msg);
     $result = $this->consumer->_negotiateAssociation($this->endpoint);
     $this->assertTrue($result === null);
     // $this->failUnlessLogMatches('Server error when requesting an association')
 }
Beispiel #3
0
 function test_completeGoodReturnTo()
 {
     // Test GenericConsumer.complete()'s handling of good
     // return_to values.
     $return_to = "http://some.url/path";
     $good_return_tos = array(array($return_to, array()), array($return_to . "?another=arg", array(array(array(Auth_OpenID_BARE_NS, 'another'), 'arg'))), array($return_to . "?another=arg#fragment", array(array(array(Auth_OpenID_BARE_NS, 'another'), 'arg'))), array("HTTP://some.url/path", array()), array("http://some.URL/path", array()), array("http://some.url:80/path", array()), array("http://some.url/./path", array()));
     $endpoint = null;
     foreach ($good_return_tos as $pair) {
         list($good_return_to, $extra) = $pair;
         $m = new Auth_OpenID_Message(Auth_OpenID_OPENID1_NS);
         $m->setArg(Auth_OpenID_OPENID_NS, 'mode', 'cancel');
         for ($i = 0; $i < count($extra); $i++) {
             list($ckey, $value) = $extra[$i];
             $ns = $ckey[0];
             $key = $ckey[1];
             $m->setArg($ns, $key, $value);
         }
         $m->setArg(Auth_OpenID_OPENID_NS, 'return_to', $good_return_to);
         $result = $this->consumer->complete($m, $endpoint, $return_to);
         $this->assertTrue(is_a($result, 'Auth_OpenID_CancelResponse'));
     }
 }
 function test_trustRootOpenID2()
 {
     // Ignore openid.trust_root in OpenID 2
     $msg = new Auth_OpenID_Message(Auth_OpenID_OPENID2_NS);
     $msg->setArg(Auth_OpenID_OPENID_NS, 'mode', 'checkid_setup');
     $msg->setArg(Auth_OpenID_OPENID_NS, 'realm', 'http://real_trust_root/');
     $msg->setArg(Auth_OpenID_OPENID_NS, 'trust_root', 'http://fake_trust_root/');
     $msg->setArg(Auth_OpenID_OPENID_NS, 'return_to', 'http://real_trust_root/foo');
     $msg->setArg(Auth_OpenID_OPENID_NS, 'assoc_handle', 'bogus');
     $msg->setArg(Auth_OpenID_OPENID_NS, 'identity', 'george');
     $msg->setArg(Auth_OpenID_OPENID_NS, 'claimed_id', 'george');
     $result = Auth_OpenID_CheckIDRequest::fromMessage($msg, $this->server);
     $this->assertTrue($result->trust_root == 'http://real_trust_root/');
 }