diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/consumer/finish_auth.php | 3 | ||||
-rw-r--r-- | examples/consumer/try_auth.php | 8 | ||||
-rw-r--r-- | examples/server/lib/actions.php | 7 | ||||
-rw-r--r-- | examples/server/lib/session.php | 14 |
4 files changed, 28 insertions, 4 deletions
diff --git a/examples/consumer/finish_auth.php b/examples/consumer/finish_auth.php index 5ddf623..bee5743 100644 --- a/examples/consumer/finish_auth.php +++ b/examples/consumer/finish_auth.php @@ -28,6 +28,9 @@ if ($response->status == Auth_OpenID_CANCEL) { if (@$sreg['email']) { $success .= " You also returned '".$sreg['email']."' as your email."; } + if (@$sreg['postcode']) { + $success .= " Your postal code is '".$sreg['postcode']."'"; + } } include 'index.php'; diff --git a/examples/consumer/try_auth.php b/examples/consumer/try_auth.php index f61b2f2..c5f7ef5 100644 --- a/examples/consumer/try_auth.php +++ b/examples/consumer/try_auth.php @@ -12,12 +12,12 @@ if (empty($_GET['openid_url'])) { } $openid = $_GET['openid_url']; -$process_url = sprintf("http://%s%s/finish_auth.php", - $_SERVER['SERVER_NAME'], +$process_url = sprintf("http://%s:%s%s/finish_auth.php", + $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'], dirname($_SERVER['PHP_SELF'])); -$trust_root = sprintf("http://%s%s", - $_SERVER['SERVER_NAME'], +$trust_root = sprintf("http://%s:%s%s", + $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'], dirname($_SERVER['PHP_SELF'])); // Begin the OpenID authentication process. diff --git a/examples/server/lib/actions.php b/examples/server/lib/actions.php index 3c331f6..5e255e2 100644 --- a/examples/server/lib/actions.php +++ b/examples/server/lib/actions.php @@ -37,6 +37,13 @@ function action_default() if (isTrusted($request->identity, $request->trust_root)) { $response =& $request->answer(true); + $sreg = getSreg($request->identity); + if (is_array($sreg)) { + foreach ($sreg as $k => $v) { + $response->addField('sreg', $k, + $v); + } + } } else if ($request->immediate) { $response =& $request->answer(false, getServerURL()); } else { diff --git a/examples/server/lib/session.php b/examples/server/lib/session.php index 263a64f..e11fd64 100644 --- a/examples/server/lib/session.php +++ b/examples/server/lib/session.php @@ -188,4 +188,18 @@ function setRequestInfo($info=null) } } + +function getSreg($identity) +{ + // from config.php + global $openid_sreg; + + if (!is_array($openid_sreg)) { + return null; + } + + return $openid_sreg[$identity]; + +} + ?>
\ No newline at end of file |