summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Auth/OpenID/Consumer.php67
-rw-r--r--Auth/OpenID/Discover.php22
2 files changed, 27 insertions, 62 deletions
diff --git a/Auth/OpenID/Consumer.php b/Auth/OpenID/Consumer.php
index 80d13a6..8e28c2f 100644
--- a/Auth/OpenID/Consumer.php
+++ b/Auth/OpenID/Consumer.php
@@ -295,45 +295,31 @@ class Auth_OpenID_Consumer {
*/
function begin($user_url)
{
- global $_yadis_available;
-
$openid_url = Auth_OpenID::normalizeUrl($user_url);
- if ($_yadis_available) {
- $disco = new Services_Yadis_Discovery($this->session,
- $openid_url,
- $this->session_key_prefix);
-
- // Set the 'stale' attribute of the manager. If discovery
- // fails in a fatal way, the stale flag will cause the
- // manager to be cleaned up next time discovery is
- // attempted.
- $m = $disco->getManager();
- if ($m) {
- $m->stale = true;
- $disco->session->set($disco->session_key,
- serialize($m));
- }
-
- $endpoint = $disco->getNextService(
- '_Auth_OpenID_discoverServiceList',
- $this->consumer->fetcher);
-
- // Reset the 'stale' attribute of the manager.
- $m =& $disco->getManager();
- if ($m) {
- $m->stale = false;
- $disco->session->set($disco->session_key,
- serialize($m));
- }
+ $disco = new Services_Yadis_Discovery($this->session,
+ $openid_url,
+ $this->session_key_prefix);
+
+ // Set the 'stale' attribute of the manager. If discovery
+ // fails in a fatal way, the stale flag will cause the manager
+ // to be cleaned up next time discovery is attempted.
+ $m = $disco->getManager();
+ if ($m) {
+ $m->stale = true;
+ $disco->session->set($disco->session_key,
+ serialize($m));
+ }
- } else {
- $endpoint = null;
- $result = Auth_OpenID_discover($openid_url,
+ $endpoint = $disco->getNextService(
+ '_Auth_OpenID_discoverServiceList',
$this->consumer->fetcher);
- if ($result !== null) {
- list($temp, $endpoints, $http_response) = $result;
- $endpoint = $endpoints[0];
- }
+
+ // Reset the 'stale' attribute of the manager.
+ $m =& $disco->getManager();
+ if ($m) {
+ $m->stale = false;
+ $disco->session->set($disco->session_key,
+ serialize($m));
}
if ($endpoint === null) {
@@ -378,8 +364,6 @@ class Auth_OpenID_Consumer {
*/
function complete($query)
{
- global $_yadis_available;
-
$query = Auth_OpenID::fixArgs($query);
$token = $this->session->get($this->_token_key);
@@ -394,11 +378,10 @@ class Auth_OpenID_Consumer {
if (in_array($response->status, array(Auth_OpenID_SUCCESS,
Auth_OpenID_CANCEL))) {
- if ($_yadis_available &&
- $response->identity_url !== null) {
+ if ($response->identity_url !== null) {
$disco = new Services_Yadis_Discovery($this->session,
- $response->identity_url,
- $this->session_key_prefix);
+ $response->identity_url,
+ $this->session_key_prefix);
$disco->cleanup();
}
}
diff --git a/Auth/OpenID/Discover.php b/Auth/OpenID/Discover.php
index 6ced719..51e8013 100644
--- a/Auth/OpenID/Discover.php
+++ b/Auth/OpenID/Discover.php
@@ -9,20 +9,8 @@ require_once "Auth/OpenID/Parse.php";
// If the Yadis library is available, use it. Otherwise, only use
// old-style discovery.
-global $_yadis_available;
-$_yadis_available = false;
-
-$try_include = @include 'Services/Yadis/Yadis.php';
-
-if ($try_include) {
- $_yadis_available = true;
-} else {
- trigger_error("Yadis support not found; please install the ".
- "JanRain, Inc. PHP Yadis library, available at ".
- "http://www.openidenabled.com.",
- E_USER_ERROR);
-}
+require_once 'Services/Yadis/Yadis.php';
define('_OPENID_1_0_NS', 'http://openid.net/xmlns/1.0');
define('_OPENID_1_2_TYPE', 'http://openid.net/signon/1.2');
@@ -231,13 +219,7 @@ function Auth_OpenID_discoverWithoutYadis($uri, &$fetcher)
function Auth_OpenID_discover($uri, &$fetcher)
{
- global $_yadis_available;
-
- if ($_yadis_available) {
- return @Auth_OpenID_discoverWithYadis($uri, $fetcher);
- } else {
- return @Auth_OpenID_discoverWithoutYadis($uri, $fetcher);
- }
+ return @Auth_OpenID_discoverWithYadis($uri, $fetcher);
}
?> \ No newline at end of file