Download the PHP package dsdevbe/ldap-connector without Composer
On this page you can find all versions of the php package dsdevbe/ldap-connector. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dsdevbe/ldap-connector
More information about dsdevbe/ldap-connector
Files in dsdevbe/ldap-connector
Package ldap-connector
Short Description Easily authenticate with LDAP in Laravel
License MIT
Homepage https://github.com/SaschaDens/ldap-connector
Informations about the package ldap-connector
Not maintained anymore
I've created this project during my internship for an easy authentication between various applications within my company. The scope of the ldap-connector was only to authenticate with Laravel to the LDAP server.
In case you're looking for a replacement please checkout Adldap2-Laravel. They have also created the awesome library Adldap2 which ldap-connector was using.
I'll stop maintaining this project but would like to thank all the people that contributed or used this project.
Ldap-connector
Provides an solution for authentication users with LDAP for Laravel 5.x. It uses ADLDAP library on Adldap2 to create a bridge between Laravel and LDAP
Installation
- Laravel 5.1 - 5.0
- Laravel 5.2 - ...
Laravel 5.1 - 5.0
-
Install this package through Composer by adding the following line to
composer.json
or you could use command-line
-
Add the service provider in the app configuration by opening
config/app.php
, and add a new item to the providers array. -
Change the authentication driver in the Laravel config to use the ldap driver. You can find this in the following file
config/auth.php
-
Publish a new configuration file with
php artisan vendor:publish
in the configuration folder of Laravel you will findconfig/ldap.php
and modify to your needs. For more detail of the configuration you can always check on ADLAP documentationPlease note that the fields 'admin_username' and 'admin_password' are required for session persistance!
Usage
The LDAP plugin is an extension of the Auth class and will act the same as normal usage with Eloquent driver.
You can find more examples on Laravel Auth Documentation on using the Auth::
function.
Use AuthController
If you want to use the authentication controller that ships with Laravel you will need to change the following files.
By default App\Http\Controllers\Auth\AuthController
checks for the email
field if nothing is provided. To overwrite this value add the following line in the AuthController
.
Laravel documentation: Authentication Quickstart
Ldap Groups
Auth::user()->getGroups()
returnsarray
with groups the current user belongs to.Auth::user()->inGroup('GROUPNAME')
returnsboolean
if user belongs toGROUPNAME
Ldap User Information
Auth::user()->getUsername()
returns authenticated username.Auth::user()->getFirstname()
returns authenticated first name.Auth::user()->getLastname()
returns authenticated last name.Auth::user()->getEmail()
returns authenticated email address.
Laravel 5.2 - ...
-
Install this package through Composer by adding the following line to
composer.json
or you could use command-line
-
Add the service provider in the app configuration by opening
config/app.php
, and add a new item to the providers array. -
Change the authentication driver in the Laravel config to use the ldap driver. You can find this in the following file
config/auth.php
Please note that the fields 'admin_username' and 'admin_password' are required for session persistance!
Usage
The LDAP plugin is an extension of the Auth class and will act the same as normal usage with Eloquent driver.
You can find more examples on Laravel Auth Documentation on using the Auth::
function.
Use AuthController
If you want to use the authentication controller that ships with Laravel you will need to change the following files.
By default App\Http\Controllers\Auth\AuthController
checks for the email
field if nothing is provided. To overwrite this value add the following line in the AuthController
.
Laravel documentation: Authentication Quickstart
Ldap User Information
Difference with ldap-connector V3 is that now the adLDAP model is directly exposed on the user model. This means that you can fetch all data directly from the user.
To access the adldap model you can use now Auth::user()->getAdLDAP()
.
Examples:
Auth::user()->getAdLDAP()->getAccountName()
Auth::user()->getAdLDAP()->getFirstName()
To fetch more properties please check adLDAP2 documentation
Contributing
Feel free to contribute to this project for new features or bug fixes. We are open for improvements!
All versions of ldap-connector with dependencies
ext-ldap Version *
laravel/framework Version ~5.0
adldap2/adldap2 Version 5.2.*