summaryrefslogtreecommitdiffstats
path: root/Auth
diff options
context:
space:
mode:
authortailor <cygnus@janrain.com>2007-01-11 18:55:11 +0000
committertailor <cygnus@janrain.com>2007-01-11 18:55:11 +0000
commitcc7bfa9c2f075c5b4d7c4d9b075ac4c0c0f873ee (patch)
treea417774bf19467f5250b1877ce2d5276a8463783 /Auth
parent51ce805be6c23d8d52ee2ecfe53cffd0d14a8084 (diff)
downloadphp-openid-cc7bfa9c2f075c5b4d7c4d9b075ac4c0c0f873ee.zip
php-openid-cc7bfa9c2f075c5b4d7c4d9b075ac4c0c0f873ee.tar.gz
php-openid-cc7bfa9c2f075c5b4d7c4d9b075ac4c0c0f873ee.tar.bz2
[project @ Service endpoint methods and 2.0 types]
Diffstat (limited to 'Auth')
-rw-r--r--Auth/OpenID/Discover.php41
1 files changed, 41 insertions, 0 deletions
diff --git a/Auth/OpenID/Discover.php b/Auth/OpenID/Discover.php
index 8ea4d28..1390ed6 100644
--- a/Auth/OpenID/Discover.php
+++ b/Auth/OpenID/Discover.php
@@ -6,6 +6,7 @@
require_once "Auth/OpenID.php";
require_once "Auth/OpenID/Parse.php";
+require_once "Auth/OpenID/Message.php";
require_once "Services/Yadis/XRIRes.php";
require_once "Services/Yadis/Yadis.php";
@@ -16,6 +17,8 @@ define('Auth_OpenID_XMLNS_1_0', 'http://openid.net/xmlns/1.0');
define('Auth_OpenID_TYPE_1_2', 'http://openid.net/signon/1.2');
define('Auth_OpenID_TYPE_1_1', 'http://openid.net/signon/1.1');
define('Auth_OpenID_TYPE_1_0', 'http://openid.net/signon/1.0');
+define('Auth_OpenID_TYPE_2_0_IDP', 'http://openid.net/server/2.0');
+define('Auth_OpenID_TYPE_2_0', 'http://openid.net/signon/2.0');
/**
* Object representing an OpenID service endpoint.
@@ -36,6 +39,44 @@ class Auth_OpenID_ServiceEndpoint {
return in_array($extension_uri, $this->type_uris);
}
+ function preferredNamespace()
+ {
+ if (in_array(Auth_OpenID_TYPE_2_0_IDP, $this->type_uris) ||
+ in_array(Auth_OpenID_TYPE_2_0, $this->type_uris)) {
+ return Auth_OpenID_OPENID2_NS;
+ } else {
+ return Auth_OpenID_OPENID1_NS;
+ }
+ }
+
+ function supportsType($type_uri)
+ {
+ // Does this endpoint support this type?
+ return ((($type_uri == Auth_OpenID_OPENID2_NS) &&
+ (in_array(Auth_OpenID_TYPE_2_0_IDP, $this->type_uris))) or
+ $this->usesExtension($type_uri));
+ }
+
+ function compatibilityMode()
+ {
+ return $this->preferredNamespace() != Auth_OpenID_OPENID2_NS;
+ }
+
+ function isOPIdentifier()
+ {
+ return in_array(Auth_OpenID_TYPE_2_0_IDP, $this->type_uris);
+ }
+
+ function fromOPEndpointURL($op_endpoint_url)
+ {
+ // Construct an OP-Identifier OpenIDServiceEndpoint object for
+ // a given OP Endpoint URL
+ $obj = new Auth_OpenID_ServiceEndpoint();
+ $obj->server_url = $op_endpoint_url;
+ $obj->type_uris = array(Auth_OpenID_TYPE_2_0_IDP);
+ return $obj;
+ }
+
function parseService($yadis_url, $uri, $type_uris, $service_element)
{
// Set the state of this object based on the contents of the