Skip to content
This repository was archived by the owner on Jul 24, 2023. It is now read-only.

Commit 425984c

Browse files
committed
Allow developers to use shortname for distinguishedname as the LDAP auth attribute
1 parent 80641be commit 425984c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Resolvers/UserResolver.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,16 @@ public function byModel(Authenticatable $model)
9797
*/
9898
public function authenticate(User $user, array $credentials = [])
9999
{
100-
$username = $user->getFirstAttribute($this->getLdapAuthAttribute());
100+
$attribute = $this->getLdapAuthAttribute();
101+
102+
// If the developer has inserted 'dn' as their LDAP
103+
// authentication attribute, we'll convert it to
104+
// the full attribute name for convenience.
105+
if ($attribute == 'dn') {
106+
$attribute = $user->getSchema()->distinguishedName();
107+
}
108+
109+
$username = $user->getFirstAttribute($attribute);
101110

102111
$password = $this->getPasswordFromCredentials($credentials);
103112

0 commit comments

Comments
 (0)