minor#8823 [Security] [2.2] Added doc comments and missing use statement (piotrantosik)

This PR was merged into the 2.2 branch.

Discussion
----------

[Security] [2.2] Added doc comments and missing use statement

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

7ee39a6 Added doc comments
This commit is contained in:
Fabien Potencier 2013-09-27 17:00:06 +02:00
commit 279a686fcf
18 changed files with 84 additions and 10 deletions

View File

@ -36,6 +36,9 @@ class AccessMap implements AccessMapInterface
$this->map[] = array($requestMatcher, $roles, $channel); $this->map[] = array($requestMatcher, $roles, $channel);
} }
/**
* {@inheritDoc}
*/
public function getPatterns(Request $request) public function getPatterns(Request $request)
{ {
foreach ($this->map as $elements) { foreach ($this->map as $elements) {

View File

@ -64,7 +64,7 @@ class DefaultAuthenticationFailureHandler implements AuthenticationFailureHandle
{ {
if ($failureUrl = $request->get($this->options['failure_path_parameter'], null, true)) { if ($failureUrl = $request->get($this->options['failure_path_parameter'], null, true)) {
$this->options['failure_path'] = $failureUrl; $this->options['failure_path'] = $failureUrl;
} }
if (null === $this->options['failure_path']) { if (null === $this->options['failure_path']) {
$this->options['failure_path'] = $this->options['login_path']; $this->options['failure_path'] = $this->options['login_path'];

View File

@ -12,6 +12,7 @@
namespace Symfony\Component\Security\Http\Authorization; namespace Symfony\Component\Security\Http\Authorization;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;

View File

@ -30,6 +30,9 @@ class BasicAuthenticationEntryPoint implements AuthenticationEntryPointInterface
$this->realmName = $realmName; $this->realmName = $realmName;
} }
/**
* {@inheritdoc}
*/
public function start(Request $request, AuthenticationException $authException = null) public function start(Request $request, AuthenticationException $authException = null)
{ {
$response = new Response(); $response = new Response();

View File

@ -38,6 +38,9 @@ class DigestAuthenticationEntryPoint implements AuthenticationEntryPointInterfac
$this->logger = $logger; $this->logger = $logger;
} }
/**
* {@inheritdoc}
*/
public function start(Request $request, AuthenticationException $authException = null) public function start(Request $request, AuthenticationException $authException = null)
{ {
$expiryTime = microtime(true) + $this->nonceValiditySeconds * 1000; $expiryTime = microtime(true) + $this->nonceValiditySeconds * 1000;
@ -62,11 +65,17 @@ class DigestAuthenticationEntryPoint implements AuthenticationEntryPointInterfac
return $response; return $response;
} }
/**
* @return string
*/
public function getKey() public function getKey()
{ {
return $this->key; return $this->key;
} }
/**
* @return string
*/
public function getRealmName() public function getRealmName()
{ {
return $this->realmName; return $this->realmName;

View File

@ -30,7 +30,7 @@ class FormAuthenticationEntryPoint implements AuthenticationEntryPointInterface
private $httpUtils; private $httpUtils;
/** /**
* Constructor * Constructor.
* *
* @param HttpKernelInterface $kernel * @param HttpKernelInterface $kernel
* @param HttpUtils $httpUtils An HttpUtils instance * @param HttpUtils $httpUtils An HttpUtils instance

View File

@ -34,6 +34,9 @@ class RetryAuthenticationEntryPoint implements AuthenticationEntryPointInterface
$this->httpsPort = $httpsPort; $this->httpsPort = $httpsPort;
} }
/**
* {@inheritdoc}
*/
public function start(Request $request, AuthenticationException $authException = null) public function start(Request $request, AuthenticationException $authException = null)
{ {
$scheme = $request->isSecure() ? 'http' : 'https'; $scheme = $request->isSecure() ? 'http' : 'https';

View File

@ -15,10 +15,14 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
/**
* InteractiveLoginEvent
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class InteractiveLoginEvent extends Event class InteractiveLoginEvent extends Event
{ {
private $request; private $request;
private $authenticationToken; private $authenticationToken;
/** /**

View File

@ -15,10 +15,14 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\Event;
/**
* SwitchUserEvent
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class SwitchUserEvent extends Event class SwitchUserEvent extends Event
{ {
private $request; private $request;
private $targetUser; private $targetUser;
public function __construct(Request $request, UserInterface $targetUser) public function __construct(Request $request, UserInterface $targetUser)
@ -27,11 +31,17 @@ class SwitchUserEvent extends Event
$this->targetUser = $targetUser; $this->targetUser = $targetUser;
} }
/**
* @return Request
*/
public function getRequest() public function getRequest()
{ {
return $this->request; return $this->request;
} }
/**
* @return UserInterface
*/
public function getTargetUser() public function getTargetUser()
{ {
return $this->targetUser; return $this->targetUser;

View File

@ -71,6 +71,9 @@ class Firewall implements EventSubscriberInterface
} }
} }
/**
* {@inheritDoc}
*/
public static function getSubscribedEvents() public static function getSubscribedEvents()
{ {
return array(KernelEvents::REQUEST => array('onKernelRequest', 8)); return array(KernelEvents::REQUEST => array('onKernelRequest', 8));

View File

@ -161,6 +161,13 @@ class ExceptionListener
$event->setResponse($response); $event->setResponse($response);
} }
/**
* @param Request $request
* @param AuthenticationException $authException
*
* @return Response
* @throws AuthenticationException
*/
private function startAuthentication(Request $request, AuthenticationException $authException) private function startAuthentication(Request $request, AuthenticationException $authException)
{ {
if (null === $this->authenticationEntryPoint) { if (null === $this->authenticationEntryPoint) {
@ -181,6 +188,9 @@ class ExceptionListener
return $this->authenticationEntryPoint->start($request, $authException); return $this->authenticationEntryPoint->start($request, $authException);
} }
/**
* @param Request $request
*/
protected function setTargetPath(Request $request) protected function setTargetPath(Request $request)
{ {
// session isn't required when using http basic authentication mechanism for example // session isn't required when using http basic authentication mechanism for example

View File

@ -37,7 +37,7 @@ class LogoutListener implements ListenerInterface
private $csrfProvider; private $csrfProvider;
/** /**
* Constructor * Constructor.
* *
* @param SecurityContextInterface $securityContext * @param SecurityContextInterface $securityContext
* @param HttpUtils $httpUtils An HttpUtilsInterface instance * @param HttpUtils $httpUtils An HttpUtilsInterface instance
@ -77,9 +77,8 @@ class LogoutListener implements ListenerInterface
* *
* @param GetResponseEvent $event A GetResponseEvent instance * @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 \RuntimeException if the LogoutSuccessHandlerInterface instance does not return a response
* @throws LogoutException
*/ */
public function handle(GetResponseEvent $event) public function handle(GetResponseEvent $event)
{ {

View File

@ -35,7 +35,7 @@ class RememberMeListener implements ListenerInterface
private $dispatcher; private $dispatcher;
/** /**
* Constructor * Constructor.
* *
* @param SecurityContextInterface $securityContext * @param SecurityContextInterface $securityContext
* @param RememberMeServicesInterface $rememberMeServices * @param RememberMeServicesInterface $rememberMeServices

View File

@ -36,6 +36,9 @@ class X509AuthenticationListener extends AbstractPreAuthenticatedListener
$this->credentialKey = $credentialKey; $this->credentialKey = $credentialKey;
} }
/**
* {@inheritdoc}
*/
protected function getPreAuthenticatedData(Request $request) protected function getPreAuthenticatedData(Request $request)
{ {
if (!$request->server->has($this->userKey)) { if (!$request->server->has($this->userKey)) {

View File

@ -25,11 +25,19 @@ class FirewallMap implements FirewallMapInterface
{ {
private $map = array(); private $map = array();
/**
* @param RequestMatcherInterface $requestMatcher
* @param array $listeners
* @param ExceptionListener $exceptionListener
*/
public function add(RequestMatcherInterface $requestMatcher = null, array $listeners = array(), ExceptionListener $exceptionListener = null) public function add(RequestMatcherInterface $requestMatcher = null, array $listeners = array(), ExceptionListener $exceptionListener = null)
{ {
$this->map[] = array($requestMatcher, $listeners, $exceptionListener); $this->map[] = array($requestMatcher, $listeners, $exceptionListener);
} }
/**
* {@inheritDoc}
*/
public function getListeners(Request $request) public function getListeners(Request $request)
{ {
foreach ($this->map as $elements) { foreach ($this->map as $elements) {

View File

@ -13,6 +13,7 @@ namespace Symfony\Component\Security\Http;
use Symfony\Component\Security\Core\SecurityContextInterface; use Symfony\Component\Security\Core\SecurityContextInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\Routing\Matcher\UrlMatcherInterface; use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
@ -37,6 +38,8 @@ class HttpUtils
* *
* @param UrlGeneratorInterface $urlGenerator A UrlGeneratorInterface instance * @param UrlGeneratorInterface $urlGenerator A UrlGeneratorInterface instance
* @param UrlMatcherInterface|RequestMatcherInterface $urlMatcher The Url or Request matcher * @param UrlMatcherInterface|RequestMatcherInterface $urlMatcher The Url or Request matcher
*
* @throws \InvalidArgumentException
*/ */
public function __construct(UrlGeneratorInterface $urlGenerator = null, $urlMatcher = null) 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. * Generates a URI, based on the given path or absolute URL.
* *
* @param Request $request A Request instance * @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 * @return string An absolute URL
*
* @throws \LogicException
*/ */
public function generateUri($request, $path) public function generateUri($request, $path)
{ {

View File

@ -40,7 +40,7 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface
private $userProviders; private $userProviders;
/** /**
* Constructor * Constructor.
* *
* @param array $userProviders * @param array $userProviders
* @param string $key * @param string $key
@ -80,6 +80,9 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface
return $this->options['remember_me_parameter']; return $this->options['remember_me_parameter'];
} }
/**
* @return string
*/
public function getKey() public function getKey()
{ {
return $this->key; return $this->key;
@ -94,6 +97,7 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface
* @return TokenInterface|null * @return TokenInterface|null
* *
* @throws CookieTheftException * @throws CookieTheftException
* @throws \RuntimeException
*/ */
final public function autoLogin(Request $request) final public function autoLogin(Request $request)
{ {
@ -219,6 +223,9 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface
*/ */
abstract protected function processAutoLoginCookie(array $cookieParts, Request $request); abstract protected function processAutoLoginCookie(array $cookieParts, Request $request);
/**
* @param Request $request
*/
protected function onLoginFail(Request $request) protected function onLoginFail(Request $request)
{ {
} }

View File

@ -22,6 +22,9 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
*/ */
class ResponseListener implements EventSubscriberInterface class ResponseListener implements EventSubscriberInterface
{ {
/**
* @param FilterResponseEvent $event
*/
public function onKernelResponse(FilterResponseEvent $event) public function onKernelResponse(FilterResponseEvent $event)
{ {
$request = $event->getRequest(); $request = $event->getRequest();
@ -32,6 +35,9 @@ class ResponseListener implements EventSubscriberInterface
} }
} }
/**
* {@inheritDoc}
*/
public static function getSubscribedEvents() public static function getSubscribedEvents()
{ {
return array(KernelEvents::RESPONSE => 'onKernelResponse'); return array(KernelEvents::RESPONSE => 'onKernelResponse');