Skip to content

Commit a56dbec

Browse files
committed
[Security] removed un-needed event parameter from many interfaces
1 parent f36b10a commit a56dbec

13 files changed

+27
-34
lines changed

src/Symfony/Bundle/SecurityBundle/Resources/config/security_listeners.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@
8181
<service id="security.logout.handler.session" class="%security.logout.handler.session.class%" public="false" />
8282
<service id="security.logout.handler.cookie_clearing" class="%security.logout.handler.cookie_clearing.class%" public="false" abstract="true" />
8383

84-
<service id="security.authentication.form_entry_point" class="%security.authentication.form_entry_point.class%" public="false" abstract="true" />
84+
<service id="security.authentication.form_entry_point" class="%security.authentication.form_entry_point.class%" public="false" abstract="true">
85+
<argument type="service" id="http_kernel" />
86+
</service>
8587

8688
<service id="security.authentication.listener.abstract" abstract="true" public="false">
8789
<argument type="service" id="security.context" />

src/Symfony/Component/Security/Http/Authentication/AuthenticationFailureHandlerInterface.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Symfony\Component\Security\Http\Authentication;
44

5-
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
65
use Symfony\Component\Security\Core\Exception\AuthenticationException;
76
use Symfony\Component\HttpFoundation\Request;
87

@@ -22,12 +21,10 @@ interface AuthenticationFailureHandlerInterface
2221
* called by authentication listeners inheriting from
2322
* AbstractAuthenticationListener.
2423
*
25-
* @param GetResponseEvent $event the "onCoreRequest" event, this event always
26-
* has the kernel as target
2724
* @param Request $request
2825
* @param AuthenticationException $exception
2926
*
3027
* @return Response the response to return
3128
*/
32-
function onAuthenticationFailure(GetResponseEvent $event, Request $request, AuthenticationException $exception);
29+
function onAuthenticationFailure(Request $request, AuthenticationException $exception);
3330
}

src/Symfony/Component/Security/Http/Authentication/AuthenticationSuccessHandlerInterface.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Symfony\Component\Security\Http\Authentication;
44

5-
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
65
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
76
use Symfony\Component\HttpFoundation\Request;
87

@@ -22,12 +21,10 @@ interface AuthenticationSuccessHandlerInterface
2221
* is called by authentication listeners inheriting from
2322
* AbstractAuthenticationListener.
2423
*
25-
* @param GetResponseEvent $event the "onCoreRequest" event, this event always
26-
* has the kernel as target
2724
* @param Request $request
2825
* @param TokenInterface $token
2926
*
3027
* @return Response the response to return
3128
*/
32-
function onAuthenticationSuccess(GetResponseEvent $event, Request $request, TokenInterface $token);
29+
function onAuthenticationSuccess(Request $request, TokenInterface $token);
3330
}

src/Symfony/Component/Security/Http/Authorization/AccessDeniedHandlerInterface.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,10 @@ interface AccessDeniedHandlerInterface
1818
/**
1919
* Handles an access denied failure.
2020
*
21-
* @param GetResponseForExceptionEvent $event
2221
* @param Request $request
2322
* @param AccessDeniedException $accessDeniedException
2423
*
2524
* @return Response may return null
2625
*/
27-
function handle(GetResponseForExceptionEvent $event, Request $request, AccessDeniedException $accessDeniedException);
26+
function handle(Request $request, AccessDeniedException $accessDeniedException);
2827
}

src/Symfony/Component/Security/Http/EntryPoint/AuthenticationEntryPointInterface.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Component\Security\Http\EntryPoint;
1313

14-
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
1514
use Symfony\Component\Security\Core\Exception\AuthenticationException;
1615
use Symfony\Component\HttpFoundation\Request;
1716

@@ -26,9 +25,10 @@ interface AuthenticationEntryPointInterface
2625
/**
2726
* Starts the authentication scheme.
2827
*
29-
* @param GetResponseEvent $event The "onCoreRequest" event
30-
* @param object $request The request that resulted in an AuthenticationException
28+
* @param Request $request The request that resulted in an AuthenticationException
3129
* @param AuthenticationException $authException The exception that started the authentication process
30+
*
31+
* @return Response
3232
*/
33-
function start(GetResponseEvent $event, Request $request, AuthenticationException $authException = null);
33+
function start(Request $request, AuthenticationException $authException = null);
3434
}

