Giter Club home page Giter Club logo

ldap-auth's Introduction

Latest Stable Version License

ldap-auth

Very basic READ ONLY LDAP authentication driver for Laravel 5.2+

Look HERE for the package for Laravel 5.1

Installation

Step 1: Install Through Composer

Add to your root composer.json and install with composer install or composer update

{
  require: {
    "krenor/ldap-auth": "~2.0"
  }
}

or use composer require krenor/ldap-auth in your console.

Step 2: Add the Service Provider

Modify your config/app.php file and add the service provider to the providers array.

`Krenor\LdapAuth\LdapAuthServiceProvider::class,`

Configuration

Step 1: Tweak the basic authentication

Update your config/auth.php to use ldap as authentication and the LdapUser Class.

'guards' => [
  	'web' => [
  		'driver'   => 'session',
  		'provider' => 'ldap-users',
	],
],

'providers' => [
	'users'      => [
		'driver' => 'eloquent',
		'model'  => App\User::class,
	],

	'ldap-users' => [
		'driver' => 'ldap',
		'model'  => \Krenor\LdapAuth\Objects\LdapUser::class,
	],
]

Step 2: Create an LDAP config

Add a ldap.php to your config directory. It should look like this.

<?php

return [
    'suffix' => '@example.local',
    'domain_controller' => ['dns2.example.local', 'dns1.example.local'],
    'base_dn' => 'OU=People,DC=example,DC=local',
    // Indicates to use the hostnames sequentially. This means that this package 
    // will try dns2.example.local first. If it's down, it tries the next one
    // If this is set to false, load balancing will be used instead (random domain controller)
    'backup_rebind' => true,
    // if using TLS this MUST be false
    'ssl' => false,
    // if using SSL this MUST be false
    'tls' => false,
    // Prevent anonymous bindings
    'admin_user' => 'admin',
     // Prevent anonymous bindings
    'admin_pass' => 'admin' 
];

You may use a single domain controller or multiple ones. Enter them as array, not as string!

'domain_controller' => ['dns1.example.local']

Usage

Authentication

Look up here for an Example or Look up here for all Guard methods using $this->auth.

Contributing

Pull Requests

  • PSR-2 Coding Standard

  • Add tests - Your patch won't be accepted if it doesn't have tests.

  • Document any changes - Make sure the README.md and any other relevant documentation are kept up-to-date.

  • Create feature branches - Use git checkout -b my-new-feature

  • One pull request per feature - If you want to do more than one thing, send multiple pull requests.

  • Send coherent history - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting.

Licence

ldap-auth is distributed under the terms of the MIT license

ldap-auth's People

Contributors

krenor avatar philbenoit avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.