summaryrefslogtreecommitdiffstats
path: root/examples/consumer
diff options
context:
space:
mode:
Diffstat (limited to 'examples/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();