alex-rad/laravel-ldap-credentials

扩展了数据库和Eloquent用户认证提供者(Laravel框架),以在LDAP中验证凭据(电子邮件和密码)

v1.0.1 2015-10-29 08:26 UTC

This package is not auto-updated.

Last update: 2024-09-28 18:37:07 UTC


README

扩展了数据库和Eloquent用户认证驱动(Laravel框架),以在LDAP中验证凭据(电子邮件和密码)。

应从用户表和模型中移除密码字段。

不支持通过电子邮件重置密码和新增用户注册。

安装

  1. 运行 composer require "alex-rad/laravel-ldap-credentials" 来安装包。

  2. 将LdapCredentials服务提供者添加到 config/app.php 配置文件中。

    'providers' => [
        ...
        LdapCredentials\Auth\AuthServiceProvider::class,
        ...
    ],
  3. 将LDAP设置添加到 config/auth.php 配置文件中。

    /*
    |--------------------------------------------------------------------------
    | LDAP Settings
    |--------------------------------------------------------------------------
    |
    | For "databaseLdapCredentials" or "eloquentLdapCredentials" user 
    | authentication drivers.
    |
    */
    
    'ldap' => [
        'host' => env('LDAP_HOST', 'ldap.server.com'),
        'port' => env('LDAP_PORT', 389),
        'user' => env('LDAP_USER', NULL),
        'password' => env('LDAP_PASSWORD', NULL),
        'base' => env('LDAP_BASE', ''),
    ],
  4. 将LDAP设置添加到环境配置文件 .ENV(可选)。

    LDAP_HOST=ldap.company.com
    
  5. config/auth.php 配置文件中将用户认证驱动切换为 databaseLdapCredentialseloquentLdapCredentials 驱动。

    'driver' => 'eloquentLdapCredentials',

    'driver' => 'databaseLdapCredentials',
  6. 从应用程序中移除通过电子邮件重置密码和新增用户注册功能。