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