Go to the source code of this file.
private
Definition at line 130 of file Server.php.
private
Definition at line 120 of file Server.php.
private
Definition at line 125 of file Server.php.
Definition at line 108 of file Server.php.
enum AUTH_OPENID_HTTP_OK |
OpenID server protocol and logic.
Overview
An OpenID server must perform three tasks:
1. Examine the incoming request to determine its nature and validity. 2. Make a decision about how to respond to this request. 3. Format the response according to the protocol.
The first and last of these tasks may performed by the Auth_OpenID_Server::decodeRequest() and Auth_OpenID_Server::encodeResponse methods. Who gets to do the intermediate task -- deciding how to respond to the request -- will depend on what type of request it is.
If it's a request to authenticate a user (a 'checkid_setup' or 'checkid_immediate' request), you need to decide if you will assert that this user may claim the identity in question. Exactly how you do that is a matter of application policy, but it generally involves making sure the user has an account with your system and is logged in, checking to see if that identity is hers to claim, and verifying with the user that she does consent to releasing that information to the party making the request.
Examine the properties of the Auth_OpenID_CheckIDRequest object, and if and when you've come to a decision, form a response by calling Auth_OpenID_CheckIDRequest::answer().
Other types of requests relate to establishing associations between client and server and verifing the authenticity of previous communications. Auth_OpenID_Server contains all the logic and data necessary to respond to such requests; just pass it to Auth_OpenID_Server::handleRequest().
OpenID Extensions
Do you want to provide other information for your users in addition to authentication? Version 1.2 of the OpenID protocol allows consumers to add extensions to their requests. For example, with sites using the Simple Registration Extension (http://www.openidenabled.com/openid/simple-registration-extension/), a user can agree to have their nickname and e-mail address sent to a site when they sign up.
Since extensions do not change the way OpenID authentication works, code to handle extension requests may be completely separate from the Auth_OpenID_Request class here. But you'll likely want data sent back by your extension to be signed. Auth_OpenID_ServerResponse provides methods with which you can add data to it which can be signed with the other data in the OpenID signature.
For example:
// when request is a checkid_* request $response = $request->answer(true); // this will a signed 'openid.sreg.timezone' parameter to the response response.addField('sreg', 'timezone', 'America/Los_Angeles')
Stores
The OpenID server needs to maintain state between requests in order to function. Its mechanism for doing this is called a store. The store interface is defined in Interface.php. Additionally, several concrete store implementations are provided, so that most sites won't need to implement a custom store. For a store backed by flat files on disk, see Auth_OpenID_FileStore. For stores based on MySQL, SQLite, or PostgreSQL, see the Auth_OpenID_SQLStore subclasses.
Upgrading
The keys by which a server looks up associations in its store have changed in version 1.2 of this library. If your store has entries created from version 1.0 code, you should empty it.
PHP versions 4 and 5
LICENSE: See the COPYING file included in this distribution.
Definition at line 106 of file Server.php.
Definition at line 107 of file Server.php.
Auth_OpenID_isError | ( | $ | obj, | |
$ | cls = 'Auth_OpenID_ServerError' | |||
) |
private
Definition at line 135 of file Server.php.
$_Auth_OpenID_Request_Modes |
Initial value:
array('checkid_setup', 'checkid_immediate')
Definition at line 113 of file Server.php.