Search code examples
phplaravellaravel-5active-directoryldap

LdapRecord Laravel - Active Directory - does not see any users


I am using the ready package as a base, I have done all steps in the readme.md file and was able to login as "einstein" user. So all seems to be configured correctly.

Later I have changed the credentials for the ldap server, which is using Active Directory.

While runing command php artisan ldap:test i receive message that i was able to connect correctly. Laravel logs says the same, but I cannot log in to laravel app. While running the command php artisan ldap:import ldap get message that no users where find

In the log file i see something like this:

[2021-04-28 23:04:08] local.INFO: LDAP (ldap://domain.pl:389) - Operation: Search - Base DN: [email protected],ou=Users,dc=domain,dc=pl - Filter: (&(objectclass=top)(objectclass=person)(objectclass=organizationalperson)(objectclass=inetorgperson)(uid=username)) - Selected: (entryuuid,*) - Time Elapsed: 737.37  

Have anyone had the same issue with the ldaprecord that he was able to connect to domain but wasn't able to authenticate to an app ? And was able to solve that ?

UPDATE: i've found that auth.php is using wrong User model, it was using OpenLdap not Active directory, changed that but result is still the same


Solution

  • Problem solved, to make it work with AD you need to:

    • in the auth.php file switch model to ActiveDirectory
    • in login controller change in the credentials function have to change 'uid' key to 'sameaccountname'