Support Joomla!

Joomla! 1.5 Documentation

Packages

Package: OpenID

Developer Network License

The Joomla! Developer Network content is © copyright 2006 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution- NonCommercial- ShareAlike 2.5

File/openid/Auth/OpenID/Server.php

Description

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 'decodeRequest' and 'encodeResponse' methods of the Auth_OpenID_Server object. 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_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.

Classes
Class Description
 class 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.
 class Auth_OpenID_MalformedReturnURL An error indicating that the return_to URL is malformed.
 class Auth_OpenID_MalformedTrustRoot This error is returned when the trust_root value is malformed.
 class Auth_OpenID_PlainTextServerSession
 class Auth_OpenID_DiffieHellmanServerSession
 class Auth_OpenID_WebResponse A web-capable response object which you can use to generate a user-agent response.
 class Auth_OpenID_Signatory Responsible for the signature of query data and the verification of OpenID signature values.
 class Auth_OpenID_Encoder Encode an Auth_OpenID_Response to an Auth_OpenID_WebResponse.
 class Auth_OpenID_SigningEncoder An encoder which also takes care of signing fields when required.
 class Auth_OpenID_Decoder Decode an incoming Auth_OpenID_WebResponse into an Auth_OpenID_Request.
 class Auth_OpenID_EncodingError An error that indicates an encoding problem occurred.
 class Auth_OpenID_AlreadySigned An error that indicates that a response was already signed.
 class Auth_OpenID_UntrustedReturnURL An error that indicates that the given return_to is not under the given trust_root.
 class Auth_OpenID_Server An object that implements the OpenID protocol for a single URL.
Includes
 require_once ("Auth/OpenID/DiffieHellman.php") (line 98)
 require_once ("Auth/OpenID/KVForm.php") (line 99)
 require_once ("Auth/OpenID/BigMath.php") (line 97)
 require_once ("Auth/OpenID/TrustRoot.php") (line 100)
 require_once ("Auth/OpenID/ServerRequest.php") (line 101)
 require_once ("Auth/OpenID.php") (line 94)

Required imports

 require_once ("Auth/OpenID/CryptUtil.php") (line 96)
 require_once ("Auth/OpenID/Association.php") (line 95)
Constants
AUTH_OPENID_HTTP_ERROR = 400 (line 105)
AUTH_OPENID_HTTP_OK = 200 (line 103)
AUTH_OPENID_HTTP_REDIRECT = 302 (line 104)

Documentation generated on Mon, 05 Mar 2007 21:20:49 +0000 by phpDocumentor 1.3.1