LDAP 身份验证类

2.1 2019-03-09 08:40 UTC

This package is not auto-updated.

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


README

为 Laravel 构建的一个简单 LDAP 插件。使用公司级的 Active Directory 登录您的应用程序。

安装

使用 composer 安装

composer require dixonscarphoneplc/ldap

生成配置文件

php artisan vendor:publish

上述操作会创建配置文件 config/ldap.php,此文件包含在继续之前您需要了解的关于您的 LDAP 实例的设置。

如果您的公司有多个 LDAP 端点,您可以列出多个,并且都会被检查。

基本用法

config/app.php 中注册 Service Provider 和 类别名

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

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

如下所示在您的 AuthController 中使用该包。

use Dixonscarphoneplc\Ldap;

然后按需调用


class AuthController extends Controller
{

    public function auth(Request $request) {

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

        $ldap = new Ldap();

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

    }

}