PHPackages                             yunai39/simple-ldap-bundle - 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. yunai39/simple-ldap-bundle

ActiveSymfony-bundle

yunai39/simple-ldap-bundle
==========================

This bundle provides an integration of Symfony Security for an LDAP Annuary, every user in the LDAP annuary will have a default role, but it is possible to set specific role for specific user

2.2.3(9y ago)12.4k3PHPPHP &gt;=5.2.4

Since Feb 21Pushed 6y ago1 watchersCompare

[ Source](https://github.com/yunai39/SimpleLdapBundle)[ Packagist](https://packagist.org/packages/yunai39/simple-ldap-bundle)[ RSS](/packages/yunai39-simple-ldap-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)DependenciesVersions (5)Used By (0)

SimpleLdapBundle
================

[](#simpleldapbundle)

This is a Bundle for Symfony for an Ldap Authentification

In this bundle, you will be able to authentificate user against an LDAP annuary. By default every single user in the LDAP annuary will have a default ROLE (role that you can choose). It is also possible to give specific user a specific role.

The database is simple, you have a database where a id corresponding to a field(the name of that field is defined int the parameter.yml) in the ldap tree (exemple: employeenumber - 00000), and you will give a specific role for the user with the field employee number 00000 You also have a boolean field for the user to be unvalidated, user who are unvalidated, will have a default role defined in the parameter.yml.

Requirement
-----------

[](#requirement)

To use this Bundle you will need to have php\_ldap installed on you server

Installation
------------

[](#installation)

You need to add a package to your dependency list :

```
"yunai39/simple-ldap-bundle": "dev-master"

```

When do a composer update:

```
composer update "yunai39/simple-ldap-bundle"

```

You need to enable the bundle into your kernel

```
//app/AppKernel.php
new Yunai39\Bundle\SimpleLdapBundle\SimpleLdapBundle(),

```

Configuration
-------------

[](#configuration)

The configuration is a bit long:

First you need to register the bundle in your AppKernel

```
$bundles = array(
...
new Yunai39\Bundle\SimpleLdapBundle\SimpleLdapBundle(),
...
};

```

You need to configure your domain specific information, put those information into app/config/config.yml

```
    simple_ldap:
        settings:
            server: ip.to.server.ldap
            port: 389 or 636
            account_suffix : employeeNumber
            base_dn :
                base1: OU=people,DC=company
                base2: OU=contractors,OU=people,DC=company

        # The attribut you want your user Class to have
        settings_user:
            FullName: cn
        # The redirection after login based on the ROLE
        user_redirects:
          ROLE_USER: user_home
          ROLE_ADMIN: admin_home
        # Name of the user class
        user_class: Acme\DemoBundle\Security\User\CustomLdapUser
        #if the user is not registered in that database or is not registered as valid in the database he will have the default role
        default_role: ROLE_USER

```

You will also need to create an UserClass which inherit from the UserLdap defined in the bundle (Use that only if you want specific attribut from the ldap such as email or fullname)

```
