Öffentliche Methoden | |
Auth_OpenID_Consumer (&$store, $session=null, $consumer_cls=null) | |
getDiscoveryObject (&$session, $openid_url, $session_key_prefix) | |
begin ($user_url, $anonymous=false) | |
& | beginWithoutDiscovery ($endpoint, $anonymous=false) |
complete ($current_url, $query=null) | |
Datenfelder | |
$discoverMethod = 'Auth_OpenID_discover' | |
$session_key_prefix = "_openid_consumer_" | |
$_token_suffix = "last_token" |
Definiert in Zeile 215 der Datei Consumer.php.
Auth_OpenID_Consumer | ( | &$ | store, | |
$ | session = null , |
|||
$ | consumer_cls = null | |||
) |
Initialize a Consumer instance.
You should create a new instance of the Consumer object with every HTTP request that handles OpenID transactions.
Auth_OpenID_OpenIDStore | $store This must be an object that implements the interface in Auth_OpenID_OpenIDStore. Several concrete implementations are provided, to cover most common use cases. For stores backed by MySQL, PostgreSQL, or SQLite, see the Auth_OpenID_SQLStore class and its sublcasses. For a filesystem-backed store, see the Auth_OpenID_FileStore module. As a last resort, if it isn't possible for the server to store state at all, an instance of Auth_OpenID_DumbStore can be used. | |
mixed | $session An object which implements the interface of the Auth_Yadis_PHPSession class. Particularly, this object is expected to have these methods: get($key), set($key), $value), and del($key). This defaults to a session object which wraps PHP's native session machinery. You should only need to pass something here if you have your own sessioning implementation. | |
str | $consumer_cls The name of the class to instantiate when creating the internal consumer object. This is used for testing. |
Definiert in Zeile 261 der Datei Consumer.php.
00263 { 00264 if ($session === null) { 00265 $session = new Auth_Yadis_PHPSession(); 00266 } 00267 00268 $this->session =& $session; 00269 00270 if ($consumer_cls !== null) { 00271 $this->consumer =& new $consumer_cls($store); 00272 } else { 00273 $this->consumer =& new Auth_OpenID_GenericConsumer($store); 00274 } 00275 00276 $this->_token_key = $this->session_key_prefix . $this->_token_suffix; 00277 }
begin | ( | $ | user_url, | |
$ | anonymous = false | |||
) |
Start the OpenID authentication process. See steps 1-2 in the overview at the top of this file.
string | $user_url Identity URL given by the user. This method performs a textual transformation of the URL to try and make sure it is normalized. For example, a user_url of example.com will be normalized to http://example.com/ normalizing and resolving any redirects the server might issue. | |
bool | $anonymous True if the OpenID request is to be sent to the server without any identifier information. Use this when you want to transport data but don't want to do OpenID authentication with identifiers. |
Definiert in Zeile 313 der Datei Consumer.php.
00314 { 00315 $openid_url = $user_url; 00316 00317 $disco = $this->getDiscoveryObject($this->session, 00318 $openid_url, 00319 $this->session_key_prefix); 00320 00321 // Set the 'stale' attribute of the manager. If discovery 00322 // fails in a fatal way, the stale flag will cause the manager 00323 // to be cleaned up next time discovery is attempted. 00324 00325 $m = $disco->getManager(); 00326 $loader = new Auth_Yadis_ManagerLoader(); 00327 00328 if ($m) { 00329 if ($m->stale) { 00330 $disco->destroyManager(); 00331 } else { 00332 $m->stale = true; 00333 $disco->session->set($disco->session_key, 00334 serialize($loader->toSession($m))); 00335 } 00336 } 00337 00338 $endpoint = $disco->getNextService($this->discoverMethod, 00339 $this->consumer->fetcher); 00340 00341 // Reset the 'stale' attribute of the manager. 00342 $m =& $disco->getManager(); 00343 if ($m) { 00344 $m->stale = false; 00345 $disco->session->set($disco->session_key, 00346 serialize($loader->toSession($m))); 00347 } 00348 00349 if ($endpoint === null) { 00350 return null; 00351 } else { 00352 return $this->beginWithoutDiscovery($endpoint, 00353 $anonymous); 00354 } 00355 }
& beginWithoutDiscovery | ( | $ | endpoint, | |
$ | anonymous = false | |||
) |
Start OpenID verification without doing OpenID server discovery. This method is used internally by Consumer.begin after discovery is performed, and exists to provide an interface for library users needing to perform their own discovery.
Auth_OpenID_ServiceEndpoint | $endpoint an OpenID service endpoint descriptor. | |
bool | anonymous Set to true if you want to perform OpenID without identifiers. |
Definiert in Zeile 373 der Datei Consumer.php.
00374 { 00375 $loader = new Auth_OpenID_ServiceEndpointLoader(); 00376 $auth_req = $this->consumer->begin($endpoint); 00377 $this->session->set($this->_token_key, 00378 $loader->toSession($auth_req->endpoint)); 00379 if (!$auth_req->setAnonymous($anonymous)) { 00380 return new Auth_OpenID_FailureResponse(null, 00381 "OpenID 1 requests MUST include the identifier " . 00382 "in the request."); 00383 } 00384 return $auth_req; 00385 }
complete | ( | $ | current_url, | |
$ | query = null | |||
) |
Called to interpret the server's response to an OpenID request. It is called in step 4 of the flow described in the consumer overview.
string | $current_url The URL used to invoke the application. Extract the URL from your application's web request framework and specify it here to have it checked against the openid.current_url value in the response. If the current_url URL check fails, the status of the completion will be FAILURE. | |
array | $query An array of the query parameters (key => value pairs) for this HTTP request. Defaults to null. If null, the GET or POST data are automatically gotten from the PHP environment. It is only useful to override $query for testing. |
Definiert in Zeile 410 der Datei Consumer.php.
00411 { 00412 if ($current_url && !is_string($current_url)) { 00413 // This is ugly, but we need to complain loudly when 00414 // someone uses the API incorrectly. 00415 trigger_error("current_url must be a string; see NEWS file " . 00416 "for upgrading notes.", 00417 E_USER_ERROR); 00418 } 00419 00420 if ($query === null) { 00421 $query = Auth_OpenID::getQuery(); 00422 } 00423 00424 $loader = new Auth_OpenID_ServiceEndpointLoader(); 00425 $endpoint_data = $this->session->get($this->_token_key); 00426 $endpoint = 00427 $loader->fromSession($endpoint_data); 00428 00429 $message = Auth_OpenID_Message::fromPostArgs($query); 00430 $response = $this->consumer->complete($message, $endpoint, 00431 $current_url); 00432 $this->session->del($this->_token_key); 00433 00434 if (in_array($response->status, array(Auth_OpenID_SUCCESS, 00435 Auth_OpenID_CANCEL))) { 00436 if ($response->identity_url !== null) { 00437 $disco = $this->getDiscoveryObject($this->session, 00438 $response->identity_url, 00439 $this->session_key_prefix); 00440 $disco->cleanup(true); 00441 } 00442 } 00443 00444 return $response; 00445 }
getDiscoveryObject | ( | &$ | session, | |
$ | openid_url, | |||
$ | session_key_prefix | |||
) |
Used in testing to define the discovery mechanism.
private
Definiert in Zeile 284 der Datei Consumer.php.
00286 { 00287 return new Auth_Yadis_Discovery($session, $openid_url, 00288 $session_key_prefix); 00289 }
$_token_suffix = "last_token" |
private
Definiert in Zeile 230 der Datei Consumer.php.
$discoverMethod = 'Auth_OpenID_discover' |
private
Definiert in Zeile 220 der Datei Consumer.php.
$session_key_prefix = "_openid_consumer_" |
private
Definiert in Zeile 225 der Datei Consumer.php.
Copyright © 2003 - 2009 MyOOS [Shopsystem]. All rights reserved. MyOOS [Shopsystem] is Free Software released under the GNU/GPL License. Webmaster: info@r23.de (Impressum) |
|