ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
Auth_OpenID_ServiceEndpoint Class Reference

Object representing an OpenID service endpoint. More...

+ Collaboration diagram for Auth_OpenID_ServiceEndpoint:

Public Member Functions

 Auth_OpenID_ServiceEndpoint ()
 
 getDisplayIdentifier ()
 
 usesExtension ($extension_uri)
 
 preferredNamespace ()
 
 matchTypes ($type_uris)
 
 supportsType ($type_uri)
 
 compatibilityMode ()
 
 isOPIdentifier ()
 
 parseService ($yadis_url, $uri, $type_uris, $service_element)
 
 getLocalID ()
 
 consumerFromXRDS ($uri, $xrds_text)
 
 copy ()
 

Static Public Member Functions

static fromOPEndpointURL ($op_endpoint_url)
 
static fromXRDS ($uri, $xrds_text)
 
static fromDiscoveryResult ($discoveryResult)
 
static fromHTML ($uri, $html)
 

Detailed Description

Object representing an OpenID service endpoint.

Definition at line 63 of file Discover.php.

Member Function Documentation

◆ Auth_OpenID_ServiceEndpoint()

Auth_OpenID_ServiceEndpoint::Auth_OpenID_ServiceEndpoint ( )

Definition at line 64 of file Discover.php.

Referenced by Auth_OpenID_makeOpenIDEndpoints(), copy(), fromHTML(), and fromOPEndpointURL().

