Add cache decorator for UserModel

This commit is contained in:
Frederic Guillot
2016-12-17 13:39:03 -05:00
parent aafa1de4d5
commit ddeb89e2c6
7 changed files with 73 additions and 5 deletions

View File

@@ -31,7 +31,7 @@ class AuthenticationMiddleware extends Base implements MiddlewareInterface
$this->sessionStorage->scope = 'API';
if ($this->isUserAuthenticated($username, $password)) {
$this->userSession->initialize($this->userModel->getByUsername($username));
$this->userSession->initialize($this->userCacheDecorator->getByUsername($username));
} elseif (! $this->isAppAuthenticated($username, $password)) {
$this->logger->error('API authentication failure for '.$username);
throw new AuthenticationFailureException('Wrong credentials');