PageRenderTime 44ms CodeModel.GetById 17ms RepoModel.GetById 2ms app.codeStats 0ms

/dist/usr/share/php/Auth/OpenID/Interface.php

https://github.com/osbridge/osbp_automateit
PHP | 197 lines | 46 code | 11 blank | 140 comment | 0 complexity | 421b2e9dc95dbb8ff3fd6502f733422e MD5 | raw file
  1. <?php
  2. /**
  3. * This file specifies the interface for PHP OpenID store implementations.
  4. *
  5. * PHP versions 4 and 5
  6. *
  7. * LICENSE: See the COPYING file included in this distribution.
  8. *
  9. * @package OpenID
  10. * @author JanRain, Inc. <openid@janrain.com>
  11. * @copyright 2005-2008 Janrain, Inc.
  12. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache
  13. */
  14. /**
  15. * This is the interface for the store objects the OpenID library
  16. * uses. It is a single class that provides all of the persistence
  17. * mechanisms that the OpenID library needs, for both servers and
  18. * consumers. If you want to create an SQL-driven store, please see
  19. * then {@link Auth_OpenID_SQLStore} class.
  20. *
  21. * Change: Version 2.0 removed the storeNonce, getAuthKey, and isDumb
  22. * methods, and changed the behavior of the useNonce method to support
  23. * one-way nonces.
  24. *
  25. * @package OpenID
  26. * @author JanRain, Inc. <openid@janrain.com>
  27. */
  28. class Auth_OpenID_OpenIDStore {
  29. /**
  30. * This method puts an Association object into storage,
  31. * retrievable by server URL and handle.
  32. *
  33. * @param string $server_url The URL of the identity server that
  34. * this association is with. Because of the way the server portion
  35. * of the library uses this interface, don't assume there are any
  36. * limitations on the character set of the input string. In
  37. * particular, expect to see unescaped non-url-safe characters in
  38. * the server_url field.
  39. *
  40. * @param Association $association The Association to store.
  41. */
  42. function storeAssociation($server_url, $association)
  43. {
  44. trigger_error("Auth_OpenID_OpenIDStore::storeAssociation ".
  45. "not implemented", E_USER_ERROR);
  46. }
  47. /*
  48. * Remove expired nonces from the store.
  49. *
  50. * Discards any nonce from storage that is old enough that its
  51. * timestamp would not pass useNonce().
  52. *
  53. * This method is not called in the normal operation of the
  54. * library. It provides a way for store admins to keep their
  55. * storage from filling up with expired data.
  56. *
  57. * @return the number of nonces expired
  58. */
  59. function cleanupNonces()
  60. {
  61. trigger_error("Auth_OpenID_OpenIDStore::cleanupNonces ".
  62. "not implemented", E_USER_ERROR);
  63. }
  64. /*
  65. * Remove expired associations from the store.
  66. *
  67. * This method is not called in the normal operation of the
  68. * library. It provides a way for store admins to keep their
  69. * storage from filling up with expired data.
  70. *
  71. * @return the number of associations expired.
  72. */
  73. function cleanupAssociations()
  74. {
  75. trigger_error("Auth_OpenID_OpenIDStore::cleanupAssociations ".
  76. "not implemented", E_USER_ERROR);
  77. }
  78. /*
  79. * Shortcut for cleanupNonces(), cleanupAssociations().
  80. *
  81. * This method is not called in the normal operation of the
  82. * library. It provides a way for store admins to keep their
  83. * storage from filling up with expired data.
  84. */
  85. function cleanup()
  86. {
  87. return array($this->cleanupNonces(),
  88. $this->cleanupAssociations());
  89. }
  90. /**
  91. * Report whether this storage supports cleanup
  92. */
  93. function supportsCleanup()
  94. {
  95. return true;
  96. }
  97. /**
  98. * This method returns an Association object from storage that
  99. * matches the server URL and, if specified, handle. It returns
  100. * null if no such association is found or if the matching
  101. * association is expired.
  102. *
  103. * If no handle is specified, the store may return any association
  104. * which matches the server URL. If multiple associations are
  105. * valid, the recommended return value for this method is the one
  106. * most recently issued.
  107. *
  108. * This method is allowed (and encouraged) to garbage collect
  109. * expired associations when found. This method must not return
  110. * expired associations.
  111. *
  112. * @param string $server_url The URL of the identity server to get
  113. * the association for. Because of the way the server portion of
  114. * the library uses this interface, don't assume there are any
  115. * limitations on the character set of the input string. In
  116. * particular, expect to see unescaped non-url-safe characters in
  117. * the server_url field.
  118. *
  119. * @param mixed $handle This optional parameter is the handle of
  120. * the specific association to get. If no specific handle is
  121. * provided, any valid association matching the server URL is
  122. * returned.
  123. *
  124. * @return Association The Association for the given identity
  125. * server.
  126. */
  127. function getAssociation($server_url, $handle = null)
  128. {
  129. trigger_error("Auth_OpenID_OpenIDStore::getAssociation ".
  130. "not implemented", E_USER_ERROR);
  131. }
  132. /**
  133. * This method removes the matching association if it's found, and
  134. * returns whether the association was removed or not.
  135. *
  136. * @param string $server_url The URL of the identity server the
  137. * association to remove belongs to. Because of the way the server
  138. * portion of the library uses this interface, don't assume there
  139. * are any limitations on the character set of the input
  140. * string. In particular, expect to see unescaped non-url-safe
  141. * characters in the server_url field.
  142. *
  143. * @param string $handle This is the handle of the association to
  144. * remove. If there isn't an association found that matches both
  145. * the given URL and handle, then there was no matching handle
  146. * found.
  147. *
  148. * @return mixed Returns whether or not the given association existed.
  149. */
  150. function removeAssociation($server_url, $handle)
  151. {
  152. trigger_error("Auth_OpenID_OpenIDStore::removeAssociation ".
  153. "not implemented", E_USER_ERROR);
  154. }
  155. /**
  156. * Called when using a nonce.
  157. *
  158. * This method should return C{True} if the nonce has not been
  159. * used before, and store it for a while to make sure nobody
  160. * tries to use the same value again. If the nonce has already
  161. * been used, return C{False}.
  162. *
  163. * Change: In earlier versions, round-trip nonces were used and a
  164. * nonce was only valid if it had been previously stored with
  165. * storeNonce. Version 2.0 uses one-way nonces, requiring a
  166. * different implementation here that does not depend on a
  167. * storeNonce call. (storeNonce is no longer part of the
  168. * interface.
  169. *
  170. * @param string $nonce The nonce to use.
  171. *
  172. * @return bool Whether or not the nonce was valid.
  173. */
  174. function useNonce($server_url, $timestamp, $salt)
  175. {
  176. trigger_error("Auth_OpenID_OpenIDStore::useNonce ".
  177. "not implemented", E_USER_ERROR);
  178. }
  179. /**
  180. * Removes all entries from the store; implementation is optional.
  181. */
  182. function reset()
  183. {
  184. }
  185. }
  186. ?>