-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Security] Improve DX when invalid custom authenticators #49938
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Security] Improve DX when invalid custom authenticators #49938
Conversation
Hey! Thanks for your PR. You are targeting branch "6.3" but it seems your PR description refers to branch "6.3 for features / 5.4 or 6.2 for bug fixes". Cheers! Carsonbot |
@@ -60,6 +60,12 @@ class AuthenticatorManager implements AuthenticatorManagerInterface, UserAuthent | |||
*/ | |||
public function __construct(iterable $authenticators, TokenStorageInterface $tokenStorage, EventDispatcherInterface $eventDispatcher, string $firewallName, LoggerInterface $logger = null, bool $eraseCredentials = true, bool $hideUserNotFoundExceptions = true, array $requiredBadges = []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We mus 10000 t probably also update validation of config in SecurityBundle, but I didn't find an example which check interface from FQCN . Should we you ReflectionClass ?
Lines 49 to 56 in 3040d43
->validate() | |
->ifTrue(fn ($v) => isset($v['custom_authenticators']) && empty($v['custom_authenticators'])) | |
->then(function ($v) { | |
unset($v['custom_authenticators']); | |
return $v; | |
}) | |
->end() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that what you configure here is a service id and not a FQCN, we cannot validate the interface in the configuration validation (as it does not have access to the service definition)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But we can do it in the extension. This is help new comers more than in src/Symfony/Component/Security/Http/Authentication/AuthenticatorManager.php
(but we can keep both checks)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, this should be checked in a compiler pass, not in the extension (the DI extension runs with a dedicated container builder and so does not have access to the services defined elsewhere)
src/Symfony/Component/Security/Http/Authentication/AuthenticatorManager.php
Outdated
Show resolved
Hide resolved
194b1e3
to
93cc075
Compare
Thank you @alamirault. |
Before this PR error was