Skip to content
Permalink
Browse files

Rename nonceExpires to nonceLifetime

  • Loading branch information...
markstory committed Oct 30, 2016
1 parent c1680b2 commit a8fa835319494501003e1cd067c6ed5fb2db520a
Showing with 5 additions and 3 deletions.
  1. +3 −3 src/Auth/DigestAuthenticate.php
  2. +2 −0 tests/TestCase/Auth/DigestAuthenticateTest.php
@@ -76,7 +76,7 @@ class DigestAuthenticate extends BasicAuthenticate
* - `qop` Defaults to 'auth', no other values are supported at this time.
* - `opaque` A string that must be returned unchanged by clients.
* Defaults to `md5($config['realm'])`
* - `nonceExpires` The number of seconds that nonces are valid for. Defaults to 300.
* - `nonceLifetime` The number of seconds that nonces are valid for. Defaults to 300.
*
* @param \Cake\Controller\ComponentRegistry $registry The Component registry
* used on this request.
@@ -87,7 +87,7 @@ public function __construct(ComponentRegistry $registry, array $config = [])
$this->_registry = $registry;
$this->config([
'nonceExpires' => 300,
'nonceLifetime' => 300,
'secret' => Configure::read('Security.salt'),
'realm' => null,
'qop' => 'auth',
@@ -254,7 +254,7 @@ public function loginHeaders(Request $request)
*/
protected function generateNonce()
{
$expiryTime = microtime(true) + $this->config('nonceExpires');
$expiryTime = microtime(true) + $this->config('nonceLifetime');
$signatureValue = md5($expiryTime . ':' . $this->config('secret'));
$nonceValue = $expiryTime . ':' . $signatureValue;
@@ -472,6 +472,7 @@ protected function generateNonce($secret = null, $expires = 300, $time = null)
$expiryTime = $time + $expires;
$signatureValue = md5($expiryTime . ':' . $secret);
$nonceValue = $expiryTime . ':' . $signatureValue;
return base64_encode($nonceValue);
}
@@ -499,6 +500,7 @@ protected function digestHeader($data)
response="{$data['response']}",
opaque="{$data['opaque']}"
DIGEST;
return $digest;
}
}

0 comments on commit a8fa835

Please sign in to comment.
You can’t perform that action at this time.