Auth_OpenID_Consumer
in package
An OpenID consumer implementation that performs discovery and does session management. See the Consumer.php file documentation for more information.
Table of Contents
- $consumer : Auth_OpenID_GenericConsumer
- $session : Auth_Yadis_PHPSession
- $_token_key : string
- $_token_suffix : mixed
- $discoverMethod : mixed
- $session_key_prefix : mixed
- __construct() : mixed
- Initialize a Consumer instance.
- begin() : Auth_OpenID_AuthRequest
- Start the OpenID authentication process. See steps 1-2 in the overview at the top of this file.
- beginWithoutDiscovery() : Auth_OpenID_AuthRequest|Auth_OpenID_FailureResponse
- 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.
- complete() : Auth_OpenID_ConsumerResponse
- 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.
- getDiscoveryObject() : Auth_Yadis_Discovery
- Used in testing to define the discovery mechanism.
Properties
$consumer
public
Auth_OpenID_GenericConsumer
$consumer
$session
public
Auth_Yadis_PHPSession
$session
$_token_key
private
string
$_token_key
$_token_suffix
private
mixed
$_token_suffix
= "last_token"
$discoverMethod
private
mixed
$discoverMethod
= 'Auth_OpenID_discover'
$session_key_prefix
private
mixed
$session_key_prefix
= "_openid_consumer_"
Methods
__construct()
Initialize a Consumer instance.
public
__construct(Auth_OpenID_OpenIDStore $store[, mixed $session = null ][, string $consumer_cls = null ]) : mixed
You should create a new instance of the Consumer object with every HTTP request that handles OpenID transactions.
Parameters
- $store : Auth_OpenID_OpenIDStore
-
This must be an object that implements the interface in . Several concrete implementations are provided, to cover most common use cases. For stores backed by MySQL, PostgreSQL, or SQLite, see the class and its sublcasses. For a filesystem-backed store, see the module. As a last resort, if it isn't possible for the server to store state at all, an instance of can be used.
- $session : mixed = null
-
An object which implements the interface of the 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.
- $consumer_cls : string = null
-
The name of the class to instantiate when creating the internal consumer object. This is used for testing.
Return values
mixed —begin()
Start the OpenID authentication process. See steps 1-2 in the overview at the top of this file.
public
begin(string $user_url[, bool $anonymous = false ]) : Auth_OpenID_AuthRequest
Parameters
- $user_url : string
-
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.
- $anonymous : bool = false
-
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.
Return values
Auth_OpenID_AuthRequest —$auth_request An object containing the discovered information will be returned, with a method for building a redirect URL to the server, as described in step 3 of the overview. This object may also be used to add extension arguments to the request, using its 'addExtensionArg' method.
beginWithoutDiscovery()
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.
public
beginWithoutDiscovery(Auth_OpenID_ServiceEndpoint $endpoint[, bool $anonymous = false ]) : Auth_OpenID_AuthRequest|Auth_OpenID_FailureResponse
Parameters
- $endpoint : Auth_OpenID_ServiceEndpoint
-
an OpenID service endpoint descriptor.
- $anonymous : bool = false
-
Set to true if you want to perform OpenID without identifiers.
Return values
Auth_OpenID_AuthRequest|Auth_OpenID_FailureResponse —$auth_request An OpenID authentication request object.
complete()
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.
public
complete(string $current_url[, array<string|int, mixed> $query = null ]) : Auth_OpenID_ConsumerResponse
Parameters
- $current_url : string
-
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.
- $query : array<string|int, mixed> = null
-
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.
Return values
Auth_OpenID_ConsumerResponse —$response A instance of an Auth_OpenID_ConsumerResponse subclass. The type of response is indicated by the status attribute, which will be one of SUCCESS, CANCEL, FAILURE, or SETUP_NEEDED.
getDiscoveryObject()
Used in testing to define the discovery mechanism.
public
getDiscoveryObject(Auth_Yadis_PHPSession $session, string $openid_url, string $session_key_prefix) : Auth_Yadis_Discovery
Parameters
- $session : Auth_Yadis_PHPSession
- $openid_url : string
- $session_key_prefix : string