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);
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);