diff options
author | drmalex07 <alexakis@imis.athena-innovation.gr> | 2014-03-11 20:00:53 +0200 |
---|---|---|
committer | drmalex07 <alexakis@imis.athena-innovation.gr> | 2014-03-11 20:00:53 +0200 |
commit | c5303e1517d46fb0a7e335f419376b51bc4d1b0d (patch) | |
tree | 361aeaa3e90088a9f909f42694bad32cec811fdd /Auth | |
parent | cb53da46b73baff46ae325eb799d91703acc3780 (diff) | |
download | php-openid-c5303e1517d46fb0a7e335f419376b51bc4d1b0d.zip php-openid-c5303e1517d46fb0a7e335f419376b51bc4d1b0d.tar.gz php-openid-c5303e1517d46fb0a7e335f419376b51bc4d1b0d.tar.bz2 |
Provide several modifications on the PredisStore implementation.
- Fixed some typos
- Fixed the way an association is retreived from the store (getAssociation()).
The existing implementation was poping (LPOP) from a list, causing unneeded
re-associations. If we need to discard stale association handles, i think we
should rather set the appropriate expiry intervals.
Diffstat (limited to 'Auth')
-rw-r--r-- | Auth/OpenID/PredisStore.php | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Auth/OpenID/PredisStore.php b/Auth/OpenID/PredisStore.php index 7108c2f..14ecbbd 100644 --- a/Auth/OpenID/PredisStore.php +++ b/Auth/OpenID/PredisStore.php @@ -104,8 +104,11 @@ class Auth_OpenID_PredisStore extends Auth_OpenID_OpenIDStore { // no handle given, receiving the latest issued $serverKey = $this->associationServerKey($server_url); - $lastKey = $this->redis->lpop($serverKey); - if (!$lastKey) { return null; } + $lastKey = $this->redis->lindex($serverKey, -1); + if (!$lastKey) { + // no previous association with this server + return null; + } // get association, return null if failed return $this->getAssociationFromServer($lastKey); @@ -156,10 +159,10 @@ class Auth_OpenID_PredisStore extends Auth_OpenID_OpenIDStore { // SETNX will set the value only of the key doesn't exist yet. $nonceKey = $this->nonceKey($server_url, $salt); - $added = $this->predis->setnx($nonceKey); + $added = $this->redis->setnx($nonceKey, "1"); if ($added) { // Will set expiration - $this->predis->expire($nonceKey, $Auth_OpenID_SKEW); + $this->redis->expire($nonceKey, $Auth_OpenID_SKEW); return true; } else { return false; |