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
Source code for file /openid/Auth/OpenID/Interface.php

Documentation is available at Interface.php

  1. <?php
  2.  
  3. /**
  4.  * This file specifies the interface for PHP OpenID store implementations.
  5.  *
  6.  * PHP versions 4 and 5
  7.  *
  8.  * LICENSE: See the COPYING file included in this distribution.
  9.  *
  10.  * @package OpenID
  11.  * @author JanRain, Inc. <[email protected]>
  12.  * @copyright 2005 Janrain, Inc.
  13.  * @license http://www.gnu.org/copyleft/lesser.html LGPL
  14.  */
  15.  
  16. /**
  17.  * This is the interface for the store objects the OpenID library
  18.  * uses. It is a single class that provides all of the persistence
  19.  * mechanisms that the OpenID library needs, for both servers and
  20.  * consumers.  If you want to create an SQL-driven store, please see
  21.  * then {@link Auth_OpenID_SQLStore} class.
  22.  *
  23.  * @package OpenID
  24.  * @author JanRain, Inc. <[email protected]>
  25.  */
  26.     /**
  27.      * @var integer The length of the auth key that should be returned
  28.      *  by the getAuthKey method.
  29.      */
  30.     var $AUTH_KEY_LEN = 20;
  31.  
  32.     /**
  33.      * This method puts an Association object into storage,
  34.      * retrievable by server URL and handle.
  35.      *
  36.      * @param string $server_url The URL of the identity server that
  37.      *  this association is with. Because of the way the server portion
  38.      *  of the library uses this interface, don't assume there are any
  39.      *  limitations on the character set of the input string. In
  40.      *  particular, expect to see unescaped non-url-safe characters in
  41.      *  the server_url field.
  42.      *
  43.      * @param Association $association The Association to store.
  44.      */
  45.     function storeAssociation($server_url$association)
  46.     {
  47.         trigger_error("Auth_OpenID_OpenIDStore::storeAssociation ".
  48.                       "not implemented"E_USER_ERROR);
  49.     }
  50.  
  51.     /**
  52.      * This method returns an Association object from storage that
  53.      * matches the server URL and, if specified, handle. It returns
  54.      * null if no such association is found or if the matching
  55.      * association is expired.
  56.      *
  57.      * If no handle is specified, the store may return any association
  58.      * which matches the server URL. If multiple associations are
  59.      * valid, the recommended return value for this method is the one
  60.      * that will remain valid for the longest duration.
  61.      *
  62.      * This method is allowed (and encouraged) to garbage collect
  63.      * expired associations when found. This method must not return
  64.      * expired associations.
  65.      *
  66.      * @param string $server_url The URL of the identity server to get
  67.      *  the association for. Because of the way the server portion of
  68.      *  the library uses this interface, don't assume there are any
  69.      *  limitations on the character set of the input string.  In
  70.      *  particular, expect to see unescaped non-url-safe characters in
  71.      *  the server_url field.
  72.      *
  73.      * @param mixed $handle This optional parameter is the handle of
  74.      *  the specific association to get. If no specific handle is
  75.      *  provided, any valid association matching the server URL is
  76.      *  returned.
  77.      *
  78.      * @return Association The Association for the given identity
  79.      *  server.
  80.      */
  81.     function getAssociation($server_url$handle null)
  82.     {
  83.         trigger_error("Auth_OpenID_OpenIDStore::getAssociation ".
  84.                       "not implemented"E_USER_ERROR);
  85.     }
  86.  
  87.     /**
  88.      * This method removes the matching association if it's found, and
  89.      * returns whether the association was removed or not.
  90.      *
  91.      * @param string $server_url The URL of the identity server the
  92.      *  association to remove belongs to. Because of the way the server
  93.      *  portion of the library uses this interface, don't assume there
  94.      *  are any limitations on the character set of the input
  95.      *  string. In particular, expect to see unescaped non-url-safe
  96.      *  characters in the server_url field.
  97.      *
  98.      * @param string $handle This is the handle of the association to
  99.      *  remove. If there isn't an association found that matches both
  100.      *  the given URL and handle, then there was no matching handle
  101.      *  found.
  102.      *
  103.      * @return mixed Returns whether or not the given association existed.
  104.      */
  105.     function removeAssociation($server_url$handle)
  106.     {
  107.         trigger_error("Auth_OpenID_OpenIDStore::removeAssociation ".
  108.                       "not implemented"E_USER_ERROR);
  109.     }
  110.  
  111.     /**
  112.      * Stores a nonce. This is used by the consumer to prevent replay
  113.      * attacks.
  114.      *
  115.      * @param string $nonce The nonce to store.
  116.      *
  117.      * @return null 
  118.      */
  119.     function storeNonce($nonce)
  120.     {
  121.         trigger_error("Auth_OpenID_OpenIDStore::storeNonce ".
  122.                       "not implemented"E_USER_ERROR);
  123.     }
  124.  
  125.     /**
  126.      * This method is called when the library is attempting to use a
  127.      * nonce. If the nonce is in the store, this method removes it and
  128.      * returns a value which evaluates as true. Otherwise it returns a
  129.      * value which evaluates as false.
  130.      *
  131.      * This method is allowed and encouraged to treat nonces older
  132.      * than some period (a very conservative window would be 6 hours,
  133.      * for example) as no longer existing, and return False and remove
  134.      * them.
  135.      *
  136.      * @param string $nonce The nonce to use.
  137.      *
  138.      * @return bool Whether or not the nonce was valid.
  139.      */
  140.     function useNonce($nonce)
  141.     {
  142.         trigger_error("Auth_OpenID_OpenIDStore::useNonce ".
  143.                       "not implemented"E_USER_ERROR);
  144.     }
  145.  
  146.     /**
  147.      * This method returns a key used to sign the tokens, to ensure
  148.      * that they haven't been tampered with in transit. It should
  149.      * return the same key every time it is called. The key returned
  150.      * should be {@link AUTH_KEY_LEN} bytes long.
  151.      *
  152.      * @return string The key. It should be {@link AUTH_KEY_LEN} bytes in
  153.      *  length, and use the full range of byte values. That is, it
  154.      *  should be treated as a lump of binary data stored in a string.
  155.      */
  156.     function getAuthKey()
  157.     {
  158.         trigger_error("Auth_OpenID_OpenIDStore::getAuthKey ".
  159.                       "not implemented"E_USER_ERROR);
  160.     }
  161.  
  162.     /**
  163.      * This method must return true if the store is a dumb-mode-style
  164.      * store. Unlike all other methods in this class, this one
  165.      * provides a default implementation, which returns false.
  166.      *
  167.      * In general, any custom subclass of {@link Auth_OpenID_OpenIDStore}
  168.      * won't override this method, as custom subclasses are only likely to
  169.      * be created when the store is fully functional.
  170.      *
  171.      * @return bool true if the store works fully, false if the
  172.      *  consumer will have to use dumb mode to use this store.
  173.      */
  174.     function isDumb()
  175.     {
  176.         return false;
  177.     }
  178.  
  179.     /**
  180.      * Removes all entries from the store; implementation is optional.
  181.      */
  182.     function reset()
  183.     {
  184.     }
  185.  
  186. }
  187. ?>

Documentation generated on Mon, 05 Mar 2007 21:08:44 +0000 by phpDocumentor 1.3.1