summaryrefslogtreecommitdiffstats
path: root/examples/server/lib/common.php
diff options
context:
space:
mode:
authortailor <cygnus@janrain.com>2007-03-22 18:22:00 +0000
committertailor <cygnus@janrain.com>2007-03-22 18:22:00 +0000
commit8ab6cc345e221f1e931597faeadfd345baf3ffda (patch)
treecd2c33ecd8bd5602489d1d817fd1cc5cbaddb412 /examples/server/lib/common.php
parent900ae4d1d1cbdda4ce918ca8a813d1364fd73907 (diff)
downloadphp-openid-8ab6cc345e221f1e931597faeadfd345baf3ffda.zip
php-openid-8ab6cc345e221f1e931597faeadfd345baf3ffda.tar.gz
php-openid-8ab6cc345e221f1e931597faeadfd345baf3ffda.tar.bz2
[project @ Example server overhaul; add OpenID 2 features]
Diffstat (limited to 'examples/server/lib/common.php')
-rw-r--r--examples/server/lib/common.php22
1 files changed, 15 insertions, 7 deletions
diff --git a/examples/server/lib/common.php b/examples/server/lib/common.php
index 147d74a..9fd8e67 100644
--- a/examples/server/lib/common.php
+++ b/examples/server/lib/common.php
@@ -21,29 +21,37 @@ function authCancel($info)
return redirect_render($url);
}
-function doAuth($info, $trusted=null, $fail_cancels=false)
+function doAuth($info, $trusted=null, $fail_cancels=false,
+ $idpSelect=null)
{
if (!$info) {
// There is no authentication information, so bail
return authCancel(null);
}
- $req_url = $info->identity;
+ if ($info->idSelect()) {
+ if ($idpSelect) {
+ $req_url = idURL($idpSelect);
+ } else {
+ $trusted = false;
+ }
+ } else {
+ $req_url = $info->identity;
+ }
+
$user = getLoggedInUser();
setRequestInfo($info);
- if ($req_url != idURL($user)) {
+ if ((!$info->idSelect()) && ($req_url != idURL($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);
+ $response =& $info->answer(true, null, $req_url);
$webresponse =& $server->encodeResponse($response);
$new_headers = array();