| Install | |
|---|---|
composer require aimme/laravel5-ldap |
####Installation
1 - Require this package with composer:
composer require aimme/laravel5-ldap
2 - add provider
file: config/app.php
'providers' => [
....
Aimme\Ldap\LdapServiceProvider::class,
];
3 - add alias
file: config/app.php
'aliases' => [
....
'Ldap' => Aimme\Ldap\Facades\Ldap::class,
....
];
4 - run these artisan commands
php artisan make:ldap-auth
php artisan vendor:publish --provider="Aimme\Ldap\LdapServiceProvider"
5 - add middleware
file: app/Http/Kernel.php
protected $routeMiddleware = [
...
'ldap' => \Aimme\Ldap\Middleware\Authenticate::class,
...
];
6 - bring following configuration changes to the ldap config file
file: config/ldap.php
change providers array users model to your Eloquent user model path if it's different
'providers' => [
'users' => [
'driver' => 'ldap',
'model' => App\User::class,
],
set your environment variables.
'domain' => env('LDAP_DOMAIN', 'MYDOMAIN'),
'host' => env('LDAP_HOST', 'ldap://aimme.mydomain.net'),
See http://php.net/manual/en/function.ldap-connect.php
See http://php.net/manual/en/function.ldap-bind.php