This repository was archived by the owner on Jul 24, 2023. It is now read-only.
This repository was archived by the owner on Jul 24, 2023. It is now read-only.
Login fallback when there is no connection does not work #897
Closed
Description
- Laravel Version: 7.0
- Adldap2-Laravel Version: latest
- PHP Version: 7.4
- LDAP Type: ActiveDirectory
Description:
Login fallback when there is no connection does not work.
The problem is caused by the line $user = Resolver::byCredentials($credentials);
inside DatabaseUserProvider::retrieveByCredentials
.
It tries to connect with an unbounded connection without handling the exception thrown. Changing if statement
like below fixes the problem.
- if (!$provider->getConnection()->isBound())
+ if ($provider->getConnection()->isBound())
protected function getLdapAuthProvider(): ProviderInterface
{
$provider = $this->ldap->getProvider($this->connection ?? $this->getLdapAuthConnectionName());
if (!$provider->getConnection()->isBound()) {
// We'll make sure we have a bound connection before
// allowing dynamic calls on the default provider.
$provider->connect();
}
return $provider;
}
Can make a PR if you want.
Metadata
Metadata
Assignees
Labels
No labels