Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5ba4d1d

Browse filesBrowse files
committed
Renamed VerifyAuthenticatorCredentialsEvent to CheckPassportEvent
1 parent c30d6f9 commit 5ba4d1d
Copy full SHA for 5ba4d1d

File tree

12 files changed

+79
-45
lines changed
Filter options

12 files changed

+79
-45
lines changed

‎src/Symfony/Bundle/SecurityBundle/EventListener/FirewallEventBubblingListener.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/EventListener/FirewallEventBubblingListener.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
namespace Symfony\Bundle\SecurityBundle\EventListener;
1313

1414
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
15+
use Symfony\Component\Security\Http\Event\CheckPassportEvent;
1516
use Symfony\Component\Security\Http\Event\LoginFailureEvent;
1617
use Symfony\Component\Security\Http\Event\LoginSuccessEvent;
1718
use Symfony\Component\Security\Http\Event\LogoutEvent;
18-
use Symfony\Component\Security\Http\Event\VerifyAuthenticatorCredentialsEvent;
1919
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
2020

2121
/**
@@ -39,7 +39,7 @@ public static function getSubscribedEvents(): array
3939
LogoutEvent::class => 'bubbleEvent',
4040
LoginFailureEvent::class => 'bubbleEvent',
4141
LoginSuccessEvent::class => 'bubbleEvent',
42-
VerifyAuthenticatorCredentialsEvent::class => 'bubbleEvent',
42+
CheckPassportEvent::class => 'bubbleEvent',
4343
];
4444
}
4545

‎src/Symfony/Bundle/SecurityBundle/Resources/config/security_authenticator.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Resources/config/security_authenticator.xml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
<!-- Listeners -->
4646

47-
<service id="security.listener.verify_authenticator_credentials" class="Symfony\Component\Security\Http\EventListener\VerifyAuthenticatorCredentialsListener">
47+
<service id="security.listener.check_authenticator_credentials" class="Symfony\Component\Security\Http\EventListener\CheckCredentialsListener">
4848
<tag name="kernel.event_subscriber" />
4949
<argument type="service" id="security.encoder_factory" />
5050
</service>

‎src/Symfony/Component/Security/Http/Authentication/AuthenticatorManager.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Http/Authentication/AuthenticatorManager.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\BadgeInterface;
2727
use Symfony\Component\Security\Http\Authenticator\Passport\PassportInterface;
2828
use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport;
29+
use Symfony\Component\Security\Http\Event\CheckPassportEvent;
2930
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
3031
use Symfony\Component\Security\Http\Event\LoginFailureEvent;
3132
use Symfony\Component\Security\Http\Event\LoginSuccessEvent;
32-
use Symfony\Component\Security\Http\Event\VerifyAuthenticatorCredentialsEvent;
3333
use Symfony\Component\Security\Http\SecurityEvents;
3434
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
3535

@@ -159,7 +159,7 @@ private function executeAuthenticator(AuthenticatorInterface $authenticator, Req
159159
$passport = $authenticator->authenticate($request);
160160

161161
// check the passport (e.g. password checking)
162-
$event = new VerifyAuthenticatorCredentialsEvent($authenticator, $passport);
162+
$event = new CheckPassportEvent($authenticator, $passport);
163163
$this->eventDispatcher->dispatch($event);
164164

165165
// check if all badges are resolved

‎src/Symfony/Component/Security/Http/Authenticator/Token/PostAuthenticationToken.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Http/Authenticator/Token/PostAuthenticationToken.php
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Component\Security\Http\Authenticator\Token;
413

514
use Symfony\Component\Security\Core\Authentication\Token\AbstractToken;

‎src/Symfony/Component/Security/Http/Event/VerifyAuthenticatorCredentialsEvent.php renamed to ‎src/Symfony/Component/Security/Http/Event/CheckPassportEvent.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Http/Event/CheckPassportEvent.php
+10-3Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Component\Security\Http\Event;
413

5-
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
6-
use Symfony\Component\Security\Core\User\UserInterface;
714
use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface;
815
use Symfony\Component\Security\Http\Authenticator\Passport\PassportInterface;
916
use Symfony\Contracts\EventDispatcher\Event;
@@ -17,7 +24,7 @@
1724
*
1825
* @author Wouter de Jong <wouter@wouterj.nl>
1926
*/
20-
class VerifyAuthenticatorCredentialsEvent extends Event
27+
class CheckPassportEvent extends Event
2128
{
2229
private $authenticator;
2330
private $passport;
+13-4Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Component\Security\Http\EventListener;
413

514
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
@@ -8,7 +17,7 @@
817
use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\CustomCredentials;
918
use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\PasswordCredentials;
1019
use Symfony\Component\Security\Http\Authenticator\Passport\UserPassportInterface;
11-
use Symfony\Component\Security\Http\Event\VerifyAuthenticatorCredentialsEvent;
20+
use Symfony\Component\Security\Http\Event\CheckPassportEvent;
1221

1322
/**
1423
* This listeners uses the interfaces of authenticators to
@@ -19,7 +28,7 @@
1928
* @final
2029
* @experimental in 5.1
2130
*/
22-
class VerifyAuthenticatorCredentialsListener implements EventSubscriberInterface
31+
class CheckCredentialsListener implements EventSubscriberInterface
2332
{
2433
private $encoderFactory;
2534

@@ -28,7 +37,7 @@ public function __construct(EncoderFactoryInterface $encoderFactory)
2837
$this->encoderFactory = $encoderFactory;
2938
}
3039

31-
public function onAuthenticating(VerifyAuthenticatorCredentialsEvent $event): void
40+
public function checkPassport(CheckPassportEvent $event): void
3241
{
3342
$passport = $event->getPassport();
3443
if ($passport instanceof UserPassportInterface && $passport->hasBadge(PasswordCredentials::class)) {
@@ -74,6 +83,6 @@ public function onAuthenticating(VerifyAuthenticatorCredentialsEvent $event): vo
7483

7584
public static function getSubscribedEvents(): array
7685
{
77-
return [VerifyAuthenticatorCredentialsEvent::class => ['onAuthenticating', 128]];
86+
return [CheckPassportEvent::class => 'checkPassport'];
7887
}
7988
}

‎src/Symfony/Component/Security/Http/EventListener/CsrfProtectionListener.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Http/EventListener/CsrfProtectionListener.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Symfony\Component\Security\Csrf\CsrfToken;
1717
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
1818
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\CsrfTokenBadge;
19-
use Symfony\Component\Security\Http\Event\VerifyAuthenticatorCredentialsEvent;
19+
use Symfony\Component\Security\Http\Event\CheckPassportEvent;
2020

2121
/**
2222
* @author Wouter de Jong <wouter@wouterj.nl>
@@ -33,7 +33,7 @@ public function __construct(CsrfTokenManagerInterface $csrfTokenManager)
3333
$this->csrfTokenManager = $csrfTokenManager;
3434
}
3535

36-
public function verifyCredentials(VerifyAuthenticatorCredentialsEvent $event): void
36+
public function checkPassport(CheckPassportEvent $event): void
3737
{
3838
$passport = $event->getPassport();
3939
if (!$passport->hasBadge(CsrfTokenBadge::class)) {
@@ -57,6 +57,6 @@ public function verifyCredentials(VerifyAuthenticatorCredentialsEvent $event): v
5757

5858
public static function getSubscribedEvents(): array
5959
{
60-
return [VerifyAuthenticatorCredentialsEvent::class => ['verifyCredentials', 256]];
60+
return [CheckPassportEvent::class => ['checkPassport', 128]];
6161
}
6262
}

‎src/Symfony/Component/Security/Http/EventListener/UserCheckerListener.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Http/EventListener/UserCheckerListener.php
+14-5Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Component\Security\Http\EventListener;
413

514
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
615
use Symfony\Component\Security\Core\User\UserCheckerInterface;
716
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\PreAuthenticatedUserBadge;
817
use Symfony\Component\Security\Http\Authenticator\Passport\UserPassportInterface;
18+
use Symfony\Component\Security\Http\Event\CheckPassportEvent;
919
use Symfony\Component\Security\Http\Event\LoginSuccessEvent;
10-
use Symfony\Component\Security\Http\Event\VerifyAuthenticatorCredentialsEvent;
1120

1221
/**
1322
* @author Wouter de Jong <wouter@wouterj.nl>
@@ -24,7 +33,7 @@ public function __construct(UserCheckerInterface $userChecker)
2433
$this->userChecker = $userChecker;
2534
}
2635

27-
public function preCredentialsVerification(VerifyAuthenticatorCredentialsEvent $event): void
36+
public function preCheckCredentials(CheckPassportEvent $event): void
2837
{
2938
$passport = $event->getPassport();
3039
if (!$passport instanceof UserPassportInterface || $passport->hasBadge(PreAuthenticatedUserBadge::class)) {
@@ -34,7 +43,7 @@ public function preCredentialsVerification(VerifyAuthenticatorCredentialsEvent $
3443
$this->userChecker->checkPreAuth($passport->getUser());
3544
}
3645

37-
public function postCredentialsVerification(LoginSuccessEvent $event): void
46+
public function postCheckCredentials(LoginSuccessEvent $event): void
3847
{
3948
$passport = $event->getPassport();
4049
if (!$passport instanceof UserPassportInterface || null === $passport->getUser()) {
@@ -47,8 +56,8 @@ public function postCredentialsVerification(LoginSuccessEvent $event): void
4756
public static function getSubscribedEvents(): array
4857
{
4958
return [
50-
VerifyAuthenticatorCredentialsEvent::class => [['preCredentialsVerification', 256]],
51-
LoginSuccessEvent::class => ['postCredentialsVerification', 256],
59+
CheckPassportEvent::class => ['preCheckCredentials', 256],
60+
LoginSuccessEvent::class => ['postCheckCredentials', 256],
5261
];
5362
}
5463
}

‎src/Symfony/Component/Security/Http/Tests/Authentication/AuthenticatorManagerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Http/Tests/Authentication/AuthenticatorManagerTest.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\PasswordCredentials;
2525
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
2626
use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport;
27-
use Symfony\Component\Security\Http\Event\VerifyAuthenticatorCredentialsEvent;
27+
use Symfony\Component\Security\Http\Event\CheckPassportEvent;
2828

2929
class AuthenticatorManagerTest extends TestCase
3030
{
@@ -95,7 +95,7 @@ public function testAuthenticateRequest($matchingAuthenticatorIndex)
9595
$matchingAuthenticator->expects($this->any())->method('authenticate')->willReturn(new SelfValidatingPassport($this->user));
9696

9797
$listenerCalled = false;
98-
$this->eventDispatcher->addListener(VerifyAuthenticatorCredentialsEvent::class, function (VerifyAuthenticatorCredentialsEvent $event) use (&$listenerCalled, $matchingAuthenticator) {
98+
$this->eventDispatcher->addListener(CheckPassportEvent::class, function (CheckPassportEvent $event) use (&$listenerCalled, $matchingAuthenticator) {
9999
if ($event->getAuthenticator() === $matchingAuthenticator && $event->getPassport()->getUser() === $this->user) {
100100
$listenerCalled = true;
101101
}
@@ -106,7 +106,7 @@ public function testAuthenticateRequest($matchingAuthenticatorIndex)
106106

107107
$manager = $this->createManager($authenticators);
108108
$this->assertNull($manager->authenticateRequest($this->request));
109-
$this->assertTrue($listenerCalled, 'The VerifyAuthenticatorCredentialsEvent listener is not called');
109+
$this->assertTrue($listenerCalled, 'The CheckPassportEvent listener is not called');
110110
}
111111

112112
public function provideMatchingAuthenticatorIndex()
+9-9Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\PasswordCredentials;
2222
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
2323
use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport;
24-
use Symfony\Component\Security\Http\Event\VerifyAuthenticatorCredentialsEvent;
25-
use Symfony\Component\Security\Http\EventListener\VerifyAuthenticatorCredentialsListener;
24+
use Symfony\Component\Security\Http\Event\CheckPassportEvent;
25+
use Symfony\Component\Security\Http\EventListener\CheckCredentialsListener;
2626

27-
class VerifyAuthenticatorCredentialsListenerTest extends TestCase
27+
class CheckCredentialsListenerTest extends TestCase
2828
{
2929
private $encoderFactory;
3030
private $listener;
@@ -33,7 +33,7 @@ class VerifyAuthenticatorCredentialsListenerTest extends TestCase
3333
protected function setUp(): void
3434
{
3535
$this->encoderFactory = $this->createMock(EncoderFactoryInterface::class);
36-
$this->listener = new VerifyAuthenticatorCredentialsListener($this->encoderFactory);
36+
$this->listener = new CheckCredentialsListener($this->encoderFactory);
3737
$this->user = new User('wouter', 'encoded-password');
3838
}
3939

@@ -53,7 +53,7 @@ public function testPasswordAuthenticated($password, $passwordValid, $result)
5353
}
5454

5555
$credentials = new PasswordCredentials($password);
56-
$this->listener->onAuthenticating($this->createEvent(new Passport($this->user, $credentials)));
56+
$this->listener->checkPassport($this->createEvent(new Passport($this->user, $credentials)));
5757

5858
if (true === $result) {
5959
$this->assertTrue($credentials->isResolved());
@@ -74,7 +74,7 @@ public function testEmptyPassword()
7474
$this->encoderFactory->expects($this->never())->method('getEncoder');
7575

7676
$event = $this->createEvent(new Passport($this->user, new PasswordCredentials('')));
77-
$this->listener->onAuthenticating($event);
77+
$this->listener->checkPassport($event);
7878
}
7979

8080
/**
@@ -91,7 +91,7 @@ public function testCustomAuthenticated($result)
9191
$credentials = new CustomCredentials(function () use ($result) {
9292
return $result;
9393
}, ['password' => 'foo']);
94-
$this->listener->onAuthenticating($this->createEvent(new Passport($this->user, $credentials)));
94+
$this->listener->checkPassport($this->createEvent(new Passport($this->user, $credentials)));
9595

9696
if (true === $result) {
9797
$this->assertTrue($credentials->isResolved());
@@ -109,11 +109,11 @@ public function testNoCredentialsBadgeProvided()
109109
$this->encoderFactory->expects($this->never())->method('getEncoder');
110110

111111
$event = $this->createEvent(new SelfValidatingPassport($this->user));
112-
$this->listener->onAuthenticating($event);
112+
$this->listener->checkPassport($event);
113113
}
114114

115115
private function createEvent($passport)
116116
{
117-
return new VerifyAuthenticatorCredentialsEvent($this->createMock(AuthenticatorInterface::class), $passport);
117+
return new CheckPassportEvent($this->createMock(AuthenticatorInterface::class), $passport);
118118
}
119119
}

‎src/Symfony/Component/Security/Http/Tests/EventListener/CsrfProtectionListenerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Http/Tests/EventListener/CsrfProtectionListenerTest.php
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface;
2020
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\CsrfTokenBadge;
2121
use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport;
22-
use Symfony\Component\Security\Http\Event\VerifyAuthenticatorCredentialsEvent;
22+
use Symfony\Component\Security\Http\Event\CheckPassportEvent;
2323
use Symfony\Component\Security\Http\EventListener\CsrfProtectionListener;
2424

2525
class CsrfProtectionListenerTest extends TestCase
@@ -38,7 +38,7 @@ public function testNoCsrfTokenBadge()
3838
$this->csrfTokenManager->expects($this->never())->method('isTokenValid');
3939

4040
$event = $this->createEvent($this->createPassport(null));
41-
$this->listener->verifyCredentials($event);
41+
$this->listener->checkPassport($event);
4242
}
4343

4444
public function testValidCsrfToken()
@@ -49,7 +49,7 @@ public function testValidCsrfToken()
4949
->willReturn(true);
5050

5151
$event = $this->createEvent($this->createPassport(new CsrfTokenBadge('authenticator_token_id', 'abc123')));
52-
$this->listener->verifyCredentials($event);
52+
$this->listener->checkPassport($event);
5353

5454
$this->expectNotToPerformAssertions();
5555
}
@@ -65,12 +65,12 @@ public function testInvalidCsrfToken()
6565
->willReturn(false);
6666

6767
$event = $this->createEvent($this->createPassport(new CsrfTokenBadge('authenticator_token_id', 'abc123')));
68-
$this->listener->verifyCredentials($event);
68+
$this->listener->checkPassport($event);
6969
}
7070

7171
private function createEvent($passport)
7272
{
73-
return new VerifyAuthenticatorCredentialsEvent($this->createMock(AuthenticatorInterface::class), $passport);
73+
return new CheckPassportEvent($this->createMock(AuthenticatorInterface::class), $passport);
7474
}
7575

7676
private function createPassport(?CsrfTokenBadge $badge)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.