mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-27 15:19:57 +09:00
17515512: JanRain php-openid library included, normalization fix
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@5137 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
f541dd59b9
commit
658c0e6dbc
219 changed files with 41415 additions and 10 deletions
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
|
||||
require_once "lib/render.php";
|
||||
require_once "lib/session.php";
|
||||
|
||||
require_once "lib/render/login.php";
|
||||
require_once "lib/render/about.php";
|
||||
require_once "lib/render/trust.php";
|
||||
|
||||
require_once "Auth/OpenID/Server.php";
|
||||
require_once "Auth/OpenID/HMACSHA1.php";
|
||||
|
||||
function authCancel($info)
|
||||
{
|
||||
if ($info) {
|
||||
setRequestInfo();
|
||||
$url = $info->getCancelURL();
|
||||
} else {
|
||||
$url = getServerURL();
|
||||
}
|
||||
return redirect_render($url);
|
||||
}
|
||||
|
||||
function doAuth($info, $trusted=null, $fail_cancels=false)
|
||||
{
|
||||
if (!$info) {
|
||||
// There is no authentication information, so bail
|
||||
return authCancel(null);
|
||||
}
|
||||
|
||||
$req_url = $info->identity;
|
||||
$user = getLoggedInUser();
|
||||
setRequestInfo($info);
|
||||
|
||||
if ($req_url != $user) {
|
||||
return login_render(array(), $req_url, $req_url);
|
||||
}
|
||||
|
||||
$sites = getSessionSites();
|
||||
$trust_root = $info->trust_root;
|
||||
$fail_cancels = $fail_cancels || isset($sites[$trust_root]);
|
||||
$trusted = isset($trusted) ? $trusted : isTrusted($req_url, $trust_root);
|
||||
if ($trusted) {
|
||||
setRequestInfo();
|
||||
$server =& getServer();
|
||||
$response =& $info->answer(true);
|
||||
$webresponse =& $server->encodeResponse($response);
|
||||
|
||||
$new_headers = array();
|
||||
|
||||
foreach ($webresponse->headers as $k => $v) {
|
||||
$new_headers[] = $k.": ".$v;
|
||||
}
|
||||
|
||||
return array($new_headers, $webresponse->body);
|
||||
} elseif ($fail_cancels) {
|
||||
return authCancel($info);
|
||||
} else {
|
||||
return trust_render($info);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue