From 7ee39a630d3c69e93274c6d1d6ac54055cb2c48a Mon Sep 17 00:00:00 2001 From: Piotr Antosik Date: Thu, 22 Aug 2013 00:25:28 +0200 Subject: [PATCH] Added doc comments --- src/Symfony/Component/Security/Http/AccessMap.php | 3 +++ .../DefaultAuthenticationFailureHandler.php | 2 +- .../Authorization/AccessDeniedHandlerInterface.php | 1 + .../EntryPoint/BasicAuthenticationEntryPoint.php | 3 +++ .../EntryPoint/DigestAuthenticationEntryPoint.php | 9 +++++++++ .../Http/EntryPoint/FormAuthenticationEntryPoint.php | 2 +- .../EntryPoint/RetryAuthenticationEntryPoint.php | 3 +++ .../Security/Http/Event/InteractiveLoginEvent.php | 6 +++++- .../Security/Http/Event/SwitchUserEvent.php | 12 +++++++++++- src/Symfony/Component/Security/Http/Firewall.php | 3 +++ .../Security/Http/Firewall/ExceptionListener.php | 10 ++++++++++ .../Security/Http/Firewall/LogoutListener.php | 5 ++--- .../Security/Http/Firewall/RememberMeListener.php | 2 +- .../Http/Firewall/X509AuthenticationListener.php | 3 +++ src/Symfony/Component/Security/Http/FirewallMap.php | 8 ++++++++ src/Symfony/Component/Security/Http/HttpUtils.php | 7 ++++++- .../Http/RememberMe/AbstractRememberMeServices.php | 9 ++++++++- .../Security/Http/RememberMe/ResponseListener.php | 6 ++++++ 18 files changed, 84 insertions(+), 10 deletions(-) diff --git a/src/Symfony/Component/Security/Http/AccessMap.php b/src/Symfony/Component/Security/Http/AccessMap.php index de78e15a55..051a8c22b1 100644 --- a/src/Symfony/Component/Security/Http/AccessMap.php +++ b/src/Symfony/Component/Security/Http/AccessMap.php @@ -36,6 +36,9 @@ class AccessMap implements AccessMapInterface $this->map[] = array($requestMatcher, $roles, $channel); } + /** + * {@inheritDoc} + */ public function getPatterns(Request $request) { foreach ($this->map as $elements) { diff --git a/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationFailureHandler.php b/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationFailureHandler.php index 64f84f0e9f..70dcd1e858 100644 --- a/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationFailureHandler.php +++ b/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationFailureHandler.php @@ -64,7 +64,7 @@ class DefaultAuthenticationFailureHandler implements AuthenticationFailureHandle { if ($failureUrl = $request->get($this->options['failure_path_parameter'], null, true)) { $this->options['failure_path'] = $failureUrl; - } + } if (null === $this->options['failure_path']) { $this->options['failure_path'] = $this->options['login_path']; diff --git a/src/Symfony/Component/Security/Http/Authorization/AccessDeniedHandlerInterface.php b/src/Symfony/Component/Security/Http/Authorization/AccessDeniedHandlerInterface.php index 5f60fd6aa1..262ccc5fbc 100644 --- a/src/Symfony/Component/Security/Http/Authorization/AccessDeniedHandlerInterface.php +++ b/src/Symfony/Component/Security/Http/Authorization/AccessDeniedHandlerInterface.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Security\Http\Authorization; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Symfony\Component\HttpFoundation\Response; diff --git a/src/Symfony/Component/Security/Http/EntryPoint/BasicAuthenticationEntryPoint.php b/src/Symfony/Component/Security/Http/EntryPoint/BasicAuthenticationEntryPoint.php index 44ece5e72e..e03de7d5b4 100644 --- a/src/Symfony/Component/Security/Http/EntryPoint/BasicAuthenticationEntryPoint.php +++ b/src/Symfony/Component/Security/Http/EntryPoint/BasicAuthenticationEntryPoint.php @@ -30,6 +30,9 @@ class BasicAuthenticationEntryPoint implements AuthenticationEntryPointInterface $this->realmName = $realmName; } + /** + * {@inheritdoc} + */ public function start(Request $request, AuthenticationException $authException = null) { $response = new Response(); diff --git a/src/Symfony/Component/Security/Http/EntryPoint/DigestAuthenticationEntryPoint.php b/src/Symfony/Component/Security/Http/EntryPoint/DigestAuthenticationEntryPoint.php index 1131b58917..4029d790c2 100644 --- a/src/Symfony/Component/Security/Http/EntryPoint/DigestAuthenticationEntryPoint.php +++ b/src/Symfony/Component/Security/Http/EntryPoint/DigestAuthenticationEntryPoint.php @@ -38,6 +38,9 @@ class DigestAuthenticationEntryPoint implements AuthenticationEntryPointInterfac $this->logger = $logger; } + /** + * {@inheritdoc} + */ public function start(Request $request, AuthenticationException $authException = null) { $expiryTime = microtime(true) + $this->nonceValiditySeconds * 1000; @@ -62,11 +65,17 @@ class DigestAuthenticationEntryPoint implements AuthenticationEntryPointInterfac return $response; } + /** + * @return string + */ public function getKey() { return $this->key; } + /** + * @return string + */ public function getRealmName() { return $this->realmName; diff --git a/src/Symfony/Component/Security/Http/EntryPoint/FormAuthenticationEntryPoint.php b/src/Symfony/Component/Security/Http/EntryPoint/FormAuthenticationEntryPoint.php index 2170e9ede7..886872a29b 100644 --- a/src/Symfony/Component/Security/Http/EntryPoint/FormAuthenticationEntryPoint.php +++ b/src/Symfony/Component/Security/Http/EntryPoint/FormAuthenticationEntryPoint.php @@ -30,7 +30,7 @@ class FormAuthenticationEntryPoint implements AuthenticationEntryPointInterface private $httpUtils; /** - * Constructor + * Constructor. * * @param HttpKernelInterface $kernel * @param HttpUtils $httpUtils An HttpUtils instance diff --git a/src/Symfony/Component/Security/Http/EntryPoint/RetryAuthenticationEntryPoint.php b/src/Symfony/Component/Security/Http/EntryPoint/RetryAuthenticationEntryPoint.php index 532601affa..091e0ee9b1 100644 --- a/src/Symfony/Component/Security/Http/EntryPoint/RetryAuthenticationEntryPoint.php +++ b/src/Symfony/Component/Security/Http/EntryPoint/RetryAuthenticationEntryPoint.php @@ -34,6 +34,9 @@ class RetryAuthenticationEntryPoint implements AuthenticationEntryPointInterface $this->httpsPort = $httpsPort; } + /** + * {@inheritdoc} + */ public function start(Request $request, AuthenticationException $authException = null) { $scheme = $request->isSecure() ? 'http' : 'https'; diff --git a/src/Symfony/Component/Security/Http/Event/InteractiveLoginEvent.php b/src/Symfony/Component/Security/Http/Event/InteractiveLoginEvent.php index 2225d92539..575352cd15 100644 --- a/src/Symfony/Component/Security/Http/Event/InteractiveLoginEvent.php +++ b/src/Symfony/Component/Security/Http/Event/InteractiveLoginEvent.php @@ -15,10 +15,14 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\EventDispatcher\Event; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +/** + * InteractiveLoginEvent + * + * @author Fabien Potencier + */ class InteractiveLoginEvent extends Event { private $request; - private $authenticationToken; /** diff --git a/src/Symfony/Component/Security/Http/Event/SwitchUserEvent.php b/src/Symfony/Component/Security/Http/Event/SwitchUserEvent.php index 4a7dcaf86a..a55315449f 100644 --- a/src/Symfony/Component/Security/Http/Event/SwitchUserEvent.php +++ b/src/Symfony/Component/Security/Http/Event/SwitchUserEvent.php @@ -15,10 +15,14 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\EventDispatcher\Event; +/** + * SwitchUserEvent + * + * @author Fabien Potencier + */ class SwitchUserEvent extends Event { private $request; - private $targetUser; public function __construct(Request $request, UserInterface $targetUser) @@ -27,11 +31,17 @@ class SwitchUserEvent extends Event $this->targetUser = $targetUser; } + /** + * @return Request + */ public function getRequest() { return $this->request; } + /** + * @return UserInterface + */ public function getTargetUser() { return $this->targetUser; diff --git a/src/Symfony/Component/Security/Http/Firewall.php b/src/Symfony/Component/Security/Http/Firewall.php index 31c1da58ae..4f1cf30d03 100644 --- a/src/Symfony/Component/Security/Http/Firewall.php +++ b/src/Symfony/Component/Security/Http/Firewall.php @@ -71,6 +71,9 @@ class Firewall implements EventSubscriberInterface } } + /** + * {@inheritDoc} + */ public static function getSubscribedEvents() { return array(KernelEvents::REQUEST => array('onKernelRequest', 8)); diff --git a/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php b/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php index b2c8862b72..4ef6c26c88 100644 --- a/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php @@ -161,6 +161,13 @@ class ExceptionListener $event->setResponse($response); } + /** + * @param Request $request + * @param AuthenticationException $authException + * + * @return Response + * @throws AuthenticationException + */ private function startAuthentication(Request $request, AuthenticationException $authException) { if (null === $this->authenticationEntryPoint) { @@ -181,6 +188,9 @@ class ExceptionListener return $this->authenticationEntryPoint->start($request, $authException); } + /** + * @param Request $request + */ protected function setTargetPath(Request $request) { // session isn't required when using http basic authentication mechanism for example diff --git a/src/Symfony/Component/Security/Http/Firewall/LogoutListener.php b/src/Symfony/Component/Security/Http/Firewall/LogoutListener.php index 653c64429b..983eab0a31 100644 --- a/src/Symfony/Component/Security/Http/Firewall/LogoutListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/LogoutListener.php @@ -37,7 +37,7 @@ class LogoutListener implements ListenerInterface private $csrfProvider; /** - * Constructor + * Constructor. * * @param SecurityContextInterface $securityContext * @param HttpUtils $httpUtils An HttpUtilsInterface instance @@ -77,9 +77,8 @@ class LogoutListener implements ListenerInterface * * @param GetResponseEvent $event A GetResponseEvent instance * - * @throws InvalidCsrfTokenException if the CSRF token is invalid + * @throws LogoutException if the CSRF token is invalid * @throws \RuntimeException if the LogoutSuccessHandlerInterface instance does not return a response - * @throws LogoutException */ public function handle(GetResponseEvent $event) { diff --git a/src/Symfony/Component/Security/Http/Firewall/RememberMeListener.php b/src/Symfony/Component/Security/Http/Firewall/RememberMeListener.php index 5a856e27f4..6ca384296c 100644 --- a/src/Symfony/Component/Security/Http/Firewall/RememberMeListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/RememberMeListener.php @@ -35,7 +35,7 @@ class RememberMeListener implements ListenerInterface private $dispatcher; /** - * Constructor + * Constructor. * * @param SecurityContextInterface $securityContext * @param RememberMeServicesInterface $rememberMeServices diff --git a/src/Symfony/Component/Security/Http/Firewall/X509AuthenticationListener.php b/src/Symfony/Component/Security/Http/Firewall/X509AuthenticationListener.php index 0b5a6ae540..5aabf75fcf 100644 --- a/src/Symfony/Component/Security/Http/Firewall/X509AuthenticationListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/X509AuthenticationListener.php @@ -36,6 +36,9 @@ class X509AuthenticationListener extends AbstractPreAuthenticatedListener $this->credentialKey = $credentialKey; } + /** + * {@inheritdoc} + */ protected function getPreAuthenticatedData(Request $request) { if (!$request->server->has($this->userKey)) { diff --git a/src/Symfony/Component/Security/Http/FirewallMap.php b/src/Symfony/Component/Security/Http/FirewallMap.php index dfc0984415..0554bedc21 100644 --- a/src/Symfony/Component/Security/Http/FirewallMap.php +++ b/src/Symfony/Component/Security/Http/FirewallMap.php @@ -25,11 +25,19 @@ class FirewallMap implements FirewallMapInterface { private $map = array(); + /** + * @param RequestMatcherInterface $requestMatcher + * @param array $listeners + * @param ExceptionListener $exceptionListener + */ public function add(RequestMatcherInterface $requestMatcher = null, array $listeners = array(), ExceptionListener $exceptionListener = null) { $this->map[] = array($requestMatcher, $listeners, $exceptionListener); } + /** + * {@inheritDoc} + */ public function getListeners(Request $request) { foreach ($this->map as $elements) { diff --git a/src/Symfony/Component/Security/Http/HttpUtils.php b/src/Symfony/Component/Security/Http/HttpUtils.php index c3ff865bae..0588359b2b 100644 --- a/src/Symfony/Component/Security/Http/HttpUtils.php +++ b/src/Symfony/Component/Security/Http/HttpUtils.php @@ -13,6 +13,7 @@ namespace Symfony\Component\Security\Http; use Symfony\Component\Security\Core\SecurityContextInterface; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\Routing\Matcher\UrlMatcherInterface; @@ -37,6 +38,8 @@ class HttpUtils * * @param UrlGeneratorInterface $urlGenerator A UrlGeneratorInterface instance * @param UrlMatcherInterface|RequestMatcherInterface $urlMatcher The Url or Request matcher + * + * @throws \InvalidArgumentException */ public function __construct(UrlGeneratorInterface $urlGenerator = null, $urlMatcher = null) { @@ -123,9 +126,11 @@ class HttpUtils * Generates a URI, based on the given path or absolute URL. * * @param Request $request A Request instance - * @param string $path A path (an absolute path (/foo), an absolute URL (http://...), or a route name (foo)) + * @param string $path A path (an absolute path (/foo), an absolute URL (http://...), or a route name (foo)) * * @return string An absolute URL + * + * @throws \LogicException */ public function generateUri($request, $path) { diff --git a/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php b/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php index ae61dd73b1..6a47a7ad7a 100644 --- a/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php +++ b/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php @@ -40,7 +40,7 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface private $userProviders; /** - * Constructor + * Constructor. * * @param array $userProviders * @param string $key @@ -80,6 +80,9 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface return $this->options['remember_me_parameter']; } + /** + * @return string + */ public function getKey() { return $this->key; @@ -94,6 +97,7 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface * @return TokenInterface|null * * @throws CookieTheftException + * @throws \RuntimeException */ final public function autoLogin(Request $request) { @@ -219,6 +223,9 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface */ abstract protected function processAutoLoginCookie(array $cookieParts, Request $request); + /** + * @param Request $request + */ protected function onLoginFail(Request $request) { } diff --git a/src/Symfony/Component/Security/Http/RememberMe/ResponseListener.php b/src/Symfony/Component/Security/Http/RememberMe/ResponseListener.php index 03c71c78dc..60875877ef 100644 --- a/src/Symfony/Component/Security/Http/RememberMe/ResponseListener.php +++ b/src/Symfony/Component/Security/Http/RememberMe/ResponseListener.php @@ -22,6 +22,9 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; */ class ResponseListener implements EventSubscriberInterface { + /** + * @param FilterResponseEvent $event + */ public function onKernelResponse(FilterResponseEvent $event) { $request = $event->getRequest(); @@ -32,6 +35,9 @@ class ResponseListener implements EventSubscriberInterface } } + /** + * {@inheritDoc} + */ public static function getSubscribedEvents() { return array(KernelEvents::RESPONSE => 'onKernelResponse');