Auth_OpenID_MemcachedStore Klassenreferenz

Abgeleitet von Auth_OpenID_OpenIDStore.

Zusammengehörigkeiten von Auth_OpenID_MemcachedStore:

Collaboration graph
[Legende]

Öffentliche Methoden

 Auth_OpenID_MemcachedStore ($connection, $compress=false)
 storeAssociation ($server_url, $association)
 getAssociation ($server_url, $handle=null)
 removeAssociation ($server_url, $handle)
 useNonce ($server_url, $timestamp, $salt)
 associationKey ($server_url, $handle=null)
 associationServerKey ($server_url)
 supportsCleanup ()

Ausführliche Beschreibung

Definiert in Zeile 36 der Datei MemcachedStore.php.


Dokumentation der Elementfunktionen

associationKey ( server_url,
handle = null 
)

Memcache key is prefixed with 'openid_association_' string.

Definiert in Zeile 186 der Datei MemcachedStore.php.

00187     {
00188         return 'openid_association_' . sha1($server_url) . '_' . sha1($handle);
00189     }

associationServerKey ( server_url  ) 

Memcache key is prefixed with 'openid_association_' string.

Definiert in Zeile 194 der Datei MemcachedStore.php.

00195     {
00196         return 'openid_association_server_' . sha1($server_url);
00197     }

Auth_OpenID_MemcachedStore ( connection,
compress = false 
)

Initializes a new Auth_OpenID_MemcachedStore instance. Just saves memcached object as property.

Parameter:
resource connection Memcache connection resourse

Definiert in Zeile 44 der Datei MemcachedStore.php.

00045     {
00046         $this->connection = $connection;
00047         $this->compress = $compress ? MEMCACHE_COMPRESSED : 0;
00048     }

getAssociation ( server_url,
handle = null 
)

Read association from memcached. If no handle given and multiple associations found, returns latest issued

Erneute Implementation von Auth_OpenID_OpenIDStore.

Definiert in Zeile 91 der Datei MemcachedStore.php.

00092     {
00093         // simple case: handle given
00094         if ($handle !== null) {
00095             // get association, return null if failed
00096             $association = $this->connection->get(
00097                 $this->associationKey($server_url, $handle));
00098             return $association ? $association : null;
00099         }
00100         
00101         // no handle given, working with list
00102         // create key for list of associations
00103         $serverKey = $this->associationServerKey($server_url);
00104         
00105         // get list of associations
00106         $serverAssociations = $this->connection->get($serverKey);
00107         // return null if failed or got empty list
00108         if (!$serverAssociations) {
00109             return null;
00110         }
00111         
00112         // get key of most recently issued association
00113         $keys = array_keys($serverAssociations);
00114         sort($keys);
00115         $lastKey = $serverAssociations[array_pop($keys)];
00116         
00117         // get association, return null if failed
00118         $association = $this->connection->get($lastKey);
00119         return $association ? $association : null;
00120     }

removeAssociation ( server_url,
handle 
)

Immediately delete association from memcache.

Erneute Implementation von Auth_OpenID_OpenIDStore.

Definiert in Zeile 125 der Datei MemcachedStore.php.

00126     {
00127         // create memcached keys for association itself 
00128         // and list of associations for this server
00129         $serverKey = $this->associationServerKey($server_url);
00130         $associationKey = $this->associationKey($server_url, 
00131             $handle);
00132         
00133         // get list of associations
00134         $serverAssociations = $this->connection->get($serverKey);
00135         // return null if failed or got empty list
00136         if (!$serverAssociations) {
00137             return false;
00138         }
00139         
00140         // ensure that given association key exists in list
00141         $serverAssociations = array_flip($serverAssociations);
00142         if (!array_key_exists($associationKey, $serverAssociations)) {
00143             return false;
00144         }
00145         
00146         // remove given association key from list
00147         unset($serverAssociations[$associationKey]);
00148         $serverAssociations = array_flip($serverAssociations);
00149         
00150         // save updated list
00151         $this->connection->set(
00152             $serverKey,
00153             $serverAssociations,
00154             $this->compress
00155         );
00156 
00157         // delete association 
00158         return $this->connection->delete($associationKey);
00159     }

storeAssociation ( server_url,
association 
)

Store association until its expiration time in memcached. Overwrites any existing association with same server_url and handle. Handles list of associations for every server.

Erneute Implementation von Auth_OpenID_OpenIDStore.

Definiert in Zeile 55 der Datei MemcachedStore.php.

00056     {
00057         // create memcached keys for association itself 
00058         // and list of associations for this server
00059         $associationKey = $this->associationKey($server_url, 
00060             $association->handle);
00061         $serverKey = $this->associationServerKey($server_url);
00062         
00063         // get list of associations 
00064         $serverAssociations = $this->connection->get($serverKey);
00065         
00066         // if no such list, initialize it with empty array
00067         if (!$serverAssociations) {
00068             $serverAssociations = array();
00069         }
00070         // and store given association key in it
00071         $serverAssociations[$association->issued] = $associationKey;
00072         
00073         // save associations' keys list 
00074         $this->connection->set(
00075             $serverKey,
00076             $serverAssociations,
00077             $this->compress
00078         );
00079         // save association itself
00080         $this->connection->set(
00081             $associationKey,
00082             $association, 
00083             $this->compress, 
00084             $association->issued + $association->lifetime);
00085     }

supportsCleanup (  ) 

Report that this storage doesn't support cleanup

Erneute Implementation von Auth_OpenID_OpenIDStore.

Definiert in Zeile 202 der Datei MemcachedStore.php.

00203     {
00204         return false;
00205     }

useNonce ( server_url,
timestamp,
salt 
)

Create nonce for server and salt, expiring after $Auth_OpenID_SKEW seconds.

Erneute Implementation von Auth_OpenID_OpenIDStore.

Definiert in Zeile 165 der Datei MemcachedStore.php.

00166     {
00167         global $Auth_OpenID_SKEW;
00168         
00169         // save one request to memcache when nonce obviously expired 
00170         if (abs($timestamp - time()) > $Auth_OpenID_SKEW) {
00171             return false;
00172         }
00173         
00174         // returns false when nonce already exists
00175         // otherwise adds nonce
00176         return $this->connection->add(
00177             'openid_nonce_' . sha1($server_url) . '_' . sha1($salt), 
00178             1, // any value here 
00179             $this->compress, 
00180             $Auth_OpenID_SKEW);
00181     }


Die Dokumentation für diese Klasse wurde erzeugt aufgrund der Datei:
Copyright © 2003 - 2009 MyOOS [Shopsystem]. All rights reserved.
MyOOS [Shopsystem] is Free Software released under the GNU/GPL License.

Webmaster: info@r23.de (Impressum)
doxygen