diff options
Diffstat (limited to 'Tests/Auth/OpenID/MemStore.php')
-rw-r--r-- | Tests/Auth/OpenID/MemStore.php | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Tests/Auth/OpenID/MemStore.php b/Tests/Auth/OpenID/MemStore.php index 160f0b4..aa562c3 100644 --- a/Tests/Auth/OpenID/MemStore.php +++ b/Tests/Auth/OpenID/MemStore.php @@ -4,6 +4,7 @@ * In-memory OpenID store implementation for testing only */ require_once "Auth/OpenID/Interface.php"; +require_once 'Auth/OpenID/Nonce.php'; class ServerAssocs { function ServerAssocs() @@ -114,8 +115,15 @@ class Tests_Auth_OpenID_MemStore { function useNonce($server_url, $timestamp, $salt) { - $nonce = sprintf("%s%s%s", $server_url, $timestamp, $salt); - if (in_array($nonce, $this->nonces)) { + global $Auth_OpenID_SKEW; + + if (abs($timestamp - mktime()) > $Auth_OpenID_SKEW) { + return false; + } + + $anonce = array($server_url, intval($timestamp), $salt); + + if (in_array($anonce, $this->nonces)) { return false; } else { array_push($this->nonces, $anonce); |