FR3DLdapBundle Login with email

188 Views Asked by At

I'm new on LDAP concept and i have to make a integration with LDAP and FosUserBundle. I've installed both bundles, fosuser and FR3DLdapBundle, fosuser is working but i'm missing something about LDAP login.

I need to login with email.

I have the following config: http://pastebin.com/USkJqtbD

I'm using this website for tests: http://www.forumsys.com/tutorials/integration-how-to/ldap/online-ldap-test-server/

I'm using email: [email protected] and password: password

But i have the following error

[2015-05-18 16:36:58] ldap_driver.DEBUG: ldap_search(cn=read-only-admin,dc=example,dc=com, (&(objectClass=*)([email protected])), uid,mail) [] []

[2015-05-18 16:36:58] security.INFO: User [email protected] not found on ldap [] []

Thank you in advance for you help

2

There are 2 best solutions below

0
qooplmao On

With the FR3D Ldap bundle the first attribute that you add in the attributes list is then one that it uses to search by.

In your config the first attribute is uid, so I would suspect that if you used the uid as the username then it would properly. To sort it you will just need to switch up the order so the your mail attribute is first in the list.

fr3d_ldap:
    // ...
    user:
        // ...
        attributes:  # Specify ldap attributes mapping [ldap attribute, user object method]
            - { ldap_attr: mail,  user_method: setEmail } # Default
            - { ldap_attr: uid,  user_method: setUsername }
0
Maks3w On

You have to adapt the search query for find by email.

https://github.com/Maks3w/FR3DLdapBundle/blob/master/Resources/doc/index.md#4-configure-configyml

# app/config/config.yml
fr3d_ldap:
  driver:
    accountFilterFormat: (&(email=%s)) # Optional. sprintf format %s will be the username