2013-06-03 76 views
1

的URL我需要使用嵌入式服務器什麼是嵌入式LDAP服務器

<security:authentication-manager> 
    <security:ldap-authentication-provider 
       user-search-filter="(uid={0})" 
       user-search-base="ou=users" 
       group-search-filter="(uniqueMember={0})" 
       group-search-base="ou=groups" 
       group-role-attribute="cn" 
       role-prefix="ROLE_"> 
    </security:ldap-authentication-provider> 
</security:authentication-manager> 

<security:ldap-server ldif="classpath:mojo_working.ldif" root="dc=example,dc=com" /> 

定製組裝器。

它像

<bean id="ldapAuthProvider" class="org.springframework.security.ldap.authentication.LdapAuthenticationProvider"> 
    <constructor-arg ref="authenticator"/> 
    <constructor-arg ref="populator"/> 
</bean> 

<bean id="authenticator" class="org.springframework.security.ldap.authentication.BindAuthenticator"> 
    <constructor-arg ref="contextSource"/> 
    <property name="userDnPatterns"> 
     <list> 
      <value>uid={0},ou=users</value> 
     </list> 
    </property> 
</bean> 

在這種情況下,什麼都可以好的ContextSource爲嵌入式LDAP服務器。

回答

2

ldap-server元素創建一個ContextSource,因此您不需要定義一個元素。它supports an id attribute,您可以使用它來創建對bean的引用。

<security:ldap-server id="embeddedServer" ... /> 

<bean id="authenticator" class="org.springframework.security.ldap.authentication.BindAuthenticator"> 
    <constructor-arg ref="embeddedServer"/> 
    ... 
</bean> 

所以通常你不需要URL。它還有一個port元素(默認33389),您可以設置它。除非您設置了不同的端口,否則URL將爲ldap://localhost:33389/dc=example,dc=com

+0

謝謝你..這是一個很大的幫助 – Discovery