Fix LDAP with internal users (#4453)

* added logging, in case Laminas libs are not available
* make sure that internal users can still login if LDAP is activated
This commit is contained in:
Kevin Papst
2023-11-20 21:33:36 +01:00
committed by GitHub
parent 20164295f8
commit 16d4a691f8
4 changed files with 15 additions and 10 deletions

View File

@@ -10,6 +10,7 @@
namespace App\Ldap;
use App\Configuration\LdapConfiguration;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
@@ -22,17 +23,19 @@ use Symfony\Component\Security\Http\EntryPoint\Exception\NotAnEntryPointExceptio
final class LdapAuthenticator implements AuthenticationEntryPointInterface, InteractiveAuthenticatorInterface
{
public function __construct(private AuthenticatorInterface $authenticator, private LdapConfiguration $configuration)
public function __construct(private AuthenticatorInterface $authenticator, private LdapConfiguration $configuration, private LoggerInterface $logger)
{
}
public function supports(Request $request): bool
{
if (!class_exists('Laminas\Ldap\Ldap')) {
if (!$this->configuration->isActivated()) {
return false;
}
if (!$this->configuration->isActivated()) {
if (!class_exists('Laminas\Ldap\Ldap')) {
$this->logger->debug('Failed loading LDAP authenticator, missing Laminas dependency');
return false;
}