Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

Commit

Permalink
patch adldap2 (#794)
Browse files Browse the repository at this point in the history
  • Loading branch information
wouldsmina authored Feb 13, 2019
1 parent 96ac52f commit 8162b13
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
15 changes: 11 additions & 4 deletions vendor/adldap2/adldap2/src/Query/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,18 @@ public function get()
*/
public function users()
{
return $this->where([
$wheres = [
[$this->schema->objectClass(), Operator::$equals, $this->schema->objectClassUser()],
[$this->schema->objectCategory(), Operator::$equals, $this->schema->objectCategoryPerson()],
[$this->schema->objectClass(), Operator::$doesNotEqual, $this->schema->objectClassContact()],
]);
[$this->schema->objectCategory(), Operator::$equals, $this->schema->objectCategoryPerson()]
];

// OpenLDAP doesn't like specifying the omission of user objectclasses equal to `contact`.
// We'll make sure we're working with ActiveDirectory before adding this filter.
if (is_a($this->schema, ActiveDirectory::class)) {
$wheres[] = [$this->schema->objectClass(), Operator::$doesNotEqual, $this->schema->objectClassContact()];
}

return $this->where($wheres);
}

/**
Expand Down
11 changes: 5 additions & 6 deletions vendor/libertempo/api/Tools/Services/LdapAuthentifierService.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,13 @@ public function isAuthentificationSucceed(IRequest $request) : bool

$this->ldap->addProvider($config);

$rdn = [
$configurationLdap->login . '=' . $this->getLogin(),
$configurationLdap->domaine,
];

$provider = $this->ldap->connect();
$connection = $provider->getConnection();
$search = $provider->search();
$search->select(['dn']);
$user = $search->where($configurationLdap->login, $this->getLogin())->firstOrFail();

return $connection->bind(implode(',', $rdn), $this->getPassword());
return $provider->auth()->attempt($user->getDn(), $this->getPassword());
}

/**
Expand Down

0 comments on commit 8162b13

Please sign in to comment.