diff options
author | Iltar van der Berg <ivanderberg@hostnet.nl> | 2014-09-29 09:09:34 +0200 |
---|---|---|
committer | Iltar van der Berg <ivanderberg@hostnet.nl> | 2014-09-29 09:38:25 +0200 |
commit | e70cd1cffa71f5d45b3b47d0ef4f5ac4e49db0fa (patch) | |
tree | cb29987795eec2280b860583e4a22124cdeb01e5 /Http/Authentication | |
parent | 13d75567bf16e646536e9683097b6faa08dc728e (diff) | |
download | symfony-security-e70cd1cffa71f5d45b3b47d0ef4f5ac4e49db0fa.zip symfony-security-e70cd1cffa71f5d45b3b47d0ef4f5ac4e49db0fa.tar.gz symfony-security-e70cd1cffa71f5d45b3b47d0ef4f5ac4e49db0fa.tar.bz2 |
[DX] Moved constants to a final class
Diffstat (limited to 'Http/Authentication')
-rw-r--r-- | Http/Authentication/AuthenticationUtils.php | 16 | ||||
-rw-r--r-- | Http/Authentication/DefaultAuthenticationFailureHandler.php | 6 |
2 files changed, 11 insertions, 11 deletions
diff --git a/Http/Authentication/AuthenticationUtils.php b/Http/Authentication/AuthenticationUtils.php index 03f5e44..38763dc 100644 --- a/Http/Authentication/AuthenticationUtils.php +++ b/Http/Authentication/AuthenticationUtils.php @@ -11,10 +11,10 @@ namespace Symfony\Component\Security\Http\Authentication; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\Security\Core\Exception\AuthenticationException; -use Symfony\Component\Security\Core\SecurityContextInterface; -use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Security\Core\Security; /** * Extracts Security Errors from Request @@ -46,13 +46,13 @@ class AuthenticationUtils $session = $request->getSession(); $authenticationException = null; - if ($request->attributes->has(SecurityContextInterface::AUTHENTICATION_ERROR)) { - $authenticationException = $request->attributes->get(SecurityContextInterface::AUTHENTICATION_ERROR); - } elseif ($session !== null && $session->has(SecurityContextInterface::AUTHENTICATION_ERROR)) { - $authenticationException = $session->get(SecurityContextInterface::AUTHENTICATION_ERROR); + if ($request->attributes->has(Security::AUTHENTICATION_ERROR)) { + $authenticationException = $request->attributes->get(Security::AUTHENTICATION_ERROR); + } elseif ($session !== null && $session->has(Security::AUTHENTICATION_ERROR)) { + $authenticationException = $session->get(Security::AUTHENTICATION_ERROR); if ($clearSession) { - $session->remove(SecurityContextInterface::AUTHENTICATION_ERROR); + $session->remove(Security::AUTHENTICATION_ERROR); } } @@ -66,7 +66,7 @@ class AuthenticationUtils { $session = $this->getRequest()->getSession(); - return null === $session ? '' : $session->get(SecurityContextInterface::LAST_USERNAME); + return null === $session ? '' : $session->get(Security::LAST_USERNAME); } /** diff --git a/Http/Authentication/DefaultAuthenticationFailureHandler.php b/Http/Authentication/DefaultAuthenticationFailureHandler.php index 658a999..93150c8 100644 --- a/Http/Authentication/DefaultAuthenticationFailureHandler.php +++ b/Http/Authentication/DefaultAuthenticationFailureHandler.php @@ -15,7 +15,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\HttpKernelInterface; use Psr\Log\LoggerInterface; use Symfony\Component\Security\Core\Exception\AuthenticationException; -use Symfony\Component\Security\Core\SecurityContextInterface; +use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Http\HttpUtils; /** @@ -96,7 +96,7 @@ class DefaultAuthenticationFailureHandler implements AuthenticationFailureHandle } $subRequest = $this->httpUtils->createRequest($request, $this->options['failure_path']); - $subRequest->attributes->set(SecurityContextInterface::AUTHENTICATION_ERROR, $exception); + $subRequest->attributes->set(Security::AUTHENTICATION_ERROR, $exception); return $this->httpKernel->handle($subRequest, HttpKernelInterface::SUB_REQUEST); } @@ -105,7 +105,7 @@ class DefaultAuthenticationFailureHandler implements AuthenticationFailureHandle $this->logger->debug(sprintf('Redirecting to %s', $this->options['failure_path'])); } - $request->getSession()->set(SecurityContextInterface::AUTHENTICATION_ERROR, $exception); + $request->getSession()->set(Security::AUTHENTICATION_ERROR, $exception); return $this->httpUtils->createRedirectResponse($request, $this->options['failure_path']); } |