src/Symfony/Component/Security/Http/EntryPoint/BasicAuthenticationEntryPoint.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
1616
use Symfony\Component\HttpFoundation\Response;
1717
use Symfony\Component\HttpFoundation\Request;
18-
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
1918

2019
/**
2120
* BasicAuthenticationEntryPoint starts an HTTP Basic authentication.
@@ -31,7 +30,7 @@ public function __construct($realmName)
3130
$this->realmName = $realmName;
3231
}
3332

34-
public function start(GetResponseEvent $event, Request $request, AuthenticationException $authException = null)
33+
public function start(Request $request, AuthenticationException $authException = null)
3534
{
3635
$response = new Response();
3736
$response->headers->set('WWW-Authenticate', sprintf('Basic realm="%s"', $this->realmName));

src/Symfony/Component/Security/Http/EntryPoint/DigestAuthenticationEntryPoint.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use Symfony\Component\HttpFoundation\Response;
1818
use Symfony\Component\HttpFoundation\Request;
1919
use Symfony\Component\HttpKernel\Log\LoggerInterface;
20-
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
2120

2221
/**
2322
* DigestAuthenticationEntryPoint starts an HTTP Digest authentication.
@@ -39,7 +38,7 @@ public function __construct($realmName, $key, $nonceValiditySeconds = 300, Logge
3938
$this->logger = $logger;
4039
}
4140

42-
public function start(GetResponseEvent $event, Request $request, AuthenticationException $authException = null)
41+
public function start(Request $request, AuthenticationException $authException = null)
4342
{
4443
$expiryTime = microtime(true) + $this->nonceValiditySeconds * 1000;
4544
$signatureValue = md5($expiryTime.':'.$this->key);

src/Symfony/Component/Security/Http/EntryPoint/FormAuthenticationEntryPoint.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use Symfony\Component\Security\Core\Exception\AuthenticationException;
1818
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
1919
use Symfony\Component\HttpKernel\HttpKernelInterface;
20-
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
2120

2221
/**
2322
* FormAuthenticationEntryPoint starts an authentication via a login form.
@@ -28,26 +27,29 @@ class FormAuthenticationEntryPoint implements AuthenticationEntryPointInterface
2827
{
2928
private $loginPath;
3029
private $useForward;
30+
private $httpKernel;
3131

3232
/**
3333
* Constructor
3434
*
35+
* @param HttpKernelInterface $kernel
3536
* @param string $loginPath The path to the login form
3637
* @param Boolean $useForward Whether to forward or redirect to the login form
3738
*/
38-
public function __construct($loginPath, $useForward = false)
39+
public function __construct(HttpKernelInterface $kernel, $loginPath, $useForward = false)
3940
{
41+
$this->httpKernel = $kernel;
4042
$this->loginPath = $loginPath;
4143
$this->useForward = (Boolean) $useForward;
4244
}
4345

