예제 #1
0
파일: Server.php 프로젝트: hoalangoc/ftf
	function trustRootValid()
	{
		if (!$this->trust_root) {
			return true;
		}

		$tr = Auth_OpenID_TrustRoot::_parse($this->trust_root);
		if ($tr === false) {
			return new Auth_OpenID_MalformedTrustRoot($this->message,
			$this->trust_root);
		}

		if ($this->return_to !== null) {
			return Auth_OpenID_TrustRoot::match($this->trust_root,
			$this->return_to);
		} else {
			return true;
		}
	}
예제 #2
0
파일: AX.php 프로젝트: kaantunc/MYK-BOR
 /**
  * Extract a FetchRequest from an OpenID message
  *
  * @param request: The OpenID request containing the attribute
  * fetch request
  *
  * @returns mixed An Auth_OpenID_AX_Error or the
  * Auth_OpenID_AX_FetchRequest extracted from the request message if
  * successful
  */
 function &fromOpenIDRequest($request)
 {
     $m = $request->message;
     $obj = new Auth_OpenID_AX_FetchRequest();
     $ax_args = $m->getArgs($obj->ns_uri);
     $result = $obj->parseExtensionArgs($ax_args);
     if (Auth_OpenID_AX::isError($result)) {
         return $result;
     }
     if ($obj->update_url) {
         // Update URL must match the openid.realm of the
         // underlying OpenID 2 message.
         $realm = $m->getArg(Auth_OpenID_OPENID_NS, 'realm', $m->getArg(Auth_OpenID_OPENID_NS, 'return_to'));
         if (!$realm) {
             $obj = new Auth_OpenID_AX_Error(sprintf("Cannot validate update_url %s " . "against absent realm", $obj->update_url));
         } else {
             if (!Auth_OpenID_TrustRoot::match($realm, $obj->update_url)) {
                 $obj = new Auth_OpenID_AX_Error(sprintf("Update URL %s failed validation against realm %s", $obj->update_url, $realm));
             }
         }
     }
     return $obj;
 }
예제 #3
0
function Auth_OpenID_returnToMatches($allowed_return_to_urls, $return_to)
{
    foreach ($allowed_return_to_urls as $allowed_return_to) {
        // A return_to pattern works the same as a realm, except that
        // it's not allowed to use a wildcard. We'll model this by
        // parsing it as a realm, and not trying to match it if it has
        // a wildcard.
        $return_realm = Auth_OpenID_TrustRoot::_parse($allowed_return_to);
        if ($return_realm !== false && !$return_realm['wildcard'] && Auth_OpenID_TrustRoot::match($allowed_return_to, $return_to)) {
            return true;
        }
    }
    // No URL in the list matched
    return false;
}
예제 #4
0
 function runTest()
 {
     $matches = Auth_OpenID_TrustRoot::match($this->tr, $this->rt);
     $this->assertEquals((bool) $this->matches, (bool) $matches);
 }