Skip to content
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
@dionysiosarvanitis

Description

@dionysiosarvanitis
  • 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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions