简体   繁体   中英

Spring-Security Spring-LDAP bind with Active Directory using sAMAccountName attribute

I have set up authentication against LDAP/AD and it is working fine. But now I wonder if it is possible to bind against Active Directory using the sAMAccountNAme attribute in the userDNPattern ?

Since some AD configuration prevents unauthenticated users to search, and I can't ask for a user in order to configure the context bean, I can't define a org.springframework.security.ldap.search.FilterBasedLdapUserSearch bean like:

<bean id="userSearch"
    class="org.springframework.security.ldap.search.FilterBasedLdapUserSearch">
    <constructor-arg>
        <value></value>
    </constructor-arg>
    <constructor-arg>
        <value>(sAMAccountName={0})</value>
    </constructor-arg>
    <constructor-arg ref="contextSource" />
    <property name="searchSubtree">
        <value>true</value>
    </property>
</bean>

Which would be enough.

Is there any work around?

Use Spring Security 3.1, It has built-in AD support.

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