4446
/**
4547
* {@inheritdoc}
4648
*/
47-
public function start(GetResponseEvent $event, Request $request, AuthenticationException $authException = null)
49+
public function start(Request $request, AuthenticationException $authException = null)
4850
{
4951
if ($this->useForward) {
50-
return $event->getKernel()->handle(Request::create($this->loginPath), HttpKernelInterface::SUB_REQUEST);
52+
return $this->httpKernel->handle(Request::create($this->loginPath), HttpKernelInterface::SUB_REQUEST);
5153
}
5254

5355
return new RedirectResponse(0 !== strpos($this->loginPath, 'http') ? $request->getUriForPath($this->loginPath) : $this->loginPath, 302);

src/Symfony/Component/Security/Http/EntryPoint/RetryAuthenticationEntryPoint.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use Symfony\Component\HttpFoundation\Response;
1717
use Symfony\Component\HttpFoundation\RedirectResponse;
1818
use Symfony\Component\HttpFoundation\Request;
19-
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
2019

2120
/**
2221
* RetryAuthenticationEntryPoint redirects URL based on the configured scheme.
@@ -36,7 +35,7 @@ public function __construct($httpPort = 80, $httpsPort = 443)
3635
$this->httpsPort = $httpsPort;
3736
}
3837

39-
public function start(GetResponseEvent $event, Request $request, AuthenticationException $authException = null)
38+
public function start(Request $request, AuthenticationException $authException = null)
4039
{
4140
$scheme = $request->isSecure() ? 'http' : 'https';
4241
if ('http' === $scheme && 80 != $this->httpPort) {

src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ private function onFailure(GetResponseEvent $event, Request $request, Authentica
174174
$this->securityContext->setToken(null);
175175

176176
if (null !== $this->failureHandler) {
177-
return $this->failureHandler->onAuthenticationFailure($event, $request, $failed);
177+
return $this->failureHandler->onAuthenticationFailure($request, $failed);
178178
}
179179

180180
if (null === $this->options['failure_path']) {
@@ -219,7 +219,7 @@ private function onSuccess(GetResponseEvent $event, Request $request, TokenInter
219219
}
220220

221221
if (null !== $this->successHandler) {
222-
$response = $this->successHandler->onAuthenticationSuccess($event, $request, $token);
222+
$response = $this->successHandler->onAuthenticationSuccess($request, $token);
223223
} else {
224224
$path = $this->determineTargetUrl($request);
225225
$response = new RedirectResponse(0 !== strpos($path, 'http') ? $request->getUriForPath($path) : $path, 302);

src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function onCoreException(GetResponseForExceptionEvent $event)
7878
}
7979

8080
try {
81-
$response = $this->startAuthentication($event, $request, $exception);
81+
$response = $this->startAuthentication($request, $exception);
8282
} catch (\Exception $e) {
8383
$event->set('exception', $e);
8484

@@ -92,7 +92,7 @@ public function onCoreException(GetResponseForExceptionEvent $event)
9292
}
9393

9494
try {
95-
$response = $this->startAuthentication($event, $request, new InsufficientAuthenticationException('Full authentication is required to access this resource.', $token, 0, $exception));
95+
$response = $this->startAuthentication($request, new InsufficientAuthenticationException('Full authentication is required to access this resource.', $token, 0, $exception));
9696
} catch (\Exception $e) {
9797
$event->set('exception', $e);
9898

@@ -105,7 +105,7 @@ public function onCoreException(GetResponseForExceptionEvent $event)
105105

106106
try {
107107
if (null !== $this->accessDeniedHandler) {
108-
$response = $this->accessDeniedHandler->handle($event, $request, $exception);
108+
$response = $this->accessDeniedHandler->handle($request, $exception);
109109

110110
if (!$response instanceof Response) {
111111
return;
@@ -155,6 +155,6 @@ private function startAuthentication(GetResponseForExceptionEvent $event, Reques
155155
$request->getSession()->set('_security.target_path', $request->getUri());
156156
}
157157

158-
return $this->authenticationEntryPoint->start($event, $request, $authException);
158+
return $this->authenticationEntryPoint->start($request, $authException);
159159
}
160160
}

src/Symfony/Component/Security/Http/Firewall/LogoutListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function handle(GetResponseEvent $event)
7474
}
7575

7676
if (null !== $this->successHandler) {
77-
$response = $this->successHandler->onLogoutSuccess($event, $request);
77+
$response = $this->successHandler->onLogoutSuccess($request);
7878

7979
if (!$response instanceof Response) {
8080
throw new \RuntimeException('Logout Success Handler did not return a Response.');

src/Symfony/Component/Security/Http/Logout/LogoutSuccessHandlerInterface.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ interface LogoutSuccessHandlerInterface
2121
/**
2222
* Creates a Response object to send upon a successful logout.
2323
*
24-
* @param GetResponseEvent $event
2524
* @param Request $request
2625
* @return Response never null
2726
*/
28-
function onLogoutSuccess(GetResponseEvent $event, Request $request);
27+
function onLogoutSuccess(Request $request);
2928
}

0 commit comments

Comments
 (0)