简体   繁体   中英

FOS and Fr3d ldap Bundle with symfony2.1

Login for the first time and getting registered in the database. Though now I got the problem that I can't login a second time.

"symfony/symfony": "2.1.*"
"fr3d/ldap-bundle": "2.0.*@dev"

I have seen similar issies, but if "bindRequiresDn: true" i get in my logs:

[2013-07-10 11:37:18] ldap_driver.DEBUG: ldap_bind(Nikita, * *) [] []

[2013-07-10 11:37:18] ldap_driver.DEBUG: 0x1: Failed to retrieve DN for account: Nikita [Binding requires username in DN form] [] []

and can't login.

But if i change:

.../vendor/fr3d/ldap-bundle/FR3D/LdapBundle/Driver/ZendLdapDriver.php

 if ($user instanceof LdapUserInterface && $user->getDn()) {
     $bind_rdn = $user->getDn();
 } else {
     $bind_rdn = $user->getUsername();
 }

on

 if ($user instanceof LdapUserInterface) {
    $bind_rdn = $user->getDn();
 } else {
    $bind_rdn = $user->getUsername();
 }

all works good.

My config

 fr3d_ldap:
    driver:
        host:                     "%ldap_host%"
        port:                     "%ldap_port%"
        username:                 "%ldap_username%"
        password:                 "%ldap_password%"
        baseDn:                     ou=hello, dc=h, dc=i, dc=ru
        bindRequiresDn:        true
        accountFilterFormat: (&(samaccountname=%s))

    user:
        baseDn: ou=hello, dc=h, dc=i, dc=ru
        filter: (&(objectClass=user))
        attributes:
           - { ldap_attr: samaccountname,  user_method: setUsername }

I had problems when initially using FR3DLdapBundle and after logging out and then trying to login the 2nd time.

You may want to read through my blog article here: Symfony AD Integration

I'm not sure if you already got an answer or got this working, but hopefully this helps someone else out!

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