Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0b0c15c

Browse files
dcp-devchalasr
authored andcommitted
[Ldap] Make LdapAuthenticator an EntryPoint
1 parent 8a837bc commit 0b0c15c

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/Symfony/Component/Ldap/Security/LdapAuthenticator.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +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;
1819
use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface;
20+
use Symfony\Component\Security\Http\Authenticator\InteractiveAuthenticatorInterface;
1921
use Symfony\Component\Security\Http\Authenticator\Passport\PassportInterface;
22+
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
2023

2124
/**
2225
* This class decorates internal authenticators to add the LDAP integration.
@@ -29,7 +32,7 @@
2932
*
3033
* @final
3134
*/
32-
class LdapAuthenticator implements AuthenticatorInterface
35+
class LdapAuthenticator implements AuthenticationEntryPointInterface, InteractiveAuthenticatorInterface
3336
{
3437
private $authenticator;
3538
private $ldapServiceId;
@@ -75,4 +78,18 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio
7578
{
7679
return $this->authenticator->onAuthenticationFailure($request, $exception);
7780
}
81+
82+
public function start(Request $request, AuthenticationException $authException = null): Response
83+
{
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));
86+
}
87+
88+
return $this->authenticator->start($request, $authException);
89+
}
90+
91+
public function isInteractive(): bool
92+
{
93+
return true;
94+
}
7895
}

0 commit comments

Comments
 (0)