Closed petay87 closed 6 years ago
This was me being stupid and putting the OU containers as DC and appending the domain name to the user to be authenticated when using distinguishedName
Thanks for posting your solution @petay87! Much appreciated :smile:
Description:
I have implemented Adldap2-Laravel and configured the Auth Driver to enable login validation via ActiveDirectory LDAP but also keep users in the local DB so that I can implement Permissions and Roles with laravel-permission.
So far, as far as I can tell, everything is working but I'm not sure if the user LDAP validation is actually happening.
If I intentionally put in incorrect details in the config files, I can see that the laravel.log files populates with information do to with the error I forced (In my case, incorrect admin credentials) and I can see clear as day that the issue is invalid credentials.
However, as soon as I remove this issue and put all settings back to "LIVE", I am unable to log in with an active account and all I get in return is "These credentials do not match our records". If I check the laravel.log file, nothing is populated at all.
Am I correct in assuming that the logging is automatically configured? Or should I be enabling this somehow?
It almost appears as though the validation of the user attempting to log in via the webpage is not taking place.
I have attempted to use "username" as the field to check again LDAP for.
_EDIT -_ When added a dd($credentials) in the NoDatabaseUserProvider.php under retrieveByCredentials() I can see the correct credentials being passed which are inputted in the login page. However, a dd($user) later, returns null which would indicate that the search is not able to find the user in LDAP.
When I attempt to do the same for DatabaseUserProvider.php I don't get that far and the dd doesn't trigger which means I must have an issue with looking for the user in the local database. However, this doesn't explain why it doesn't find the user in LDAP when we disable the local database.
My adlap_auth.php file:
`<?php
return [
]; `
My adldap.php file:
`<?php
return [
]; `
My auth.php file:
`<?php
return [
]; `
My User.php model:
`<?php
namespace App;
use Illuminate\Notifications\Notifiable; use Illuminate\Foundation\Auth\User as Authenticatable; use Spatie\Permission\Traits\HasRoles;
class User extends Authenticatable { use Notifiable; use HasRoles;
} `
My LoginController.php controller file:
`<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller; use Illuminate\Foundation\Auth\AuthenticatesUsers;
} `
I feel like I must be missing something.
Some assistance in getting this working would be greatly appreciated.