64  {
66  {
67  $this->claimed_id = null;
68  $this->server_url = null;
69  $this->type_uris = array();
70  $this->local_id = null;
71  $this->canonicalID = null;
72  $this->used_yadis = false; // whether this came from an XRDS
73  $this->display_identifier = null;
+ Here is the caller graph for this function:

◆ compatibilityMode()

Auth_OpenID_ServiceEndpoint::compatibilityMode ( )

Definition at line 142 of file Discover.php.

References Auth_OpenID_OPENID2_NS, and preferredNamespace().

144  {
145  return $this->preferredNamespace() != Auth_OpenID_OPENID2_NS;
const Auth_OpenID_OPENID2_NS
Definition: Message.php:35
+ Here is the call graph for this function:

◆ consumerFromXRDS()

Auth_OpenID_ServiceEndpoint::consumerFromXRDS (   $uri,
  $xrds_text 
)

Definition at line 205 of file Discover.php.

References Auth_OpenID_makeOpenIDEndpoints(), and Auth_Yadis_XRDS\parseXRDS().

207  {
208  $xrds =& Auth_Yadis_XRDS::parseXRDS($xrds_text);
209 
210  if ($xrds) {
211  $yadis_services =
212  $xrds->services(array('filter_MatchesAnyOpenIDConsumerType'));
213  return Auth_OpenID_makeOpenIDEndpoints($uri, $yadis_services);
214  }
215 
216  return null;
static parseXRDS($xml_string, $extra_ns_map=null)
Parse an XML string (XRDS document) and return either a Auth_Yadis_XRDS object or null...
Definition: XRDS.php:276
Auth_OpenID_makeOpenIDEndpoints($uri, $yadis_services)
Definition: Discover.php:444
+ Here is the call graph for this function:

◆ copy()

Auth_OpenID_ServiceEndpoint::copy ( )

Definition at line 292 of file Discover.php.

References Auth_OpenID_ServiceEndpoint().

294  {
295  $x = new Auth_OpenID_ServiceEndpoint();
296 
297  $x->claimed_id = $this->claimed_id;
298  $x->server_url = $this->server_url;
299  $x->type_uris = $this->type_uris;
300  $x->local_id = $this->local_id;
301  $x->canonicalID = $this->canonicalID;
302  $x->used_yadis = $this->used_yadis;
303 
304  return $x;
+ Here is the call graph for this function:

◆ fromDiscoveryResult()

static Auth_OpenID_ServiceEndpoint::fromDiscoveryResult (   $discoveryResult)
static

Definition at line 244 of file Discover.php.

References fromHTML(), and fromXRDS().

246  {
247  if ($discoveryResult->isXRDS()) {
249  $discoveryResult->normalized_uri,
250  $discoveryResult->response_text);
251  } else {
253  $discoveryResult->normalized_uri,
254  $discoveryResult->response_text);
255  }
static fromHTML($uri, $html)
Definition: Discover.php:257
static fromXRDS($uri, $xrds_text)
Definition: Discover.php:224
+ Here is the call graph for this function:

◆ fromHTML()

static Auth_OpenID_ServiceEndpoint::fromHTML (   $uri,
  $html 
)
static

Definition at line 257 of file Discover.php.

References Auth_OpenID_legacy_discover(), Auth_OpenID_ServiceEndpoint(), Auth_OpenID_TYPE_1_1, and Auth_OpenID_TYPE_2_0.

Referenced by Auth_OpenID_discoverWithoutYadis(), Auth_OpenID_discoverWithYadis(), and fromDiscoveryResult().

259  {
260  $discovery_types = array(
261  array(Auth_OpenID_TYPE_2_0,
262  'openid2.provider', 'openid2.local_id'),
263  array(Auth_OpenID_TYPE_1_1,
264  'openid.server', 'openid.delegate')
265  );
266 
267  $services = array();
268 
269  foreach ($discovery_types as $triple) {
270  list($type_uri, $server_rel, $delegate_rel) = $triple;
271 
272  $urls = Auth_OpenID_legacy_discover($html, $server_rel,
273  $delegate_rel);
274 
275  if ($urls === false) {
276  continue;
277  }
278 
279  list($delegate_url, $server_url) = $urls;
280 
281  $service = new Auth_OpenID_ServiceEndpoint();
282  $service->claimed_id = $uri;
283  $service->local_id = $delegate_url;
284  $service->server_url = $server_url;
285  $service->type_uris = array($type_uri);
286 
287  $services[] = $service;
288  }
289 
290  return $services;
Auth_OpenID_legacy_discover($html_text, $server_rel, $delegate_rel)
Definition: Parse.php:359
const Auth_OpenID_TYPE_1_1
Definition: Discover.php:18
const Auth_OpenID_TYPE_2_0
Definition: Discover.php:21
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fromOPEndpointURL()

static Auth_OpenID_ServiceEndpoint::fromOPEndpointURL (   $op_endpoint_url)
static

Definition at line 152 of file Discover.php.

References Auth_OpenID_ServiceEndpoint(), and Auth_OpenID_TYPE_2_0_IDP.

Referenced by Auth_OpenID_GenericConsumer\_verifyDiscoveryResultsOpenID2().

154  {
155  // Construct an OP-Identifier OpenIDServiceEndpoint object for
156  // a given OP Endpoint URL
157  $obj = new Auth_OpenID_ServiceEndpoint();
158  $obj->server_url = $op_endpoint_url;
159  $obj->type_uris = array(Auth_OpenID_TYPE_2_0_IDP);
160  return $obj;
const Auth_OpenID_TYPE_2_0_IDP
Definition: Discover.php:20
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fromXRDS()

static Auth_OpenID_ServiceEndpoint::fromXRDS (   $uri,
  $xrds_text 
)
static

Definition at line 224 of file Discover.php.

References Auth_OpenID_makeOpenIDEndpoints(), and Auth_Yadis_XRDS\parseXRDS().

Referenced by Auth_OpenID_discoverWithYadis(), and fromDiscoveryResult().

226  {
227  $xrds = Auth_Yadis_XRDS::parseXRDS($xrds_text);
228 
229  if ($xrds) {
230  $yadis_services =
231  $xrds->services(array('filter_MatchesAnyOpenIDType'));
232  return Auth_OpenID_makeOpenIDEndpoints($uri, $yadis_services);
233  }
234 
235  return null;
static parseXRDS($xml_string, $extra_ns_map=null)
Parse an XML string (XRDS document) and return either a Auth_Yadis_XRDS object or null...
Definition: XRDS.php:276
Auth_OpenID_makeOpenIDEndpoints($uri, $yadis_services)
Definition: Discover.php:444
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDisplayIdentifier()

Auth_OpenID_ServiceEndpoint::getDisplayIdentifier ( )

Definition at line 75 of file Discover.php.

References $path, and $query.

77  {
78  if ($this->display_identifier) {
79  return $this->display_identifier;
80  }
81  if (! $this->claimed_id) {
82  return $this->claimed_id;
83  }
84  $parsed = parse_url($this->claimed_id);
85  $scheme = $parsed['scheme'];
86  $host = $parsed['host'];
87  $path = $parsed['path'];
88  if (array_key_exists('query', $parsed)) {
89  $query = $parsed['query'];
90  $no_frag = "$scheme://$host$path?$query";
91  } else {
92  $no_frag = "$scheme://$host$path";
93  }
94  return $no_frag;
$path
Definition: index.php:22

◆ getLocalID()

Auth_OpenID_ServiceEndpoint::getLocalID ( )

Definition at line 184 of file Discover.php.

186  {
187  // Return the identifier that should be sent as the
188  // openid.identity_url parameter to the server.
189  if ($this->local_id === null && $this->canonicalID === null) {
190  return $this->claimed_id;
191  } else {
192  if ($this->local_id) {
193  return $this->local_id;
194  } else {
195  return $this->canonicalID;
196  }
197  }

◆ isOPIdentifier()

Auth_OpenID_ServiceEndpoint::isOPIdentifier ( )

Definition at line 147 of file Discover.php.

References Auth_OpenID_TYPE_2_0_IDP.

Referenced by parseService(), and supportsType().

149  {
150  return in_array(Auth_OpenID_TYPE_2_0_IDP, $this->type_uris);
const Auth_OpenID_TYPE_2_0_IDP
Definition: Discover.php:20
+ Here is the caller graph for this function:

◆ matchTypes()

Auth_OpenID_ServiceEndpoint::matchTypes (   $type_uris)

Definition at line 122 of file Discover.php.

References $result, and supportsType().

124  {
125  $result = array();
126  foreach ($type_uris as $test_uri) {
127  if ($this->supportsType($test_uri)) {
128  $result[] = $test_uri;
129  }
130  }
131 
132  return $result;
$result
+ Here is the call graph for this function:

◆ parseService()

Auth_OpenID_ServiceEndpoint::parseService (   $yadis_url,
  $uri,
  $type_uris,
  $service_element 
)

Definition at line 162 of file Discover.php.

References Auth_OpenID_findOPLocalIdentifier(), and isOPIdentifier().

164  {
165  // Set the state of this object based on the contents of the
166  // service element. Return true if successful, false if not
167  // (if findOPLocalIdentifier returns false).
168  $this->type_uris = $type_uris;
169  $this->server_url = $uri;
170  $this->used_yadis = true;
171 
172  if (!$this->isOPIdentifier()) {
173  $this->claimed_id = $yadis_url;
174  $this->local_id = Auth_OpenID_findOPLocalIdentifier(
175  $service_element,
176  $this->type_uris);
177  if ($this->local_id === false) {
178  return false;
179  }
180  }
181 
182  return true;
Auth_OpenID_findOPLocalIdentifier($service, $type_uris)
Definition: Discover.php:307
+ Here is the call graph for this function:

◆ preferredNamespace()

Auth_OpenID_ServiceEndpoint::preferredNamespace ( )

Definition at line 101 of file Discover.php.

References Auth_OpenID_OPENID1_NS, Auth_OpenID_OPENID2_NS, Auth_OpenID_TYPE_2_0, and Auth_OpenID_TYPE_2_0_IDP.

Referenced by compatibilityMode().

103  {
104  if (in_array(Auth_OpenID_TYPE_2_0_IDP, $this->type_uris) ||
105  in_array(Auth_OpenID_TYPE_2_0, $this->type_uris)) {
106  return Auth_OpenID_OPENID2_NS;
107  } else {
108  return Auth_OpenID_OPENID1_NS;
109  }
const Auth_OpenID_TYPE_2_0_IDP
Definition: Discover.php:20
const Auth_OpenID_OPENID2_NS
Definition: Message.php:35
const Auth_OpenID_OPENID1_NS
Definition: Message.php:25
const Auth_OpenID_TYPE_2_0
Definition: Discover.php:21
+ Here is the caller graph for this function:

◆ supportsType()

Auth_OpenID_ServiceEndpoint::supportsType (   $type_uri)

Definition at line 134 of file Discover.php.

References Auth_OpenID_TYPE_2_0, and isOPIdentifier().

Referenced by matchTypes().

136  {
137  // Does this endpoint support this type?
138  return ((in_array($type_uri, $this->type_uris)) ||
139  (($type_uri == Auth_OpenID_TYPE_2_0) &&
140  $this->isOPIdentifier()));
const Auth_OpenID_TYPE_2_0
Definition: Discover.php:21
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ usesExtension()

Auth_OpenID_ServiceEndpoint::usesExtension (   $extension_uri)

Definition at line 96 of file Discover.php.

98  {
99  return in_array($extension_uri, $this->type_uris);

The documentation for this class was generated from the following file: