Skip to content

Commit

Permalink
minor#8823 [Security] [2.2] Added doc comments and missing use statem…
Browse files Browse the repository at this point in the history
…ent (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
  • Loading branch information
fabpot committed Sep 27, 2013
2 parents 54e2abd + 7ee39a6 commit 279a686
Show file tree
Hide file tree
Showing 18 changed files with 84 additions and 10 deletions.
3 changes: 3 additions & 0 deletions src/Symfony/Component/Security/Http/AccessMap.php
Expand Up @@ -36,6 +36,9 @@ public function add(RequestMatcherInterface $requestMatcher, array $roles = arra
$this->map[] = array($requestMatcher, $roles, $channel);
}

/**
* {@inheritDoc}
*/
public function getPatterns(Request $request)
{
foreach ($this->map as $elements) {
Expand Down
Expand Up @@ -64,7 +64,7 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio
{
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'];
Expand Down
Expand Up @@ -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;

Expand Down
Expand Up @@ -30,6 +30,9 @@ public function __construct($realmName)
$this->realmName = $realmName;
}

/**
* {@inheritdoc}
*/
public function start(Request $request, AuthenticationException $authException = null)
{
$response = new Response();
Expand Down
Expand Up @@ -38,6 +38,9 @@ public function __construct($realmName, $key, $nonceValiditySeconds = 300, Logge
$this->logger = $logger;
}

/**
* {@inheritdoc}
*/
public function start(Request $request, AuthenticationException $authException = null)
{
$expiryTime = microtime(true) + $this->nonceValiditySeconds * 1000;
Expand All @@ -62,11 +65,17 @@ public function start(Request $request, AuthenticationException $authException =
return $response;
}

/**
* @return string
*/
public function getKey()
{
return $this->key;
}

/**
* @return string
*/
public function getRealmName()
{
return $this->realmName;
Expand Down
Expand Up @@ -30,7 +30,7 @@ class FormAuthenticationEntryPoint implements AuthenticationEntryPointInterface
private $httpUtils;

/**
* Constructor
* Constructor.
*
* @param HttpKernelInterface $kernel
* @param HttpUtils $httpUtils An HttpUtils instance
Expand Down
Expand Up @@ -34,6 +34,9 @@ public function __construct($httpPort = 80, $httpsPort = 443)
$this->httpsPort = $httpsPort;
}

/**
* {@inheritdoc}
*/
public function start(Request $request, AuthenticationException $authException = null)
{
$scheme = $request->isSecure() ? 'http' : 'https';
Expand Down
Expand Up @@ -15,10 +15,14 @@
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;

/**
* InteractiveLoginEvent
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class InteractiveLoginEvent extends Event
{
private $request;

private $authenticationToken;

/**
Expand Down
12 changes: 11 additions & 1 deletion src/Symfony/Component/Security/Http/Event/SwitchUserEvent.php
Expand Up @@ -15,10 +15,14 @@
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\EventDispatcher\Event;

/**
* SwitchUserEvent
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class SwitchUserEvent extends Event
{
private $request;

private $targetUser;

public function __construct(Request $request, UserInterface $targetUser)
Expand All @@ -27,11 +31,17 @@ public function __construct(Request $request, UserInterface $targetUser)
$this->targetUser = $targetUser;
}

/**
* @return Request
*/
public function getRequest()
{
return $this->request;
}

/**
* @return UserInterface
*/
public function getTargetUser()
{
return $this->targetUser;
Expand Down
3 changes: 3 additions & 0 deletions src/Symfony/Component/Security/Http/Firewall.php
Expand Up @@ -71,6 +71,9 @@ public function onKernelRequest(GetResponseEvent $event)
}
}

/**
* {@inheritDoc}
*/
public static function getSubscribedEvents()
{
return array(KernelEvents::REQUEST => array('onKernelRequest', 8));
Expand Down
10 changes: 10 additions & 0 deletions src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php
Expand Up @@ -161,6 +161,13 @@ public function onKernelException(GetResponseForExceptionEvent $event)
$event->setResponse($response);
}

/**
* @param Request $request
* @param AuthenticationException $authException
*
* @return Response
* @throws AuthenticationException
*/
private function startAuthentication(Request $request, AuthenticationException $authException)
{
if (null === $this->authenticationEntryPoint) {
Expand All @@ -181,6 +188,9 @@ private function startAuthentication(Request $request, AuthenticationException $
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
Expand Down
Expand Up @@ -37,7 +37,7 @@ class LogoutListener implements ListenerInterface
private $csrfProvider;

/**
* Constructor
* Constructor.
*
* @param SecurityContextInterface $securityContext
* @param HttpUtils $httpUtils An HttpUtilsInterface instance
Expand Down Expand Up @@ -77,9 +77,8 @@ public function addHandler(LogoutHandlerInterface $handler)
*
* @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)
{
Expand Down
Expand Up @@ -35,7 +35,7 @@ class RememberMeListener implements ListenerInterface
private $dispatcher;

/**
* Constructor
* Constructor.
*
* @param SecurityContextInterface $securityContext
* @param RememberMeServicesInterface $rememberMeServices
Expand Down
Expand Up @@ -36,6 +36,9 @@ public function __construct(SecurityContextInterface $securityContext, Authentic
$this->credentialKey = $credentialKey;
}

/**
* {@inheritdoc}
*/
protected function getPreAuthenticatedData(Request $request)
{
if (!$request->server->has($this->userKey)) {
Expand Down
8 changes: 8 additions & 0 deletions src/Symfony/Component/Security/Http/FirewallMap.php
Expand Up @@ -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) {
Expand Down
7 changes: 6 additions & 1 deletion src/Symfony/Component/Security/Http/HttpUtils.php
Expand Up @@ -13,6 +13,7 @@

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;
Expand All @@ -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)
{
Expand Down Expand Up @@ -123,9 +126,11 @@ public function checkRequestPath(Request $request, $path)
* 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)
{
Expand Down
Expand Up @@ -40,7 +40,7 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface
private $userProviders;

/**
* Constructor
* Constructor.
*
* @param array $userProviders
* @param string $key
Expand Down Expand Up @@ -80,6 +80,9 @@ public function getRememberMeParameter()
return $this->options['remember_me_parameter'];
}

/**
* @return string
*/
public function getKey()
{
return $this->key;
Expand All @@ -94,6 +97,7 @@ public function getKey()
* @return TokenInterface|null
*
* @throws CookieTheftException
* @throws \RuntimeException
*/
final public function autoLogin(Request $request)
{
Expand Down Expand Up @@ -219,6 +223,9 @@ final public function loginSuccess(Request $request, Response $response, TokenIn
*/
abstract protected function processAutoLoginCookie(array $cookieParts, Request $request);

/**
* @param Request $request
*/
protected function onLoginFail(Request $request)
{
}
Expand Down
Expand Up @@ -22,6 +22,9 @@
*/
class ResponseListener implements EventSubscriberInterface
{
/**
* @param FilterResponseEvent $event
*/
public function onKernelResponse(FilterResponseEvent $event)
{
$request = $event->getRequest();
Expand All @@ -32,6 +35,9 @@ public function onKernelResponse(FilterResponseEvent $event)
}
}

/**
* {@inheritDoc}
*/
public static function getSubscribedEvents()
{
return array(KernelEvents::RESPONSE => 'onKernelResponse');
Expand Down

0 comments on commit 279a686

Please sign in to comment.