Skip to content

Commit

Permalink
Updated composer and readme files
Browse files Browse the repository at this point in the history
Updated composer.json to reflect that this is a fork as well as changing the dependency to my forked adLDAP. Updated README.md to include a tip about email vs name-based login in a clean laravel 5 install. Also added a description of the additional config options included in my forked adLDAP.
  • Loading branch information
wunc committed Mar 8, 2015
1 parent abfae5a commit 44c4c63
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 9 deletions.
27 changes: 21 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,40 @@
# Ldap-connector
Forked from Dsdevbe/ldap-connector

Provides an solution for authentication users with LDAP for Laravel 5.0.x. It uses ADLDAP library to create a bridge between Laravel and LDAP

## Installation
1. Install this package through Composer for Laravel v5.0:
```js
composer require dsdevbe/ldap-connector:3.*
```
If you still want to use Ldap-connector for Laravel v4.2 please refer to the following package
```js
composer require dsdevbe/ldap-connector:2.*
```

1. Change the authentication driver in the Laravel config to use the ldap driver. You can find this in the following file `config/auth.php`

```php
'driver' => 'ldap',
```
1. Create a new configuration file `ldap.php` in the configuration folder of Laravel `app/config/ldap.php` and modify to your needs. For more detail of the configuration you can always check on [ADLAP documentation](http://adldap.sourceforge.net/wiki/doku.php?id=documentation_configuration)
1. Create a new configuration file `ldap.php` in the configuration folder of Laravel `app/config/ldap.php` and modify to your needs. For more detail of the configuration you can always check on [ADLAP documentation](https://github.com/adldap/adLDAP/wiki/adLDAP-Developer-API-Reference)

```
return array(
'account_suffix'=> "@domain.local",
'domain_controllers'=> array("192.168.0.1", "dc02.domain.local"), // Load balancing domain controllers
'base_dn' => 'DC=domain,DC=local',
'admin_username' => '', // Setting these to blank does anonymous bind
'admin_password' => '',
'user_id_key' => 'samaccountname', // AD attribute uniquely identifying users (usually 'sAMAccountname')
'search_filter' => 'objectClass=person', // search filter for finding people
'real_primary_group' => false, // Returns the primary group (an educated guess).
'use_ssl' => false, // If TLS is true this MUST be false.
'use_tls' => false, // If SSL is true this MUST be false.
'recursive_groups' => true,
'ad_port' => 389,
'sso' => '' // Use Single Sign-On
);
```
1. Once this is done you arrived at the final step and you will need to add a service provider. Open `config/app.php`, and add a new item to the providers array.
Expand All @@ -35,10 +47,13 @@ Provides an solution for authentication users with LDAP for Laravel 5.0.x. It us
The LDAP plugin is an extension of the AUTH class and will act the same as normal usage with Eloquent driver.

```
if (Auth::attempt(array('username' => $email, 'password' => $password)))
if (Auth::attempt(array('name' => $name, 'password' => $password)))
{
return Redirect::intended('dashboard');
}
```

You can find more examples on [Laravel Auth Documentation](http://laravel.com/docs/master/authentication) on using the `Auth::` function.

### Login with Name Instead of Email
In a vanilla Laravel 5.0 install, the included user model and associated database migration has a 'name' and 'email' field with a default included view for 'email'-based login. If you prefer to login via 'name' (if that is more appropriate for LDAP-based login), edit the resources/views/auth/login.blade.php and modify the form appropriately. You will also have to override the postLogin() method from the trait included in Http/Controllers/Auth/AuthController.php to have it look for 'name' instead of 'email' in the request.
10 changes: 7 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
{
"name": "dsdevbe/ldap-connector",
"name": "wunc/ldap-connector",
"description": "Easily authenticate with LDAP in Laravel",
"homepage": "https://github.com/dsdevbe/ldap-connector",
"homepage": "https://github.com/wunc/ldap-connector",
"keywords": ["Laravel", "Ldap"],
"license": "MIT",
"authors": [
{
"name": "WunC",
"role": "Developer"
}
{
"name": "Dsdevbe",
"email": "[email protected]"
Expand All @@ -13,7 +17,7 @@
"require": {
"php": ">=5.3.0",
"laravel/framework": "~5.0",
"adldap/adldap": "4.0-stable"
"wunc/adldap": "~4.0"
},
"autoload": {
"psr-0": {
Expand Down

0 comments on commit 44c4c63

Please sign in to comment.