/openid/Auth/OpenID/Server.php
OpenID server protocol and logic.
Overview
An OpenID server must perform three tasks:
- Examine the incoming request to determine its nature and validity.
- Make a decision about how to respond to this request.
- Format the response according to the protocol.
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_Response 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.
Class | Description |
---|---|
Auth_OpenID_ServerError | An error class which gets instantiated and returned whenever an OpenID protocol error occurs. Be prepared to use this in place of an ordinary server response. |
Auth_OpenID_MalformedReturnURL | An error indicating that the return_to URL is malformed. |
Auth_OpenID_MalformedTrustRoot | This error is returned when the trust_root value is malformed. |
Auth_OpenID_PlainTextServerSession | |
Auth_OpenID_DiffieHellmanServerSession | |
Auth_OpenID_WebResponse | A web-capable response object which you can use to generate a user-agent response. |
Auth_OpenID_Signatory | Responsible for the signature of query data and the verification of OpenID signature values. |
Auth_OpenID_Encoder | Encode an Auth_OpenID_Response to an Auth_OpenID_WebResponse. |
Auth_OpenID_SigningEncoder | An encoder which also takes care of signing fields when required. |
Auth_OpenID_Decoder | Decode an incoming Auth_OpenID_WebResponse into an Auth_OpenID_Request. |
Auth_OpenID_EncodingError | An error that indicates an encoding problem occurred. |
Auth_OpenID_AlreadySigned | An error that indicates that a response was already signed. |
Auth_OpenID_UntrustedReturnURL | An error that indicates that the given return_to is not under the given trust_root. |
Auth_OpenID_Server | An object that implements the OpenID protocol for a single URL. |
Required imports
Documentation generated on Mon, 05 Mar 2007 21:20:49 +0000 by phpDocumentor 1.3.1