PHPackages                             templatemonster/ldap-auth - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. templatemonster/ldap-auth

ActiveModule[Authentication &amp; Authorization](/categories/authentication)

templatemonster/ldap-auth
=========================

Yii2 module for mapping ldap to rbac.

0.4.0(2y ago)0180MITPHP

Since Oct 27Pushed 2y ago8 watchersCompare

[ Source](https://github.com/Plasma-Platform/yii2-ldap-auth-module)[ Packagist](https://packagist.org/packages/templatemonster/ldap-auth)[ RSS](/packages/templatemonster-ldap-auth/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (2)Versions (5)Used By (0)

yii2-ldap-auth-module
=====================

[](#yii2-ldap-auth-module)

Yii2 extension which allows to authenticate user via LDAP. Based on Yii2 Boilerplate. Also provides you LDAP groups to RBAC roles mapper.

\##Installation

The preferred way to install this extension is through composer. First add

```
{
   "type":"git",
   "url":"https://github.com/andrey-tm/yii2-ldap-auth-module"
}

```

to the repositories section of your application's composer.json file. Than add

```
"templatemonster/ldap-auth" : "*"

```

to the require section.

\##Usage

Add the following in your web config file:

```
...
'bootstrap' => ['ldap'],
...
'modules' => [
    ...
    'ldap' => [,
        'class' => 'templatemonster\ldapauth\Module',
        'host' => 'localhost',
        'port' => 389,
        'baseDN' => 'dc=example,dc=com',
        'userDN' => 'uid={$username},ou=Users,dc=example,dc=com',
        'groupDN' => 'ou=Groups,dc=example,dc=com',
    ],
    ...
],
...
'as globalAccess'=>[
    ...
    'rules'=>[
        ...
        [
            'controllers'=>['ldap/acl'],
            'allow' => true,
            'roles' => ['administrator'],
        ],
        [
            'controllers'=>['ldap/acl'],
            'allow' => false,
        ],
        ...
    ],
    ...
],
...
```

In your console config file in migration section replace class property and add configFiles array property. configFiles is array of configs where component will scan for migration aware modules.

```
...
'controllerMap' => [
    ...
    'migrate'=>[
        'class' => 'indigerd\migrationaware\controllers\MigrateController',
        'configFiles' => [
            '@backend/config/web.php',
        ],
        'migrationPath'=>'@common/migrations/db', //leave as it was before
        'migrationTable'=>'{{%system_db_migration}}' //leave as it was before
    ],
    ...
],
...
```

Create migration for initial RBAC roles assignment with ldap groups. For example:

```
