LDAP authentication class

2.1 2019-03-09 08:40 UTC

This package is not auto-updated.

Last update: 2019-08-04 17:40:56 UTC


README

A simple LDAP plugin built for Laravel. Use company-wide Active Directory sign-on for your application.

Installation

Install with composer:

composer require dixonscarphoneplc/ldap

Generate config file:

php artisan vendor:publish

The above creates the config file config/ldap.php this file contains settings that you will need about your LDAP instance before proceding.

If your company has multiple LDAP endpoints you can list multiple and all will be checked.

Basic usage

Register the Service Provider and Class Alias inside config/app.php

'providers' => [
        Dixonscarphoneplc\Ldap\LdapServiceProvider::class,
]

'aliases' => [
        'Ldap' => Dixonscarphoneplc\Ldap\LdapInterface::class,
]

Use the package into your AuthController as below.

use Dixonscarphoneplc\Ldap;

Then call as needed:


class AuthController extends Controller
{

    public function auth(Request $request) {

        $credentials = $request->only('username', 'password');

        $ldap = new Ldap();

        $attempt = $ldap->attempt($credentials);

    }

}