0
votes

My system use fosuserbundle to manage user login and access control, it works well.

Now I'm trying to change login authentication from database to LDAP. I'm using symfony2.3, some bundles like fr3d_ldapbundle doesn't work well.

I just want to make things simple, change verify database's username and password to LDAP's username and password, is anyway to do that?

2

2 Answers

0
votes

Is anyway to do that?

Yes, try out this bundles. Better as rolling your own.

0
votes

After configuring the ldap bundle in the file services.yml, you need to add the ldap provider like this

    my_ldap:
        ldap:
            service: ldap
            base_dn: dc=example,dc=com
            search_dn: "ou=UTILISATEURS,cn=*{username}*,dc=cdbdx,dc=biz"
            search_password: xxxxx
            default_roles: ROLE_USER
            uid_key: xxxxxx
            filter: '(|(sn={username}*)(mailnickname={username}*))'

and then simply change your provider in the firewall you are using

    main:
        pattern: ^/
        form_login:
            provider: my_ldap
            csrf_token_generator: security.csrf.token_manager


        logout:       true
        anonymous:    true