简体   繁体   中英

FR3DLdapBundle Authenticating against Active Directory doesn't find by “sAMAccountName”

I've install FR3LdapBundle & FOSUserBundle with Symfony3 successfully as per my blog , and I'm able to authenticate against this test LDAP server ; but now I'm trying to authenticate against our internal MS Active Directory Server.

Here is the change in config (I have obsfucated the config information on purpose):

fr3d_ldap:
    driver:
        host: somehostname
        port: 389
        username: someuser
        password: password
        accountDomainName: TCADMIN.somedomain.com
        accountDomainNameShort: TCADMIN
    user:
        baseDn: cn=Users,dc=somedomain,dc=com
        filter: (&(ObjectClass=Person))
        attributes:
            - { ldap_attr: samaccountname,  user_method: setUsername }

The above is the only change I made. In my DEV logs, when I log in I get these important messages:

[2016-06-08 15:18:34] ldap_driver.DEBUG: {action}({base_dn}, {filter}, {attributes}) {"action":"ldap_search","base_dn":"cn=Users,dc=somedomain,dc=com","filter":"(&(&(ObjectClass=Person))(uid=pet_acad))","attributes":[]} []
[2016-06-08 15:18:34] security.INFO: User {username} {result} on LDAP {"action":"loadUserByUsername","username":"pet_acad","result":"not found"} []

The user "pet_acad" definately does exist, and that is the "sAMAccountName" value when I use an LDAP browser. I'm normally able to login as this user as "TCADMIN\\pet_acad", this is on a windows host.

So I wonder if I need a special config? Possibly to enable search on " sAMAccountName "

You have to define what LDAP attribute contains the username

fr3d_ldap:
    user:
        usernameAttribute: sAMAccountName

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