Download the PHP package eidsonator/ldap-bundle without Composer
On this page you can find all versions of the php package eidsonator/ldap-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download eidsonator/ldap-bundle
More information about eidsonator/ldap-bundle
Files in eidsonator/ldap-bundle
Package ldap-bundle
Short Description LDAP Bundle for Symfony 2
License CeCILL
Homepage http://github.com/BorisMorel/LdapBundle
Informations about the package ldap-bundle
LdapBundle
LdapBundle provides LDAP authentication without using Apache's mod_ldap
. The bundle instead relies on PHP's LDAP extension along with a form to authenticate users. LdapBundle can also be used for authorization by retrieving the user's roles defined in LDAP.
Contact
Nick: aways IRC: irc.freenode.net - #symfony-fr
Install
- Download with composer
- Enable the Bundle
- Configure LdapBundle in security.yml
- Import LdapBundle routing
- Implement Logout
- Use chain provider
- Subscribe to PRE_BIND event
- Subscribe to POST_BIND event
Get the Bundle
Composer
Add LdapBundle in your project's composer.json
Enable the Bundle
Configure security.yml
Note:
An example
security.yml
file is located within the bundle at./Resources/Docs/security.yml
You should configure the parameters under the imag_ldap
section to match your environment.
Note:
The optional parameters have default values if not set. You can disable default values by setting a parameter to NULL.
Import routing
Implement Logout
Just create a link with a logout target.
Note:
You can refer to the official Symfony documentation : http://symfony.com/doc/current/book/security.html#logging-out
Chain provider
You can also chain the login form with other providers, such as database_provider, in_memory provider, etc.
Note:
If you have set the config option
bind_username_before: true
you must chain the providers with the ldap provider in the last position.
Subscribe to PRE_BIND event
The PRE_BIND is fired before the user is authenticated via LDAP. Here you can write a listener to perform your own logic before the user is bound/authenticated to LDAP. For example, to add your own roles or do other authentication/authorization checks with your application.
If you want to break the authentication process within your listener, throw an Exception.
Example listener:
Example:
Subscribe to POST_BIND event
The POST_BIND is fired after the user is authenticated via LDAP. You can use it in exactly the same manner as PRE_BIND.
Note:
However each time a page is refreshed, Symfony call the refreshUser method in the provider that is used and doesn't trigger these events (PRE_BIND and POST_BIND). If you want to override user (for example like credentials, roles ...), you must create a new provider and override this method.