|
15 | 15 | use Symfony\Component\HttpFoundation\Response;
|
16 | 16 | use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
17 | 17 | use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
18 |
| -use Symfony\Component\Security\Core\Exception\LogicException; |
19 | 18 | use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface;
|
20 | 19 | use Symfony\Component\Security\Http\Authenticator\InteractiveAuthenticatorInterface;
|
21 | 20 | use Symfony\Component\Security\Http\Authenticator\Passport\PassportInterface;
|
22 | 21 | use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
|
| 22 | +use Symfony\Component\Security\Http\EntryPoint\Exception\NotAnEntryPointException; |
23 | 23 |
|
24 | 24 | /**
|
25 | 25 | * This class decorates internal authenticators to add the LDAP integration.
|
@@ -82,14 +82,18 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio
|
82 | 82 | public function start(Request $request, AuthenticationException $authException = null): Response
|
83 | 83 | {
|
84 | 84 | if (!$this->authenticator instanceof AuthenticationEntryPointInterface) {
|
85 |
| - throw new LogicException(sprintf('Decorated authenticator "%s" must implement interface "%s".', get_debug_type($this->authenticator), AuthenticationEntryPointInterface::class)); |
| 85 | + throw new NotAnEntryPointException(sprintf('Decorated authenticator "%s" does not implement interface "%s".', get_debug_type($this->authenticator), AuthenticationEntryPointInterface::class)); |
86 | 86 | }
|
87 | 87 |
|
88 | 88 | return $this->authenticator->start($request, $authException);
|
89 | 89 | }
|
90 | 90 |
|
91 | 91 | public function isInteractive(): bool
|
92 | 92 | {
|
93 |
| - return true; |
| 93 | + if ($this->authenticator instanceof InteractiveAuthenticatorInterface) { |
| 94 | + return $this->authenticator->isInteractive(); |
| 95 | + } |
| 96 | + |
| 97 | + return false; |
94 | 98 | }
|
95 | 99 | }
|
0 commit comments