Download the PHP package l3/ldap-user-udl-bundle without Composer
On this page you can find all versions of the php package l3/ldap-user-udl-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package ldap-user-udl-bundle
Symfony 2/3/4/5/6/7 User provider from LDAP
Allow use LDAP like user provider and security in application written in Symfony2/3/4/5
Installation of the Bundle.
Install the Bundle with this command :
Launch the command composer update to install the package
For Symfony 2 and 3 : add the Bundle in AppKernel.php
For Symfony 4 and 5 and 6 and 7 : Verify if the lines are present in config/bundles.php file (if not present, just add the lines) :
Configuration of the bundle
For Symfony 2 and Symfony 3 : in the configuration file app/config/parameters.yml.dist and app/config/parameters.yml, add this under parameters:
and configure the values in parameters.yml file.
next in the configuration file app/config/config.yml, add this lines at the end of the file :
(optional) you can affect automatically a specific role to a user if the user got the ldap group in his memberOf ldap field. add this at the end of the file app/config/config.yml :
And configure the firewall in order to use the user provider of this Bundle :
For Symfony 4 and 5 and 6 and 7 : in the configuration file .env.local and .env, add this :
and configure the values in the file .env
next add this lines in the config/services.yaml file (under parameters) :
next in the configuration file config/services.yaml, add this lines at the end of the file :
(optional) you can affect automatically a specific role to a user if the user got the ldap group in his memberOf ldap field. add this at the end of the file config/services.yaml :
And configure the firewall in order to user the user provider of this Bundle :
For Symfony 6 and 7:
and specify ldap_user_provider for the keys provider for your firewalls in security.yaml file
Twig page for control if the user is present in the ldap group of the ROLE_USER
you can show a page twig if the user is not present in the ldap group of the ROLE_USER, just create the file app/Resources/TwigBundle/views/Exception/error.html.twig and add this :
ORM LDAP functions
You can make custom ORM LDAP Entity through Doctrine ORM. Just create your Entity like this Entity Account in your application Bundle :
- Dn : Use this annotation to build the dn with twig syntax
- Entity : Use this annotation to attribute to a php entity class an ldapObjectClass
- Column : Use this annotation to type the variable php
- Index : Use this annotation to set the index of the Entity
and in your Controller, you can read the LDAP with call your Entity like this :
For Symfony 7 :
for write the LDAP, call your Entity like this :
For symfony 7 :
Annotations
The Route annotations run if you install this package :
Troubleshooting
If you got this error Class "Doctrine\ORM\Mapping\Driver\AnnotationDriver" not found, downgrade the doctrine/orm package in your composer.json like this :
and then :
All versions of ldap-user-udl-bundle with dependencies
symfony/http-foundation Version ~6.0
symfony/security-bundle Version ~6.0
symfony/routing Version ~6.0
symfony/framework-bundle Version ~6.0
openldapobject/ldapobjectbundle Version 1.1.4