From 0fb0e644feac3d6a122c2c27c9ef8823ba7f1c49 Mon Sep 17 00:00:00 2001 From: Wouter de Jong Date: Mon, 23 Nov 2020 22:10:01 +0100 Subject: [PATCH] [Security] Automatically register custom authenticator as entry_point (if supported) --- Authenticator/GuardBridgeAuthenticator.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Authenticator/GuardBridgeAuthenticator.php b/Authenticator/GuardBridgeAuthenticator.php index 6d51428..1d7cec6 100644 --- a/Authenticator/GuardBridgeAuthenticator.php +++ b/Authenticator/GuardBridgeAuthenticator.php @@ -29,6 +29,7 @@ use Symfony\Component\Security\Http\Authenticator\Passport\Passport; use Symfony\Component\Security\Http\Authenticator\Passport\PassportInterface; use Symfony\Component\Security\Http\Authenticator\Passport\UserPassportInterface; +use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface; /** * This authenticator is used to bridge Guard authenticators with @@ -38,7 +39,7 @@ * * @internal */ -class GuardBridgeAuthenticator implements InteractiveAuthenticatorInterface +class GuardBridgeAuthenticator implements InteractiveAuthenticatorInterface, AuthenticationEntryPointInterface { private $guard; private $userProvider; @@ -49,6 +50,11 @@ public function __construct(GuardAuthenticatorInterface $guard, UserProviderInte $this->userProvider = $userProvider; } + public function start(Request $request, AuthenticationException $authException = null) + { + return $this->guard->start($request, $authException); + } + public function supports(Request $request): ?bool { return $this->guard->supports($request);