Skip to content
This repository was archived by the owner on May 31, 2024. It is now read-only.

Commit 6c3c1e2

Browse files
lyrixxfabpot
authored andcommitted
[Security] Do not save the target path in the session for a stateless firewall
1 parent 39fae4d commit 6c3c1e2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Http/Firewall/ExceptionListener.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ class ExceptionListener
4646
private $errorPage;
4747
private $logger;
4848
private $httpUtils;
49+
private $stateless;
4950

50-
public function __construct(SecurityContextInterface $context, AuthenticationTrustResolverInterface $trustResolver, HttpUtils $httpUtils, $providerKey, AuthenticationEntryPointInterface $authenticationEntryPoint = null, $errorPage = null, AccessDeniedHandlerInterface $accessDeniedHandler = null, LoggerInterface $logger = null)
51+
public function __construct(SecurityContextInterface $context, AuthenticationTrustResolverInterface $trustResolver, HttpUtils $httpUtils, $providerKey, AuthenticationEntryPointInterface $authenticationEntryPoint = null, $errorPage = null, AccessDeniedHandlerInterface $accessDeniedHandler = null, LoggerInterface $logger = null, $stateless = false)
5152
{
5253
$this->context = $context;
5354
$this->accessDeniedHandler = $accessDeniedHandler;
@@ -57,6 +58,7 @@ public function __construct(SecurityContextInterface $context, AuthenticationTru
5758
$this->authenticationTrustResolver = $trustResolver;
5859
$this->errorPage = $errorPage;
5960
$this->logger = $logger;
61+
$this->stateless = $stateless;
6062
}
6163

6264
/**
@@ -178,7 +180,9 @@ private function startAuthentication(Request $request, AuthenticationException $
178180
$this->logger->debug('Calling Authentication entry point');
179181
}
180182

181-
$this->setTargetPath($request);
183+
if (!$this->stateless) {
184+
$this->setTargetPath($request);
185+
}
182186

183187
if ($authException instanceof AccountStatusException) {
184188
// remove the security token to prevent infinite redirect loops

0 commit comments

Comments
 (0)