259 |
gduche |
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_Consumer
|
|
|
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
|
299 |
jpm |
21 |
* @version $Id: Storage.php 299 2011-01-18 14:03:46Z jpm $
|
259 |
gduche |
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_Consumer
|
|
|
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 Storage
|
|
|
34 |
{
|
|
|
35 |
|
|
|
36 |
/**
|
|
|
37 |
* Stores information about association identified by $url/$handle
|
|
|
38 |
*
|
|
|
39 |
* @param string $url OpenID server URL
|
|
|
40 |
* @param string $handle assiciation handle
|
|
|
41 |
* @param string $macFunc HMAC function (sha1 or sha256)
|
|
|
42 |
* @param string $secret shared secret
|
|
|
43 |
* @param long $expires expiration UNIX time
|
|
|
44 |
* @return void
|
|
|
45 |
*/
|
|
|
46 |
abstract public function addAssociation($url, $handle, $macFunc, $secret, $expires);
|
|
|
47 |
|
|
|
48 |
/**
|
|
|
49 |
* Gets information about association identified by $url
|
|
|
50 |
* Returns true if given association found and not expired and false
|
|
|
51 |
* otherwise
|
|
|
52 |
*
|
|
|
53 |
* @param string $url OpenID server URL
|
|
|
54 |
* @param string &$handle assiciation handle
|
|
|
55 |
* @param string &$macFunc HMAC function (sha1 or sha256)
|
|
|
56 |
* @param string &$secret shared secret
|
|
|
57 |
* @param long &$expires expiration UNIX time
|
|
|
58 |
* @return bool
|
|
|
59 |
*/
|
|
|
60 |
abstract public function getAssociation($url, &$handle, &$macFunc, &$secret, &$expires);
|
|
|
61 |
|
|
|
62 |
/**
|
|
|
63 |
* Gets information about association identified by $handle
|
|
|
64 |
* Returns true if given association found and not expired and false
|
|
|
65 |
* othverwise
|
|
|
66 |
*
|
|
|
67 |
* @param string $handle assiciation handle
|
|
|
68 |
* @param string &$url OpenID server URL
|
|
|
69 |
* @param string &$macFunc HMAC function (sha1 or sha256)
|
|
|
70 |
* @param string &$secret shared secret
|
|
|
71 |
* @param long &$expires expiration UNIX time
|
|
|
72 |
* @return bool
|
|
|
73 |
*/
|
|
|
74 |
abstract public function getAssociationByHandle($handle, &$url, &$macFunc, &$secret, &$expires);
|
|
|
75 |
|
|
|
76 |
/**
|
|
|
77 |
* Deletes association identified by $url
|
|
|
78 |
*
|
|
|
79 |
* @param string $url OpenID server URL
|
|
|
80 |
* @return void
|
|
|
81 |
*/
|
|
|
82 |
abstract public function delAssociation($url);
|
|
|
83 |
|
|
|
84 |
/**
|
|
|
85 |
* Stores information discovered from identity $id
|
|
|
86 |
*
|
|
|
87 |
* @param string $id identity
|
|
|
88 |
* @param string $realId discovered real identity URL
|
|
|
89 |
* @param string $server discovered OpenID server URL
|
|
|
90 |
* @param float $version discovered OpenID protocol version
|
|
|
91 |
* @param long $expires expiration UNIX time
|
|
|
92 |
* @return void
|
|
|
93 |
*/
|
|
|
94 |
abstract public function addDiscoveryInfo($id, $realId, $server, $version, $expires);
|
|
|
95 |
|
|
|
96 |
/**
|
|
|
97 |
* Gets information discovered from identity $id
|
|
|
98 |
* Returns true if such information exists and false otherwise
|
|
|
99 |
*
|
|
|
100 |
* @param string $id identity
|
|
|
101 |
* @param string &$realId discovered real identity URL
|
|
|
102 |
* @param string &$server discovered OpenID server URL
|
|
|
103 |
* @param float &$version discovered OpenID protocol version
|
|
|
104 |
* @param long &$expires expiration UNIX time
|
|
|
105 |
* @return bool
|
|
|
106 |
*/
|
|
|
107 |
abstract public function getDiscoveryInfo($id, &$realId, &$server, &$version, &$expires);
|
|
|
108 |
|
|
|
109 |
/**
|
|
|
110 |
* Removes cached information discovered from identity $id
|
|
|
111 |
*
|
|
|
112 |
* @param string $id identity
|
|
|
113 |
* @return bool
|
|
|
114 |
*/
|
|
|
115 |
abstract public function delDiscoveryInfo($id);
|
|
|
116 |
|
|
|
117 |
/**
|
|
|
118 |
* The function checks the uniqueness of openid.response_nonce
|
|
|
119 |
*
|
|
|
120 |
* @param string $provider openid.openid_op_endpoint field from authentication response
|
|
|
121 |
* @param string $nonce openid.response_nonce field from authentication response
|
|
|
122 |
* @return bool
|
|
|
123 |
*/
|
|
|
124 |
abstract public function isUniqueNonce($provider, $nonce);
|
|
|
125 |
|
|
|
126 |
/**
|
|
|
127 |
* Removes data from the uniqueness database that is older then given date
|
|
|
128 |
*
|
|
|
129 |
* @param string $date Date of expired data
|
|
|
130 |
*/
|
|
|
131 |
abstract public function purgeNonces($date=null);
|
|
|
132 |
}
|