dixonscarphoneplc / ldap
2.1
2019-03-09 08:40 UTC
Requires
- php: ^7.1
- laravel/framework: ~5.5
This package is not auto-updated.
Last update: 2019-07-23 09:41:22 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);
}
}