本文整理汇总了PHP中Auth_OpenID_TrustRoot类的典型用法代码示例。如果您正苦于以下问题:PHP Auth_OpenID_TrustRoot类的具体用法?PHP Auth_OpenID_TrustRoot怎么用?PHP Auth_OpenID_TrustRoot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Auth_OpenID_TrustRoot类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: trustRootValid
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;
}
}
开发者ID:hoalangoc,项目名称:ftf,代码行数:19,代码来源:Server.php
示例2: match
/**
* Does this URL match the given trust root?
*
* Return whether the URL falls under the given trust root. This
* does not check whether the trust root is sane. If the URL or
* trust root do not parse, this function will return false.
*
* @param string $trust_root The trust root to match against
*
* @param string $url The URL to check
*
* @return bool $matches Whether the URL matches against the
* trust root
*/
function match($trust_root, $url)
{
$trust_root_parsed = Auth_OpenID_TrustRoot::_parse($trust_root);
$url_parsed = Auth_OpenID_TrustRoot::_parse($url);
if (!$trust_root_parsed || !$url_parsed) {
return false;
}
// Check hosts matching
if ($url_parsed['wildcard']) {
return false;
}
if ($trust_root_parsed['wildcard']) {
$host_tail = $trust_root_parsed['host'];
$host = $url_parsed['host'];
if ($host_tail && substr($host, -strlen($host_tail)) != $host_tail && substr($host_tail, 1) != $host) {
return false;
}
} else {
if ($trust_root_parsed['host'] != $url_parsed['host']) {
return false;
}
}
// Check path and query matching
$base_path = $trust_root_parsed['path'];
$path = $url_parsed['path'];
if (!isset($trust_root_parsed['query'])) {
if ($base_path != $path) {
if (substr($path, 0, strlen($base_path)) != $base_path) {
return false;
}
if (substr($base_path, strlen($base_path) - 1, 1) != '/' && substr($path, strlen($base_path), 1) != '/') {
return false;
}
}
} else {
$base_query = $trust_root_parsed['query'];
$query = @$url_parsed['query'];
$qplus = substr($query, 0, strlen($base_query) + 1);
$bqplus = $base_query . '&';
if ($base_path != $path || $base_query != $query && $qplus != $bqplus) {
return false;
}
}
// The port and scheme need to match exactly
return $trust_root_parsed['scheme'] == $url_parsed['scheme'] && $url_parsed['port'] === $trust_root_parsed['port'];
}
开发者ID:kaantunc,项目名称:MYK-BOR,代码行数:60,代码来源:TrustRoot.php
示例3: failUnlessDiscoURL
function failUnlessDiscoURL($realm, $expected_discovery_url)
{
$actual_discovery_url = Auth_OpenID_TrustRoot::buildDiscoveryURL($realm);
$this->assertEquals($expected_discovery_url, $actual_discovery_url);
}
开发者ID:BGCX067,项目名称:ezopenid-svn-to-git,代码行数:5,代码来源:RPVerify.php
示例4: Auth_OpenID_AX_FetchRequest
/**
* 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;
}
开发者ID:kaantunc,项目名称:MYK-BOR,代码行数:33,代码来源:AX.php
示例5: runTest
function runTest()
{
$matches = Auth_OpenID_TrustRoot::match($this->tr, $this->rt);
$this->assertEquals((bool) $this->matches, (bool) $matches);
}
开发者ID:Jobava,项目名称:diacritice-meta-repo,代码行数:5,代码来源:TrustRoot.php
注:本文中的Auth_OpenID_TrustRoot类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论