Storage.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_OpenId
  17. * @subpackage Zend_OpenId_Provider
  18. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. /**
  23. * Abstract class to implement external storage for OpenID consumer
  24. *
  25. * @category Zend
  26. * @package Zend_OpenId
  27. * @subpackage Zend_OpenId_Provider
  28. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  29. * @license http://framework.zend.com/license/new-bsd New BSD License
  30. */
  31. abstract class Zend_OpenId_Provider_Storage
  32. {
  33. /**
  34. * Stores information about session identified by $handle
  35. *
  36. * @param string $handle assiciation handle
  37. * @param string $macFunc HMAC function (sha1 or sha256)
  38. * @param string $secret shared secret
  39. * @param string $expires expiration UNIX time
  40. * @return void
  41. */
  42. abstract public function addAssociation($handle, $macFunc, $secret, $expires);
  43. /**
  44. * Gets information about association identified by $handle
  45. * Returns true if given association found and not expired and false
  46. * otherwise
  47. *
  48. * @param string $handle assiciation handle
  49. * @param string &$macFunc HMAC function (sha1 or sha256)
  50. * @param string &$secret shared secret
  51. * @param string &$expires expiration UNIX time
  52. * @return bool
  53. */
  54. abstract public function getAssociation($handle, &$macFunc, &$secret, &$expires);
  55. /**
  56. * Register new user with given $id and $password
  57. * Returns true in case of success and false if user with given $id already
  58. * exists
  59. *
  60. * @param string $id user identity URL
  61. * @param string $password encoded user password
  62. * @return bool
  63. */
  64. abstract public function addUser($id, $password);
  65. /**
  66. * Returns true if user with given $id exists and false otherwise
  67. *
  68. * @param string $id user identity URL
  69. * @return bool
  70. */
  71. abstract public function hasUser($id);
  72. /**
  73. * Verify if user with given $id exists and has specified $password
  74. *
  75. * @param string $id user identity URL
  76. * @param string $password user password
  77. * @return bool
  78. */
  79. abstract public function checkUser($id, $password);
  80. /**
  81. * Returns array of all trusted/untrusted sites for given user identified
  82. * by $id
  83. *
  84. * @param string $id user identity URL
  85. * @return array
  86. */
  87. abstract public function getTrustedSites($id);
  88. /**
  89. * Stores information about trusted/untrusted site for given user
  90. *
  91. * @param string $id user identity URL
  92. * @param string $site site URL
  93. * @param mixed $trusted trust data from extensions or just a boolean value
  94. * @return bool
  95. */
  96. abstract public function addSite($id, $site, $trusted);
  97. }