21 require_once
'Auth/OpenID/Interface.php';
46 $this->connection = $connection;
47 $this->compress = $compress ? MEMCACHE_COMPRESSED : 0;
60 $association->handle);
64 $serverAssociations = $this->connection->get($serverKey);
67 if (!$serverAssociations) {
68 $serverAssociations = array();
71 $serverAssociations[$association->issued] = $associationKey;
74 $this->connection->set(
80 $this->connection->set(
84 $association->issued + $association->lifetime);
94 if ($handle !== null) {
96 $association = $this->connection->get(
98 return $association ? $association : null;
106 $serverAssociations = $this->connection->get($serverKey);
108 if (!$serverAssociations) {
113 $keys = array_keys($serverAssociations);
115 $lastKey = $serverAssociations[array_pop($keys)];
118 $association = $this->connection->get($lastKey);
119 return $association ? $association : null;
134 $serverAssociations = $this->connection->get($serverKey);
136 if (!$serverAssociations) {
141 $serverAssociations = array_flip($serverAssociations);
142 if (!array_key_exists($associationKey, $serverAssociations)) {
147 unset($serverAssociations[$associationKey]);
148 $serverAssociations = array_flip($serverAssociations);
151 $this->connection->set(
158 return $this->connection->delete($associationKey);
170 if (abs(
$timestamp - time()) > $Auth_OpenID_SKEW) {
176 return $this->connection->add(
177 'openid_nonce_' . sha1($server_url) .
'_' . sha1($salt),
188 return 'openid_association_' . sha1($server_url) .
'_' . sha1($handle);
196 return 'openid_association_server_' . sha1($server_url);
associationKey($server_url, $handle=null)
Memcache key is prefixed with 'openid_association_' string.
getAssociation($server_url, $handle=null)
Read association from memcached.
supportsCleanup()
Report that this storage doesn't support cleanup.
Auth_OpenID_MemcachedStore($connection, $compress=false)
Initializes a new Auth_OpenID_MemcachedStore instance.
storeAssociation($server_url, $association)
Store association until its expiration time in memcached.
removeAssociation($server_url, $handle)
Immediately delete association from memcache.
foreach($mandatory_scripts as $file) $timestamp
associationServerKey($server_url)
Memcache key is prefixed with 'openid_association_' string.
useNonce($server_url, $timestamp, $salt)
Create nonce for server and salt, expiring after $Auth_OpenID_SKEW seconds.