bkno/ldap

LDAP认证类

2.3 2019-12-10 16:48 UTC

This package is not auto-updated.

Last update: 2023-09-13 10:42:00 UTC


README

为Laravel构建的简单LDAP插件。使用公司范围内的Active Directory登录您的应用程序。

安装

使用composer安装

composer require bkno/ldap

生成配置文件

php artisan vendor:publish

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

如果您的公司有多个LDAP端点,您可以列出多个,并将检查所有这些端点。

基本用法

config/app.php中注册服务提供者和类别名

'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);

    }

}