Skip to content

Commit 53d6755

Browse files
committed
Fix decorating non-entrypoint authenticators
1 parent 245ed91 commit 53d6755

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Security/LdapAuthenticator.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
use Symfony\Component\HttpFoundation\Response;
1616
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
1717
use Symfony\Component\Security\Core\Exception\AuthenticationException;
18-
use Symfony\Component\Security\Core\Exception\LogicException;
1918
use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface;
2019
use Symfony\Component\Security\Http\Authenticator\InteractiveAuthenticatorInterface;
2120
use Symfony\Component\Security\Http\Authenticator\Passport\PassportInterface;
2221
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
22+
use Symfony\Component\Security\Http\EntryPoint\Exception\NotAnEntryPointException;
2323

2424
/**
2525
* This class decorates internal authenticators to add the LDAP integration.
@@ -82,14 +82,18 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio
8282
public function start(Request $request, AuthenticationException $authException = null): Response
8383
{
8484
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));
8686
}
8787

8888
return $this->authenticator->start($request, $authException);
8989
}
9090

9191
public function isInteractive(): bool
9292
{
93-
return true;
93+
if ($this->authenticator instanceof InteractiveAuthenticatorInterface) {
94+
return $this->authenticator->isInteractive();
95+
}
96+
97+
return false;
9498
}
9599
}

0 commit comments

Comments
 (0)