Auth_OpenID_OpenIDStore.html 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  1. <?xml version="1.0" encoding="iso-8859-1"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <!-- template designed by Marco Von Ballmoos -->
  6. <title>Docs For Class Auth_OpenID_OpenIDStore</title>
  7. <link rel="stylesheet" href="../media/stylesheet.css" />
  8. <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
  9. </head>
  10. <body>
  11. <div class="page-body">
  12. <h2 class="class-name">Class Auth_OpenID_OpenIDStore</h2>
  13. <a name="sec-description"></a>
  14. <div class="info-box">
  15. <div class="info-box-title">Description</div>
  16. <div class="nav-bar">
  17. <span class="disabled">Description</span> |
  18. <a href="#sec-descendents">Descendents</a>
  19. | <a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
  20. </div>
  21. <div class="info-box-body">
  22. <!-- ========== Info from phpDoc block ========= -->
  23. <p class="short-description">This is the interface for the store objects the OpenID library</p>
  24. <p class="description"><p>uses. It is a single class that provides all of the persistence mechanisms that the OpenID library needs, for both servers and consumers. If you want to create an SQL-driven store, please see then <a href="../OpenID/Auth_OpenID_SQLStore.html">Auth_OpenID_SQLStore</a> class.</p><p>Change: Version 2.0 removed the storeNonce, getAuthKey, and isDumb methods, and changed the behavior of the useNonce method to support one-way nonces.</p></p>
  25. <ul class="tags">
  26. <li><span class="field">author:</span> JanRain, Inc. &lt;<a href="mailto:openid@janrain.com">openid@janrain.com</a>&gt;</li>
  27. </ul>
  28. <p class="notes">
  29. Located in <a class="field" href="_Auth---OpenID---Interface.php.html">/Auth/OpenID/Interface.php</a> (line <span class="field">30</span>)
  30. </p>
  31. <pre></pre>
  32. </div>
  33. </div>
  34. <a name="sec-descendents"></a>
  35. <div class="info-box">
  36. <div class="info-box-title">Direct descendents</div>
  37. <div class="nav-bar">
  38. <a href="#sec-description">Description</a> |
  39. <span class="disabled">Descendents</span>
  40. | <a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
  41. </div>
  42. <div class="info-box-body">
  43. <table cellpadding="2" cellspacing="0" class="class-table">
  44. <tr>
  45. <th class="class-table-header">Class</th>
  46. <th class="class-table-header">Description</th>
  47. </tr>
  48. <tr>
  49. <td style="padding-right: 2em"><a href="../OpenID/Auth_OpenID_DumbStore.html">Auth_OpenID_DumbStore</a></td>
  50. <td>
  51. This is a store for use in the worst case, when you have no way of saving state on the consumer site. Using this store makes the consumer vulnerable to replay attacks, as it's unable to use nonces. Avoid using this store if it is at all possible.
  52. </td>
  53. </tr>
  54. <tr>
  55. <td style="padding-right: 2em"><a href="../OpenID/Auth_OpenID_FileStore.html">Auth_OpenID_FileStore</a></td>
  56. <td>
  57. This is a filesystem-based store for OpenID associations and
  58. </td>
  59. </tr>
  60. <tr>
  61. <td style="padding-right: 2em"><a href="../OpenID/Auth_OpenID_SQLStore.html">Auth_OpenID_SQLStore</a></td>
  62. <td>
  63. This is the parent class for the SQL stores, which contains the logic common to all of the SQL stores.
  64. </td>
  65. </tr>
  66. <tr>
  67. <td style="padding-right: 2em"><a href="../OpenID/Auth_OpenID_MemcachedStore.html">Auth_OpenID_MemcachedStore</a></td>
  68. <td>
  69. This is a memcached-based store for OpenID associations and nonces.
  70. </td>
  71. </tr>
  72. </table>
  73. </div>
  74. </div>
  75. <a name="sec-method-summary"></a>
  76. <div class="info-box">
  77. <div class="info-box-title">Method Summary</span></div>
  78. <div class="nav-bar">
  79. <a href="#sec-description">Description</a> |
  80. <a href="#sec-descendents">Descendents</a> |
  81. <span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
  82. </div>
  83. <div class="info-box-body">
  84. <div class="method-summary">
  85. <div class="method-definition">
  86. <span class="method-result">void</span>
  87. <a href="#cleanup" title="details" class="method-name">cleanup</a>
  88. ()
  89. </div>
  90. <div class="method-definition">
  91. <span class="method-result">void</span>
  92. <a href="#cleanupAssociations" title="details" class="method-name">cleanupAssociations</a>
  93. ()
  94. </div>
  95. <div class="method-definition">
  96. <span class="method-result">void</span>
  97. <a href="#cleanupNonces" title="details" class="method-name">cleanupNonces</a>
  98. ()
  99. </div>
  100. <div class="method-definition">
  101. <span class="method-result">Association</span>
  102. <a href="#getAssociation" title="details" class="method-name">getAssociation</a>
  103. (<span class="var-type">string</span>&nbsp;<span class="var-name">$server_url</span>, [<span class="var-type">mixed</span>&nbsp;<span class="var-name">$handle</span> = <span class="var-default">null</span>])
  104. </div>
  105. <div class="method-definition">
  106. <span class="method-result">mixed</span>
  107. <a href="#removeAssociation" title="details" class="method-name">removeAssociation</a>
  108. (<span class="var-type">string</span>&nbsp;<span class="var-name">$server_url</span>, <span class="var-type">string</span>&nbsp;<span class="var-name">$handle</span>)
  109. </div>
  110. <div class="method-definition">
  111. <span class="method-result">void</span>
  112. <a href="#reset" title="details" class="method-name">reset</a>
  113. ()
  114. </div>
  115. <div class="method-definition">
  116. <span class="method-result">void</span>
  117. <a href="#storeAssociation" title="details" class="method-name">storeAssociation</a>
  118. (<span class="var-type">string</span>&nbsp;<span class="var-name">$server_url</span>, <span class="var-type">Association</span>&nbsp;<span class="var-name">$association</span>)
  119. </div>
  120. <div class="method-definition">
  121. <span class="method-result">void</span>
  122. <a href="#supportsCleanup" title="details" class="method-name">supportsCleanup</a>
  123. ()
  124. </div>
  125. <div class="method-definition">
  126. <span class="method-result">bool</span>
  127. <a href="#useNonce" title="details" class="method-name">useNonce</a>
  128. (<span class="var-type"></span>&nbsp;<span class="var-name">$server_url</span>, <span class="var-type"></span>&nbsp;<span class="var-name">$timestamp</span>, <span class="var-type"></span>&nbsp;<span class="var-name">$salt</span>, <span class="var-type">string</span>&nbsp;<span class="var-name">$nonce</span>)
  129. </div>
  130. </div>
  131. </div>
  132. </div>
  133. <a name="sec-methods"></a>
  134. <div class="info-box">
  135. <div class="info-box-title">Methods</div>
  136. <div class="nav-bar">
  137. <a href="#sec-description">Description</a> |
  138. <a href="#sec-descendents">Descendents</a> |
  139. <a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
  140. </div>
  141. <div class="info-box-body">
  142. <A NAME='method_detail'></A>
  143. <a name="methodcleanup" id="cleanup"><!-- --></a>
  144. <div class="oddrow">
  145. <div class="method-header">
  146. <span class="method-title">cleanup</span> (line <span class="line-number">90</span>)
  147. </div>
  148. <!-- ========== Info from phpDoc block ========= -->
  149. <div class="method-signature">
  150. <span class="method-result">void</span>
  151. <span class="method-name">
  152. cleanup
  153. </span>
  154. ()
  155. </div>
  156. </div>
  157. <a name="methodcleanupAssociations" id="cleanupAssociations"><!-- --></a>
  158. <div class="evenrow">
  159. <div class="method-header">
  160. <span class="method-title">cleanupAssociations</span> (line <span class="line-number">77</span>)
  161. </div>
  162. <!-- ========== Info from phpDoc block ========= -->
  163. <div class="method-signature">
  164. <span class="method-result">void</span>
  165. <span class="method-name">
  166. cleanupAssociations
  167. </span>
  168. ()
  169. </div>
  170. <hr class="separator" />
  171. <div class="notes">Redefined in descendants as:</div>
  172. <ul class="redefinitions">
  173. <li>
  174. <a href="../OpenID/Auth_OpenID_FileStore.html#methodcleanupAssociations">Auth_OpenID_FileStore::cleanupAssociations()</a>
  175. </li>
  176. <li>
  177. <a href="../OpenID/Auth_OpenID_SQLStore.html#methodcleanupAssociations">Auth_OpenID_SQLStore::cleanupAssociations()</a>
  178. </li>
  179. </ul>
  180. </div>
  181. <a name="methodcleanupNonces" id="cleanupNonces"><!-- --></a>
  182. <div class="oddrow">
  183. <div class="method-header">
  184. <span class="method-title">cleanupNonces</span> (line <span class="line-number">62</span>)
  185. </div>
  186. <!-- ========== Info from phpDoc block ========= -->
  187. <div class="method-signature">
  188. <span class="method-result">void</span>
  189. <span class="method-name">
  190. cleanupNonces
  191. </span>
  192. ()
  193. </div>
  194. <hr class="separator" />
  195. <div class="notes">Redefined in descendants as:</div>
  196. <ul class="redefinitions">
  197. <li>
  198. <a href="../OpenID/Auth_OpenID_FileStore.html#methodcleanupNonces">Auth_OpenID_FileStore::cleanupNonces()</a>
  199. </li>
  200. <li>
  201. <a href="../OpenID/Auth_OpenID_SQLStore.html#methodcleanupNonces">Auth_OpenID_SQLStore::cleanupNonces()</a>
  202. </li>
  203. </ul>
  204. </div>
  205. <a name="methodgetAssociation" id="getAssociation"><!-- --></a>
  206. <div class="evenrow">
  207. <div class="method-header">
  208. <span class="method-title">getAssociation</span> (line <span class="line-number">134</span>)
  209. </div>
  210. <!-- ========== Info from phpDoc block ========= -->
  211. <p class="short-description">This method returns an Association object from storage that matches the server URL and, if specified, handle. It returns null if no such association is found or if the matching association is expired.</p>
  212. <p class="description"><p>If no handle is specified, the store may return any association which matches the server URL. If multiple associations are valid, the recommended return value for this method is the one most recently issued.</p><p>This method is allowed (and encouraged) to garbage collect expired associations when found. This method must not return expired associations.</p></p>
  213. <ul class="tags">
  214. <li><span class="field">return:</span> The Association for the given identity server.</li>
  215. </ul>
  216. <div class="method-signature">
  217. <span class="method-result">Association</span>
  218. <span class="method-name">
  219. getAssociation
  220. </span>
  221. (<span class="var-type">string</span>&nbsp;<span class="var-name">$server_url</span>, [<span class="var-type">mixed</span>&nbsp;<span class="var-name">$handle</span> = <span class="var-default">null</span>])
  222. </div>
  223. <ul class="parameters">
  224. <li>
  225. <span class="var-type">string</span>
  226. <span class="var-name">$server_url</span><span class="var-description">: The URL of the identity server to get the association for. Because of the way the server portion of the library uses this interface, don't assume there are any limitations on the character set of the input string. In particular, expect to see unescaped non-url-safe characters in the server_url field.</span> </li>
  227. <li>
  228. <span class="var-type">mixed</span>
  229. <span class="var-name">$handle</span><span class="var-description">: This optional parameter is the handle of the specific association to get. If no specific handle is provided, any valid association matching the server URL is returned.</span> </li>
  230. </ul>
  231. <hr class="separator" />
  232. <div class="notes">Redefined in descendants as:</div>
  233. <ul class="redefinitions">
  234. <li>
  235. <a href="../OpenID/Auth_OpenID_DumbStore.html#methodgetAssociation">Auth_OpenID_DumbStore::getAssociation()</a>
  236. : This implementation always returns null.
  237. </li>
  238. <li>
  239. <a href="../OpenID/Auth_OpenID_FileStore.html#methodgetAssociation">Auth_OpenID_FileStore::getAssociation()</a>
  240. : Retrieve an association. If no handle is specified, return the association with the most recent issue time.
  241. </li>
  242. <li>
  243. <a href="../OpenID/Auth_OpenID_SQLStore.html#methodgetAssociation">Auth_OpenID_SQLStore::getAssociation()</a>
  244. </li>
  245. <li>
  246. <a href="../OpenID/Auth_OpenID_MemcachedStore.html#methodgetAssociation">Auth_OpenID_MemcachedStore::getAssociation()</a>
  247. : Read association from memcached. If no handle given
  248. </li>
  249. </ul>
  250. </div>
  251. <a name="methodremoveAssociation" id="removeAssociation"><!-- --></a>
  252. <div class="oddrow">
  253. <div class="method-header">
  254. <span class="method-title">removeAssociation</span> (line <span class="line-number">158</span>)
  255. </div>
  256. <!-- ========== Info from phpDoc block ========= -->
  257. <p class="short-description">This method removes the matching association if it's found, and returns whether the association was removed or not.</p>
  258. <ul class="tags">
  259. <li><span class="field">return:</span> Returns whether or not the given association existed.</li>
  260. </ul>
  261. <div class="method-signature">
  262. <span class="method-result">mixed</span>
  263. <span class="method-name">
  264. removeAssociation
  265. </span>
  266. (<span class="var-type">string</span>&nbsp;<span class="var-name">$server_url</span>, <span class="var-type">string</span>&nbsp;<span class="var-name">$handle</span>)
  267. </div>
  268. <ul class="parameters">
  269. <li>
  270. <span class="var-type">string</span>
  271. <span class="var-name">$server_url</span><span class="var-description">: The URL of the identity server the association to remove belongs to. Because of the way the server portion of the library uses this interface, don't assume there are any limitations on the character set of the input string. In particular, expect to see unescaped non-url-safe characters in the server_url field.</span> </li>
  272. <li>
  273. <span class="var-type">string</span>
  274. <span class="var-name">$handle</span><span class="var-description">: This is the handle of the association to remove. If there isn't an association found that matches both the given URL and handle, then there was no matching handle found.</span> </li>
  275. </ul>
  276. <hr class="separator" />
  277. <div class="notes">Redefined in descendants as:</div>
  278. <ul class="redefinitions">
  279. <li>
  280. <a href="../OpenID/Auth_OpenID_DumbStore.html#methodremoveAssociation">Auth_OpenID_DumbStore::removeAssociation()</a>
  281. : This implementation always returns false.
  282. </li>
  283. <li>
  284. <a href="../OpenID/Auth_OpenID_FileStore.html#methodremoveAssociation">Auth_OpenID_FileStore::removeAssociation()</a>
  285. : Remove an association if it exists. Do nothing if it does not.
  286. </li>
  287. <li>
  288. <a href="../OpenID/Auth_OpenID_SQLStore.html#methodremoveAssociation">Auth_OpenID_SQLStore::removeAssociation()</a>
  289. </li>
  290. <li>
  291. <a href="../OpenID/Auth_OpenID_MemcachedStore.html#methodremoveAssociation">Auth_OpenID_MemcachedStore::removeAssociation()</a>
  292. : Immediately delete association from memcache.
  293. </li>
  294. </ul>
  295. </div>
  296. <a name="methodreset" id="reset"><!-- --></a>
  297. <div class="evenrow">
  298. <div class="method-header">
  299. <span class="method-title">reset</span> (line <span class="line-number">192</span>)
  300. </div>
  301. <!-- ========== Info from phpDoc block ========= -->
  302. <p class="short-description">Removes all entries from the store; implementation is optional.</p>
  303. <div class="method-signature">
  304. <span class="method-result">void</span>
  305. <span class="method-name">
  306. reset
  307. </span>
  308. ()
  309. </div>
  310. <hr class="separator" />
  311. <div class="notes">Redefined in descendants as:</div>
  312. <ul class="redefinitions">
  313. <li>
  314. <a href="../OpenID/Auth_OpenID_SQLStore.html#methodreset">Auth_OpenID_SQLStore::reset()</a>
  315. : Resets the store by removing all records from the store's tables.
  316. </li>
  317. </ul>
  318. </div>
  319. <a name="methodstoreAssociation" id="storeAssociation"><!-- --></a>
  320. <div class="oddrow">
  321. <div class="method-header">
  322. <span class="method-title">storeAssociation</span> (line <span class="line-number">44</span>)
  323. </div>
  324. <!-- ========== Info from phpDoc block ========= -->
  325. <p class="short-description">This method puts an Association object into storage, retrievable by server URL and handle.</p>
  326. <div class="method-signature">
  327. <span class="method-result">void</span>
  328. <span class="method-name">
  329. storeAssociation
  330. </span>
  331. (<span class="var-type">string</span>&nbsp;<span class="var-name">$server_url</span>, <span class="var-type">Association</span>&nbsp;<span class="var-name">$association</span>)
  332. </div>
  333. <ul class="parameters">
  334. <li>
  335. <span class="var-type">string</span>
  336. <span class="var-name">$server_url</span><span class="var-description">: The URL of the identity server that this association is with. Because of the way the server portion of the library uses this interface, don't assume there are any limitations on the character set of the input string. In particular, expect to see unescaped non-url-safe characters in the server_url field.</span> </li>
  337. <li>
  338. <span class="var-type">Association</span>
  339. <span class="var-name">$association</span><span class="var-description">: The Association to store.</span> </li>
  340. </ul>
  341. <hr class="separator" />
  342. <div class="notes">Redefined in descendants as:</div>
  343. <ul class="redefinitions">
  344. <li>
  345. <a href="../OpenID/Auth_OpenID_DumbStore.html#methodstoreAssociation">Auth_OpenID_DumbStore::storeAssociation()</a>
  346. : This implementation does nothing.
  347. </li>
  348. <li>
  349. <a href="../OpenID/Auth_OpenID_FileStore.html#methodstoreAssociation">Auth_OpenID_FileStore::storeAssociation()</a>
  350. : Store an association in the association directory.
  351. </li>
  352. <li>
  353. <a href="../OpenID/Auth_OpenID_SQLStore.html#methodstoreAssociation">Auth_OpenID_SQLStore::storeAssociation()</a>
  354. </li>
  355. <li>
  356. <a href="../OpenID/Auth_OpenID_MemcachedStore.html#methodstoreAssociation">Auth_OpenID_MemcachedStore::storeAssociation()</a>
  357. : Store association until its expiration time in memcached.
  358. </li>
  359. </ul>
  360. </div>
  361. <a name="methodsupportsCleanup" id="supportsCleanup"><!-- --></a>
  362. <div class="evenrow">
  363. <div class="method-header">
  364. <span class="method-title">supportsCleanup</span> (line <span class="line-number">99</span>)
  365. </div>
  366. <!-- ========== Info from phpDoc block ========= -->
  367. <p class="short-description">Report whether this storage supports cleanup</p>
  368. <div class="method-signature">
  369. <span class="method-result">void</span>
  370. <span class="method-name">
  371. supportsCleanup
  372. </span>
  373. ()
  374. </div>
  375. <hr class="separator" />
  376. <div class="notes">Redefined in descendants as:</div>
  377. <ul class="redefinitions">
  378. <li>
  379. <a href="../OpenID/Auth_OpenID_MemcachedStore.html#methodsupportsCleanup">Auth_OpenID_MemcachedStore::supportsCleanup()</a>
  380. : Report that this storage doesn't support cleanup
  381. </li>
  382. </ul>
  383. </div>
  384. <a name="methoduseNonce" id="useNonce"><!-- --></a>
  385. <div class="oddrow">
  386. <div class="method-header">
  387. <span class="method-title">useNonce</span> (line <span class="line-number">183</span>)
  388. </div>
  389. <!-- ========== Info from phpDoc block ========= -->
  390. <p class="short-description">Called when using a nonce.</p>
  391. <p class="description"><p>This method should return C{True} if the nonce has not been used before, and store it for a while to make sure nobody tries to use the same value again. If the nonce has already been used, return C{False}.</p><p>Change: In earlier versions, round-trip nonces were used and a nonce was only valid if it had been previously stored with storeNonce. Version 2.0 uses one-way nonces, requiring a different implementation here that does not depend on a storeNonce call. (storeNonce is no longer part of the interface.</p></p>
  392. <ul class="tags">
  393. <li><span class="field">return:</span> Whether or not the nonce was valid.</li>
  394. </ul>
  395. <div class="method-signature">
  396. <span class="method-result">bool</span>
  397. <span class="method-name">
  398. useNonce
  399. </span>
  400. (<span class="var-type"></span>&nbsp;<span class="var-name">$server_url</span>, <span class="var-type"></span>&nbsp;<span class="var-name">$timestamp</span>, <span class="var-type"></span>&nbsp;<span class="var-name">$salt</span>, <span class="var-type">string</span>&nbsp;<span class="var-name">$nonce</span>)
  401. </div>
  402. <ul class="parameters">
  403. <li>
  404. <span class="var-type">string</span>
  405. <span class="var-name">$nonce</span><span class="var-description">: The nonce to use.</span> </li>
  406. <li>
  407. <span class="var-type"></span>
  408. <span class="var-name">$server_url</span> </li>
  409. <li>
  410. <span class="var-type"></span>
  411. <span class="var-name">$timestamp</span> </li>
  412. <li>
  413. <span class="var-type"></span>
  414. <span class="var-name">$salt</span> </li>
  415. </ul>
  416. <hr class="separator" />
  417. <div class="notes">Redefined in descendants as:</div>
  418. <ul class="redefinitions">
  419. <li>
  420. <a href="../OpenID/Auth_OpenID_DumbStore.html#methoduseNonce">Auth_OpenID_DumbStore::useNonce()</a>
  421. : In a system truly limited to dumb mode, nonces must all be accepted. This therefore always returns true, which makes replay attacks feasible.
  422. </li>
  423. <li>
  424. <a href="../OpenID/Auth_OpenID_FileStore.html#methoduseNonce">Auth_OpenID_FileStore::useNonce()</a>
  425. : Return whether this nonce is present. As a side effect, mark it as no longer present.
  426. </li>
  427. <li>
  428. <a href="../OpenID/Auth_OpenID_SQLStore.html#methoduseNonce">Auth_OpenID_SQLStore::useNonce()</a>
  429. </li>
  430. <li>
  431. <a href="../OpenID/Auth_OpenID_MemcachedStore.html#methoduseNonce">Auth_OpenID_MemcachedStore::useNonce()</a>
  432. : Create nonce for server and salt, expiring after $Auth_OpenID_SKEW seconds.
  433. </li>
  434. </ul>
  435. </div>
  436. </div>
  437. </div>
  438. <p class="notes" id="credit">
  439. Documentation generated on Tue, 21 Apr 2009 11:31:31 -0700 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.3.2</a>
  440. </p>
  441. </div></body>
  442. </html>