summaryrefslogtreecommitdiffstats
path: root/Http
diff options
context:
space:
mode:
Diffstat (limited to 'Http')
-rw-r--r--Http/Firewall/AbstractAuthenticationListener.php5
-rw-r--r--Http/Firewall/AccessListener.php3
-rw-r--r--Http/Firewall/ContextListener.php2
-rw-r--r--Http/Firewall/DigestAuthenticationListener.php2
-rw-r--r--Http/Firewall/LogoutListener.php4
-rw-r--r--Http/Firewall/SwitchUserListener.php7
-rw-r--r--Http/HttpUtils.php17
-rw-r--r--Http/RememberMe/AbstractRememberMeServices.php6
8 files changed, 40 insertions, 6 deletions
diff --git a/Http/Firewall/AbstractAuthenticationListener.php b/Http/Firewall/AbstractAuthenticationListener.php
index 410fb73..087aa08 100644
--- a/Http/Firewall/AbstractAuthenticationListener.php
+++ b/Http/Firewall/AbstractAuthenticationListener.php
@@ -75,6 +75,8 @@ abstract class AbstractAuthenticationListener implements ListenerInterface
* successful, or failed authentication attempt
* @param LoggerInterface $logger A LoggerInterface instance
* @param EventDispatcherInterface $dispatcher An EventDispatcherInterface instance
+ *
+ * @throws \InvalidArgumentException
*/
public function __construct(SecurityContextInterface $securityContext, AuthenticationManagerInterface $authenticationManager, SessionAuthenticationStrategyInterface $sessionStrategy, HttpUtils $httpUtils, $providerKey, AuthenticationSuccessHandlerInterface $successHandler, AuthenticationFailureHandlerInterface $failureHandler, array $options = array(), LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null)
{
@@ -110,6 +112,9 @@ abstract class AbstractAuthenticationListener implements ListenerInterface
* Handles form based authentication.
*
* @param GetResponseEvent $event A GetResponseEvent instance
+ *
+ * @throws \RuntimeException
+ * @throws SessionUnavailableException
*/
final public function handle(GetResponseEvent $event)
{
diff --git a/Http/Firewall/AccessListener.php b/Http/Firewall/AccessListener.php
index 3e2d3a5..67766ef 100644
--- a/Http/Firewall/AccessListener.php
+++ b/Http/Firewall/AccessListener.php
@@ -46,6 +46,9 @@ class AccessListener implements ListenerInterface
* Handles access authorization.
*
* @param GetResponseEvent $event A GetResponseEvent instance
+ *
+ * @throws AccessDeniedException
+ * @throws AuthenticationCredentialsNotFoundException
*/
public function handle(GetResponseEvent $event)
{
diff --git a/Http/Firewall/ContextListener.php b/Http/Firewall/ContextListener.php
index fddd3c7..0b5c955 100644
--- a/Http/Firewall/ContextListener.php
+++ b/Http/Firewall/ContextListener.php
@@ -134,6 +134,8 @@ class ContextListener implements ListenerInterface
* @param TokenInterface $token
*
* @return TokenInterface|null
+ *
+ * @throws \RuntimeException
*/
private function refreshUser(TokenInterface $token)
{
diff --git a/Http/Firewall/DigestAuthenticationListener.php b/Http/Firewall/DigestAuthenticationListener.php
index 2bc4aa5..3c83c87 100644
--- a/Http/Firewall/DigestAuthenticationListener.php
+++ b/Http/Firewall/DigestAuthenticationListener.php
@@ -54,6 +54,8 @@ class DigestAuthenticationListener implements ListenerInterface
* Handles digest authentication.
*
* @param GetResponseEvent $event A GetResponseEvent instance
+ *
+ * @throws AuthenticationServiceException
*/
public function handle(GetResponseEvent $event)
{
diff --git a/Http/Firewall/LogoutListener.php b/Http/Firewall/LogoutListener.php
index 32a0511..ca2f439 100644
--- a/Http/Firewall/LogoutListener.php
+++ b/Http/Firewall/LogoutListener.php
@@ -75,8 +75,10 @@ class LogoutListener implements ListenerInterface
* validate the request.
*
* @param GetResponseEvent $event A GetResponseEvent instance
+ *
* @throws InvalidCsrfTokenException if the CSRF token is invalid
- * @throws RuntimeException if the LogoutSuccessHandlerInterface instance does not return a response
+ * @throws \RuntimeException if the LogoutSuccessHandlerInterface instance does not return a response
+ * @throws LogoutException
*/
public function handle(GetResponseEvent $event)
{
diff --git a/Http/Firewall/SwitchUserListener.php b/Http/Firewall/SwitchUserListener.php
index 7f0aa78..8e4f4e5 100644
--- a/Http/Firewall/SwitchUserListener.php
+++ b/Http/Firewall/SwitchUserListener.php
@@ -71,6 +71,8 @@ class SwitchUserListener implements ListenerInterface
* Handles digest authentication.
*
* @param GetResponseEvent $event A GetResponseEvent instance
+ *
+ * @throws \LogicException
*/
public function handle(GetResponseEvent $event)
{
@@ -102,6 +104,9 @@ class SwitchUserListener implements ListenerInterface
* @param Request $request A Request instance
*
* @return TokenInterface|null The new TokenInterface if successfully switched, null otherwise
+ *
+ * @throws \LogicException
+ * @throws AccessDeniedException
*/
private function attemptSwitchUser(Request $request)
{
@@ -148,6 +153,8 @@ class SwitchUserListener implements ListenerInterface
* @param Request $request A Request instance
*
* @return TokenInterface The original TokenInterface instance
+ *
+ * @throws AuthenticationCredentialsNotFoundException
*/
private function attemptExitUser(Request $request)
{
diff --git a/Http/HttpUtils.php b/Http/HttpUtils.php
index 6a2da08..a3c6f61 100644
--- a/Http/HttpUtils.php
+++ b/Http/HttpUtils.php
@@ -16,6 +16,7 @@ use Symfony\Component\Security\Core\SecurityContextInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
+use Symfony\Component\Routing\Matcher\RequestMatcherInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
@@ -33,12 +34,15 @@ class HttpUtils
/**
* Constructor.
*
- * @param UrlGeneratorInterface $urlGenerator A UrlGeneratorInterface instance
- * @param UrlMatcherInterface $urlMatcher A UrlMatcherInterface instance
+ * @param UrlGeneratorInterface $urlGenerator A UrlGeneratorInterface instance
+ * @param UrlMatcherInterface|RequestMatcherInterface $matcher The Url or Request matcher
*/
- public function __construct(UrlGeneratorInterface $urlGenerator = null, UrlMatcherInterface $urlMatcher = null)
+ public function __construct(UrlGeneratorInterface $urlGenerator = null, $urlMatcher = null)
{
$this->urlGenerator = $urlGenerator;
+ if ($urlMatcher !== null && !$urlMatcher instanceof UrlMatcherInterface && !$urlMatcher instanceof RequestMatcherInterface) {
+ throw new \InvalidArgumentException('Matcher must either implement UrlMatcherInterface or RequestMatcherInterface.');
+ }
$this->urlMatcher = $urlMatcher;
}
@@ -96,7 +100,12 @@ class HttpUtils
{
if ('/' !== $path[0]) {
try {
- $parameters = $this->urlMatcher->match($request->getPathInfo());
+ // matching a request is more powerful than matching a URL path + context, so try that first
+ if ($this->urlMatcher instanceof RequestMatcherInterface) {
+ $parameters = $this->urlMatcher->matchRequest($request);
+ } else {
+ $parameters = $this->urlMatcher->match($request->getPathInfo());
+ }
return $path === $parameters['_route'];
} catch (MethodNotAllowedException $e) {
diff --git a/Http/RememberMe/AbstractRememberMeServices.php b/Http/RememberMe/AbstractRememberMeServices.php
index 1d6a109..e49ce14 100644
--- a/Http/RememberMe/AbstractRememberMeServices.php
+++ b/Http/RememberMe/AbstractRememberMeServices.php
@@ -47,6 +47,8 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface
* @param string $providerKey
* @param array $options
* @param LoggerInterface $logger
+ *
+ * @throws \InvalidArgumentException
*/
public function __construct(array $userProviders, $key, $providerKey, array $options = array(), LoggerInterface $logger = null)
{
@@ -89,7 +91,9 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface
*
* @param Request $request
*
- * @return TokenInterface
+ * @return TokenInterface|null
+ *
+ * @throws CookieTheftException
*/
final public function autoLogin(Request $request)
{