简体   繁体   中英

FR3DLdapBundle Login with email

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: riemann@ldap.forumsys.com 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=*)(uid=riemann@ldap.forumsys.com)), uid,mail) [] []

[2015-05-18 16:36:58] security.INFO: User riemann@ldap.forumsys.com not found on ldap [] []

Thank you in advance for you help

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 }

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM