You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bug #59342 [SecurityBundle] Do not pass traceable authenticators to security.helper (MatTheCat)
This PR was merged into the 7.2 branch.
Discussion
----------
[SecurityBundle] Do not pass traceable authenticators to `security.helper`
| Q | A
| ------------- | ---
| Branch? | 7.2
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Issues | Fix#59341
| License | MIT
Since #59278 authenticators are no longer aliases for their traceable version, which means calling `Security::login` with an authenticator ID won’t match its traceable ID, and fail.
Plus, `Security::login` using the traceable authenticators meant the profiler could show them as successful while not supporting the request:

This PR fixes these issues by passing the original authenticators to `security.helper`, using their ID as name.
Commits
-------
c5a2360 [SecurityBundle] Do not pass traceable authenticators to `security.helper`
Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php
+4Lines changed: 4 additions & 0 deletions
Original file line
8877
number
Diff line number
Diff line change
@@ -924,6 +924,10 @@ public function testAuthenticatorsDecoration()
924
924
$this->assertSame('debug.'.TestAuthenticator::class, (string) reset($managerAuthenticators), 'AuthenticatorManager must be injected traceable authenticators in debug mode.');
925
925
926
926
$this->assertTrue($container->hasDefinition(TestAuthenticator::class), 'Original authenticator must still exist in the container so it can be used outside of the AuthenticatorManager’s context.');
$this->assertArrayHasKey(TestAuthenticator::class, $authenticatorMap = $securityHelperAuthenticatorLocator->getArgument(0), 'When programmatically authenticating a user, authenticators’ name must be their original ID.');
930
+
$this->assertSame(TestAuthenticator::class, (string) $authenticatorMap[TestAuthenticator::class]->getValues()[0], 'When programmatically authenticating a user, original authenticators must be used.');
0 commit comments