move dir check into constructor

This commit is contained in:
Nicolas Lœuillet 2015-02-10 13:35:34 +01:00
parent d4c029f46e
commit 92504e0dd4

View file

@ -17,6 +17,11 @@ class WsseProvider implements AuthenticationProviderInterface
{ {
$this->userProvider = $userProvider; $this->userProvider = $userProvider;
$this->cacheDir = $cacheDir; $this->cacheDir = $cacheDir;
// If cache directory does not exist we create it
if (!is_dir($this->cacheDir)) {
mkdir($this->cacheDir, 0777, true);
}
} }
public function authenticate(TokenInterface $token) public function authenticate(TokenInterface $token)
@ -54,11 +59,6 @@ class WsseProvider implements AuthenticationProviderInterface
throw new NonceExpiredException('Previously used nonce detected'); throw new NonceExpiredException('Previously used nonce detected');
} }
// If cache directory does not exist we create it
if (!is_dir($this->cacheDir)) {
mkdir($this->cacheDir, 0777, true);
}
file_put_contents($this->cacheDir.'/'.$nonce, time()); file_put_contents($this->cacheDir.'/'.$nonce, time());
// Validate Secret // Validate Secret