Skip to content

Commit 3d9deb4

Browse files
committed
Merge branch '2.2' into 2.3
* 2.2: Fix some annotates [FrameworkBundle] made sure that the debug event dispatcher is used everywhere [HttpKernel] remove unneeded strtoupper updated the composer install command to reflect changes in Composer Conflicts: src/Symfony/Component/Console/Application.php src/Symfony/Component/Console/Command/Command.php src/Symfony/Component/Console/Input/InputDefinition.php src/Symfony/Component/CssSelector/Node/CombinedSelectorNode.php src/Symfony/Component/Form/Form.php src/Symfony/Component/HttpKernel/Debug/ErrorHandler.php src/Symfony/Component/HttpKernel/DependencyInjection/RegisterListenersPass.php src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RegisterListenersPassTest.php src/Symfony/Component/Locale/Locale.php src/Symfony/Component/Locale/README.md src/Symfony/Component/Locale/Stub/DateFormat/FullTransformer.php
1 parent e77a699 commit 3d9deb4

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

EntryPoint/FormAuthenticationEntryPoint.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@ public function start(Request $request, AuthenticationException $authException =
5353
if ($this->useForward) {
5454
$subRequest = $this->httpUtils->createRequest($request, $this->loginPath);
5555

56-
return $this->httpKernel->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
56+
$response = $this->httpKernel->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
57+
if (200 === $response->getStatusCode()) {
58+
$response->headers->set('X-Status-Code', 401);
59+
}
60+
61+
return $response;
5762
}
5863

5964
return $this->httpUtils->createRedirectResponse($request, $this->loginPath);

Firewall/AbstractAuthenticationListener.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,14 @@ public function __construct(SecurityContextInterface $securityContext, Authentic
9393
$this->failureHandler = $failureHandler;
9494
$this->options = array_merge(array(
9595
'check_path' => '/login_check',
96+
'login_path' => '/login',
97+
'always_use_default_target_path' => false,
98+
'default_target_path' => '/',
99+
'target_path_parameter' => '_target_path',
100+
'use_referer' => false,
101+
'failure_path' => null,
102+
'failure_forward' => false,
103+
'require_previous_session' => true,
96104
), $options);
97105
$this->logger = $logger;
98106
$this->dispatcher = $dispatcher;
@@ -130,7 +138,7 @@ final public function handle(GetResponseEvent $event)
130138
}
131139

132140
try {
133-
if (!$request->hasPreviousSession()) {
141+
if ($this->options['require_previous_session'] && !$request->hasPreviousSession()) {
134142
throw new SessionUnavailableException('Your session has timed out, or you have disabled cookies.');
135143
}
136144

Firewall/AnonymousAuthenticationListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function handle(GetResponseEvent $event)
4949
$this->context->setToken(new AnonymousToken($this->key, 'anon.', array()));
5050

5151
if (null !== $this->logger) {
52-
$this->logger->info(sprintf('Populated SecurityContext with an anonymous Token'));
52+
$this->logger->info('Populated SecurityContext with an anonymous Token');
5353
}
5454
}
5555
}

Firewall/ExceptionListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ protected function setTargetPath(Request $request)
185185
{
186186
// session isn't required when using http basic authentication mechanism for example
187187
if ($request->hasSession() && $request->isMethodSafe()) {
188-
$request->getSession()->set('_security.' . $this->providerKey . '.target_path', $request->getUri());
188+
$request->getSession()->set('_security.'.$this->providerKey.'.target_path', $request->getUri());
189189
}
190190
}
191191
}

0 commit comments

Comments
 (0)