GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - wanlxp/ldap-connector: Provides an solution for authentication users with LDAP for Laravel 5.1

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

30 Commits
30 Commits

Folders and files

NameName
Last commit message
Last commit date
spec/Dsdevbe/LdapConnector
spec/Dsdevbe/LdapConnector
 
 
src/Dsdevbe/LdapConnector
src/Dsdevbe/LdapConnector
 
 
.editorconfig
.editorconfig
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
README.md
README.md
 
 
composer.json
composer.json
 
 

Repository files navigation

Ldap-connector

Build Status Latest Stable Version Total Downloads License

Provides an solution for authentication users with LDAP for Laravel 5.x. It uses ADLDAP 4.0 library forked on Adldap2 to create a bridge between Laravel and LDAP

Installation

  1. Install this package through Composer for Laravel v5.x:

    composer require dsdevbe/ldap-connector:3.*
  2. Add the service provider in the app configuration by opening config/app.php, and add a new item to the providers array.

    ```
    Dsdevbe\LdapConnector\LdapConnectorServiceProvider::class
    ```
    
  3. Change the authentication driver in the Laravel config to use the ldap driver. You can find this in the following file config/auth.php

    'driver' => 'ldap',
  4. Publish a new configuration file with php artisan vendor:publish in the configuration folder of Laravel you will find config/ldap.php and modify to your needs. For more detail of the configuration you can always check on ADLAP documentation

    return array(
        'plugins' => array(
            'adldap' => 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' => 'admin', // This is required for session persistance in the application
                'admin_password' => 'yourPassword',
            ),
        ),
    );
    

    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.

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

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.

protected $username = 'username';

Laravel documentation: Authentication Quickstart

Ldap Groups

  • Auth::user()->getGroups() returns array with groups the current user belongs to.
  • Auth::user()->inGroup('GROUPNAME') returns boolean if user belongs to GROUPNAME

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.

About

Provides an solution for authentication users with LDAP for Laravel 5.1

Resources

Readme
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.