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

Commit 4ac97ec

Browse files
Merge branch '4.1'
* 4.1: SCA: removed unused variables Remove duplicate condition fix useless space in docblock remove unneeded tearDown method [Intl] Update the ICU data to 63.1 [FrameworkBundle] Fix broken exception message [Messenger] send using the routing_key for AMQP transport also clean away the NO_AUTO_CACHE_CONTROL_HEADER if we have no session [TwigBundle] Fix usage of TwigBundle without FrameworkBundle Revert "fixed CS" [Serializer] Reduce class discriminator overhead Skip empty proxy code [Security] Fix "exclude-from-classmap" [Security] Removed unsed trait import [Config] Fix @method annotation add missing double-quotes to extra_fields output message [DI] Default undefined env to empty string during compile Convert InsufficientAuthenticationException to HttpException
2 parents 65745b2 + 7fc8070 commit 4ac97ec

File tree

5 files changed

+14
-18
lines changed

5 files changed

+14
-18
lines changed

Guard/Authenticator/AbstractFormLoginAuthenticator.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use Symfony\Component\Security\Core\Exception\AuthenticationException;
1717
use Symfony\Component\Security\Core\Security;
1818
use Symfony\Component\Security\Guard\AbstractGuardAuthenticator;
19-
use Symfony\Component\Security\Http\Util\TargetPathTrait;
2019

2120
/**
2221
* A base class to make form login authentication easier!
@@ -25,8 +24,6 @@
2524
*/
2625
abstract class AbstractFormLoginAuthenticator extends AbstractGuardAuthenticator
2726
{
28-
use TargetPathTrait;
29-
3027
/**
3128
* Return the URL to the login page.
3229
*

Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,6 @@ protected function setUp()
9191
->setDefaultSuccessRedirectUrl(self::DEFAULT_SUCCESS_URL)
9292
;
9393
}
94-
95-
protected function tearDown()
96-
{
97-
$this->request = null;
98-
$this->requestWithSession = null;
99-
}
10094
}
10195

10296
class TestFormLoginAuthenticator extends AbstractFormLoginAuthenticator

Http/Firewall/ExceptionListener.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Symfony\Component\HttpFoundation\Response;
1818
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
1919
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
20+
use Symfony\Component\HttpKernel\Exception\HttpException;
2021
use Symfony\Component\HttpKernel\HttpKernelInterface;
2122
use Symfony\Component\HttpKernel\KernelEvents;
2223
use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface;
@@ -171,7 +172,7 @@ private function handleLogoutException(LogoutException $exception): void
171172
private function startAuthentication(Request $request, AuthenticationException $authException): Response
172173
{
173174
if (null === $this->authenticationEntryPoint) {
174-
throw $authException;
175+
throw new HttpException(Response::HTTP_UNAUTHORIZED, $authException->getMessage(), $authException, array(), $authException->getCode());
175176
}
176177

177178
if (null !== $this->logger) {

Http/Tests/Firewall/ExceptionListenerTest.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Symfony\Component\HttpFoundation\Request;
1616
use Symfony\Component\HttpFoundation\Response;
1717
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
18+
use Symfony\Component\HttpKernel\Exception\HttpException;
1819
use Symfony\Component\HttpKernel\HttpKernelInterface;
1920
use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface;
2021
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
@@ -30,15 +31,15 @@ class ExceptionListenerTest extends TestCase
3031
/**
3132
* @dataProvider getAuthenticationExceptionProvider
3233
*/
33-
public function testAuthenticationExceptionWithoutEntryPoint(\Exception $exception, \Exception $eventException = null)
34+
public function testAuthenticationExceptionWithoutEntryPoint(\Exception $exception, \Exception $eventException)
3435
{
3536
$event = $this->createEvent($exception);
3637

3738
$listener = $this->createExceptionListener();
3839
$listener->onKernelException($event);
3940

4041
$this->assertNull($event->getResponse());
41-
$this->assertSame(null === $eventException ? $exception : $eventException, $event->getException());
42+
$this->assertEquals($eventException, $event->getException());
4243
}
4344

4445
/**
@@ -63,11 +64,11 @@ public function testAuthenticationExceptionWithEntryPoint(\Exception $exception)
6364
public function getAuthenticationExceptionProvider()
6465
{
6566
return array(
66-
array(new AuthenticationException()),
67-
array(new \LogicException('random', 0, $e = new AuthenticationException()), $e),
68-
array(new \LogicException('random', 0, $e = new AuthenticationException('embed', 0, new AuthenticationException())), $e),
69-
array(new \LogicException('random', 0, $e = new AuthenticationException('embed', 0, new AccessDeniedException())), $e),
70-
array(new AuthenticationException('random', 0, new \LogicException())),
67+
array($e = new AuthenticationException(), new HttpException(Response::HTTP_UNAUTHORIZED, '', $e, array(), 0)),
68+
array(new \LogicException('random', 0, $e = new AuthenticationException()), new HttpException(Response::HTTP_UNAUTHORIZED, '', $e, array(), 0)),
69+
array(new \LogicException('random', 0, $e = new AuthenticationException('embed', 0, new AuthenticationException())), new HttpException(Response::HTTP_UNAUTHORIZED, 'embed', $e, array(), 0)),
70+
array(new \LogicException('random', 0, $e = new AuthenticationException('embed', 0, new AccessDeniedException())), new HttpException(Response::HTTP_UNAUTHORIZED, 'embed', $e, array(), 0)),
71+
array($e = new AuthenticationException('random', 0, new \LogicException()), new HttpException(Response::HTTP_UNAUTHORIZED, 'random', $e, array(), 0)),
7172
);
7273
}
7374

composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@
5050
"autoload": {
5151
"psr-4": { "Symfony\\Component\\Security\\": "" },
5252
"exclude-from-classmap": [
53-
"/Tests/"
53+
"/Core/Tests/",
54+
"/Csrf/Tests/",
55+
"/Guard/Tests/",
56+
"/Http/Tests/"
5457
]
5558
},
5659
"minimum-stability": "dev",

0 commit comments

Comments
 (0)