summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortailor <cygnus@cprogrammer.org>2007-11-13 01:58:00 +0000
committertailor <cygnus@cprogrammer.org>2007-11-13 01:58:00 +0000
commit1f45f3f6f4b2691b8697fb52525cba2f79df7862 (patch)
treec21afb646796fe189e610de24eb4e52fcee54c7b
parent5203594829f55e334f75f29adfab4f2ccc06bb4e (diff)
downloadphp-openid-1f45f3f6f4b2691b8697fb52525cba2f79df7862.zip
php-openid-1f45f3f6f4b2691b8697fb52525cba2f79df7862.tar.gz
php-openid-1f45f3f6f4b2691b8697fb52525cba2f79df7862.tar.bz2
[project @ Pass return_to to complete() in example consumer]
-rw-r--r--examples/consumer/common.php22
-rw-r--r--examples/consumer/finish_auth.php3
-rw-r--r--examples/consumer/try_auth.php22
3 files changed, 24 insertions, 23 deletions
diff --git a/examples/consumer/common.php b/examples/consumer/common.php
index c184467..ba287c6 100644
--- a/examples/consumer/common.php
+++ b/examples/consumer/common.php
@@ -59,4 +59,26 @@ function &getConsumer() {
return new Auth_OpenID_Consumer($store);
}
+function getScheme() {
+ $scheme = 'http';
+ if (isset($_SERVER['HTTPS']) and $_SERVER['HTTPS'] == 'on') {
+ $scheme .= 's';
+ }
+ return $scheme;
+}
+
+function getReturnTo() {
+ return sprintf("%s://%s:%s%s/finish_auth.php",
+ getScheme(), $_SERVER['SERVER_NAME'],
+ $_SERVER['SERVER_PORT'],
+ dirname($_SERVER['PHP_SELF']));
+}
+
+function getTrustRoot() {
+ return sprintf("%s://%s:%s%s/",
+ getScheme(), $_SERVER['SERVER_NAME'],
+ $_SERVER['SERVER_PORT'],
+ dirname($_SERVER['PHP_SELF']));
+}
+
?> \ No newline at end of file
diff --git a/examples/consumer/finish_auth.php b/examples/consumer/finish_auth.php
index de38b31..f42de0a 100644
--- a/examples/consumer/finish_auth.php
+++ b/examples/consumer/finish_auth.php
@@ -8,7 +8,8 @@ function run() {
// Complete the authentication process using the server's
// response.
- $response = $consumer->complete();
+ $return_to = getReturnTo();
+ $response = $consumer->complete(null, $return_to);
// Check the response status.
if ($response->status == Auth_OpenID_CANCEL) {
diff --git a/examples/consumer/try_auth.php b/examples/consumer/try_auth.php
index 664d40b..3cf5b4b 100644
--- a/examples/consumer/try_auth.php
+++ b/examples/consumer/try_auth.php
@@ -15,28 +15,6 @@ function getOpenIDURL() {
return $_GET['openid_identifier'];
}
-function getScheme() {
- $scheme = 'http';
- if (isset($_SERVER['HTTPS']) and $_SERVER['HTTPS'] == 'on') {
- $scheme .= 's';
- }
- return $scheme;
-}
-
-function getReturnTo() {
- return sprintf("%s://%s:%s%s/finish_auth.php",
- getScheme(), $_SERVER['SERVER_NAME'],
- $_SERVER['SERVER_PORT'],
- dirname($_SERVER['PHP_SELF']));
-}
-
-function getTrustRoot() {
- return sprintf("%s://%s:%s%s/",
- getScheme(), $_SERVER['SERVER_NAME'],
- $_SERVER['SERVER_PORT'],
- dirname($_SERVER['PHP_SELF']));
-}
-
function run() {
$openid = getOpenIDURL();
$consumer = getConsumer();