From ab66bf7fa55b308ed5ab302ce7a32dd2f4042154 Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Thu, 30 Oct 2008 23:14:45 +0100 Subject: [PATCH] Re-add a proper identification provider XRDS We're going to enable users to enter an OP identifier and not a claimed identifier --- modules/openid.php | 16 ++++++++++++++++ modules/openid/openid.inc.php | 6 ++++++ modules/platal.php | 6 ++++++ templates/openid/idp_xrds.tpl | 13 +++++++++++++ 4 files changed, 41 insertions(+) create mode 100644 templates/openid/idp_xrds.tpl diff --git a/modules/openid.php b/modules/openid.php index 66ad7e2..8e65c07 100644 --- a/modules/openid.php +++ b/modules/openid.php @@ -49,6 +49,7 @@ class OpenidModule extends PLModule return array( 'openid' => $this->make_hook('openid', AUTH_PUBLIC), 'openid/trust' => $this->make_hook('trust', AUTH_COOKIE), + 'openid/idp_xrds' => $this->make_hook('idp_xrds', AUTH_PUBLIC), 'openid/user_xrds' => $this->make_hook('user_xrds', AUTH_PUBLIC), 'openid/melix' => $this->make_hook('melix', AUTH_PUBLIC), ); @@ -168,6 +169,21 @@ class OpenidModule extends PLModule $this->render_openid_response($webresponse); } + function handler_idp_xrds(&$page) + { + // Load constants + $this->load('openid.inc.php'); + + // Set XRDS content-type and template + header('Content-type: application/xrds+xml'); + $page->changeTpl('openid/idp_xrds.tpl', NO_SKIN); + + // Set variables + $page->assign('type2', Auth_OpenID_TYPE_2_0_IDP); + $page->assign('sreg', Auth_OpenID_SREG_URI); + $page->assign('provider', get_openid_url()); + } + function handler_user_xrds(&$page, $x = null) { // Load constants diff --git a/modules/openid/openid.inc.php b/modules/openid/openid.inc.php index e4a7b12..a31263d 100644 --- a/modules/openid/openid.inc.php +++ b/modules/openid/openid.inc.php @@ -78,6 +78,12 @@ function get_user_openid_url($user) return $globals->baseurl . '/openid/' . $user->hruid; } +function get_idp_xrds_url() +{ + global $globals; + return $globals->baseurl . '/openid/idp_xrds'; +} + function get_user_xrds_url($user) { if (is_null($user)) { diff --git a/modules/platal.php b/modules/platal.php index 951803b..9908013 100644 --- a/modules/platal.php +++ b/modules/platal.php @@ -62,6 +62,12 @@ class PlatalModule extends PLModule function handler_index(&$page) { + global $globals; + + // Include X-XRDS-Location response-header for Yadis discovery + header('X-XRDS-Location: ' . $globals->baseurl . '/openid/idp_xrds'); + + // Redirect to the suitable page if (S::logged()) { pl_redirect('events'); } else if (!@$GLOBALS['IS_XNET_SITE']) { diff --git a/templates/openid/idp_xrds.tpl b/templates/openid/idp_xrds.tpl new file mode 100644 index 0000000..6e273c5 --- /dev/null +++ b/templates/openid/idp_xrds.tpl @@ -0,0 +1,13 @@ + + + + + {$type2} + {$sreg} + {$provider} + + + -- 2.1.4