Skip to content

Commit 363db1c

Browse files
committed
Change event name
1 parent bab908d commit 363db1c

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
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\AuthenticationTokenCreatedEvent;
2930
use Symfony\Component\Security\Http\Event\CheckPassportEvent;
30-
use Symfony\Component\Security\Http\Event\InspectAuthenticatedTokenEvent;
3131
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
3232
use Symfony\Component\Security\Http\Event\LoginFailureEvent;
3333
use Symfony\Component\Security\Http\Event\LoginSuccessEvent;
@@ -72,7 +72,7 @@ public function authenticateUser(UserInterface $user, AuthenticatorInterface $au
7272
$token = $authenticator->createAuthenticatedToken($passport = new SelfValidatingPassport($user, $badges), $this->firewallName);
7373

7474
// announce the authenticated token
75-
$token = $this->eventDispatcher->dispatch(new InspectAuthenticatedTokenEvent($token))->getAuthenticatedToken();
75+
$token = $this->eventDispatcher->dispatch(new AuthenticationTokenCreatedEvent($token))->getAuthenticatedToken();
7676

7777
// authenticate this in the system
7878
return $this->handleAuthenticationSuccess($token, $passport, $request, $authenticator);
@@ -173,7 +173,7 @@ private function executeAuthenticator(AuthenticatorInterface $authenticator, Req
173173
$authenticatedToken = $authenticator->createAuthenticatedToken($passport, $this->firewallName);
174174

175175
// announce the authenticated token
176-
$authenticatedToken = $this->eventDispatcher->dispatch(new InspectAuthenticatedTokenEvent($authenticatedToken))->getAuthenticatedToken();
176+
$authenticatedToken = $this->eventDispatcher->dispatch(new AuthenticationTokenCreatedEvent($authenticatedToken))->getAuthenticatedToken();
177177

178178
if (true === $this->eraseCredentials) {
179179
$authenticatedToken->eraseCredentials();

src/Symfony/Component/Security/Http/Event/InspectAuthenticatedTokenEvent.php renamed to src/Symfony/Component/Security/Http/Event/AuthenticationTokenCreatedEvent.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
use Symfony\Contracts\EventDispatcher\Event;
1616

1717
/**
18-
* Inspect a newly authenticated security token before it becomes effective in the security system.
18+
* When a newly authenticated security token was created, before it becomes effective in the security system.
1919
*
2020
* @author Christian Scheb <me@christianscheb.de>
2121
*/
22-
class InspectAuthenticatedTokenEvent extends Event
22+
class AuthenticationTokenCreatedEvent extends Event
2323
{
2424
private $authenticatedToken;
2525

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
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\AuthenticationTokenCreatedEvent;
2728
use Symfony\Component\Security\Http\Event\CheckPassportEvent;
28-
use Symfony\Component\Security\Http\Event\InspectAuthenticatedTokenEvent;
2929

3030
class AuthenticatorManagerTest extends TestCase
3131
{
@@ -166,7 +166,7 @@ public function testAuthenticateRequestCanModifyTokenFromEvent(): void
166166

167167
$modifiedToken = $this->createMock(TokenInterface::class);
168168
$listenerCalled = false;
169-
$this->eventDispatcher->addListener(InspectAuthenticatedTokenEvent::class, function (InspectAuthenticatedTokenEvent $event) use (&$listenerCalled, $modifiedToken) {
169+
$this->eventDispatcher->addListener(AuthenticationTokenCreatedEvent::class, function (AuthenticationTokenCreatedEvent $event) use (&$listenerCalled, $modifiedToken) {
170170
$event->setAuthenticatedToken($modifiedToken);
171171
$listenerCalled = true;
172172
});
@@ -175,7 +175,7 @@ public function testAuthenticateRequestCanModifyTokenFromEvent(): void
175175

176176
$manager = $this->createManager([$authenticator]);
177177
$this->assertNull($manager->authenticateRequest($this->request));
178-
$this->assertTrue($listenerCalled, 'The InspectAuthenticatedTokenEvent listener is not called');
178+
$this->assertTrue($listenerCalled, 'The AuthenticationTokenCreatedEvent listener is not called');
179179
}
180180

181181
public function testAuthenticateUser()
@@ -198,7 +198,7 @@ public function testAuthenticateUserCanModifyTokenFromEvent(): void
198198

199199
$modifiedToken = $this->createMock(TokenInterface::class);
200200
$listenerCalled = false;
201-
$this->eventDispatcher->addListener(InspectAuthenticatedTokenEvent::class, function (InspectAuthenticatedTokenEvent $event) use (&$listenerCalled, $modifiedToken) {
201+
$this->eventDispatcher->addListener(AuthenticationTokenCreatedEvent::class, function (AuthenticationTokenCreatedEvent $event) use (&$listenerCalled, $modifiedToken) {
202202
$event->setAuthenticatedToken($modifiedToken);
203203
$listenerCalled = true;
204204
});
@@ -207,7 +207,7 @@ public function testAuthenticateUserCanModifyTokenFromEvent(): void
207207

208208
$manager = $this->createManager([$authenticator]);
209209
$manager->authenticateUser($this->user, $authenticator, $this->request);
210-
$this->assertTrue($listenerCalled, 'The InspectAuthenticatedTokenEvent listener is not called');
210+
$this->assertTrue($listenerCalled, 'The AuthenticationTokenCreatedEvent listener is not called');
211211
}
212212

213213
public function testInteractiveAuthenticator()

0 commit comments

Comments
 (0)