From 5df90c9ae107b46546a6b7d895d3d02aebe674f4 Mon Sep 17 00:00:00 2001 From: Phil Moorhouse Date: Fri, 27 Jul 2012 16:41:52 +0200 Subject: [PATCH] Fixed nonce expiry example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With the existing example, nonces can beĀ  re-used for five minutes and then expire, which is the reverse of the desired effect. --- cookbook/security/custom_authentication_provider.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/security/custom_authentication_provider.rst b/cookbook/security/custom_authentication_provider.rst index 9ee55b1bcb0..d345486711e 100644 --- a/cookbook/security/custom_authentication_provider.rst +++ b/cookbook/security/custom_authentication_provider.rst @@ -226,7 +226,7 @@ the ``PasswordDigest`` header value matches with the user's password. } // Validate nonce is unique within 5 minutes - if (file_exists($this->cacheDir.'/'.$nonce) && file_get_contents($this->cacheDir.'/'.$nonce) + 300 < time()) { + if (file_exists($this->cacheDir.'/'.$nonce) && file_get_contents($this->cacheDir.'/'.$nonce) + 300 > time()) { throw new NonceExpiredException('Previously used nonce detected'); } file_put_contents($this->cacheDir.'/'.$nonce, time());