2011-05-17 28 views
0

我目前嘗試設置一個ApacheDS實例來測試SASL機制。ApacheDS 1.5.7 - SASL配置

任何在那裏設法讓ApacheDS中的SASL工作?

我找了ApacheDS的1.5.7工作設置指令和這工作在實踐中予以確認

回答

0

1.5.7具有支持SASL,但我建議你嘗試的最新版本版本2.0 M2。 (1.5.7已經很老了,我們可能不支持你的一些問題的情況下)

0

嗯,我爲了做用戶的認證做了一個試驗春天應用程序..我不知道這是你想要的,但無論如何我會發布解決方案。 (這篇文章有點晚了......但是)

就像我說過的,我用spring,spring security和apacheDS。

彈簧的security.xml

<!-- This is where we configure Spring-Security --> 
    <security:http auto-config="true" use-expressions="true" access-denied-page="/app/denied" > 

     <security:intercept-url pattern="/app/login" access="permitAll"/> 
     <security:intercept-url pattern="/app/admin" access="hasRole('ROLE_ADMIN')"/> 
     <security:intercept-url pattern="/app/common" access="hasRole('ROLE_USER')"/> 

     <security:form-login 
       login-page="/app/login" 
       authentication-failure-url="/app/login?error=true" 
       default-target-url="/app/common"/> 

     <security:logout 
       invalidate-session="true" 
       logout-success-url="/app/login" 
       logout-url="/app/logout"/> 

    </security:http> 

    <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 url="ldap://localhost:10389/o=test" manager-dn="uid=admin,ou=system" manager-password="secret" /> 

</beans> 

而這正是wep.xml

<web-app version="2.5" 
     xmlns="http://java.sun.com/xml/ns/javaee" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> 
    <display-name>Getting Started with Spring</display-name> 

    <context-param> 
     <param-name>contextConfigLocation</param-name> 
     <param-value> 
     /WEB-INF/spring-security.xml 
     /WEB-INF/applicationContext.xml 
     <!-- /WEB-INF/spring-ldap.xml--> 
     </param-value> 
    </context-param> 

    <listener> 
     <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
    </listener> 

    <servlet> 
     <servlet-name>Spring MVC Servlet</servlet-name> 
     <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
     <init-param> 
      <param-name>contextConfigLocation</param-name> 
      <param-value>/WEB-INF/spring-mvc-context.xml</param-value> 
     </init-param> 
    </servlet> 

    <servlet-mapping> 
     <servlet-name>Spring MVC Servlet</servlet-name> 
     <url-pattern>/app/*</url-pattern> 
    </servlet-mapping> 

    <filter> 
      <filter-name>springSecurityFilterChain</filter-name> 
      <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> 
    </filter> 

    <filter-mapping> 
      <filter-name>springSecurityFilterChain</filter-name> 
      <url-pattern>/*</url-pattern> 
    </filter-mapping> 

</web-app> 

並將其在Apache DS我由用戶的簡單的結構和組用戶(管理員/用戶)的。

就是這樣!如果您不明白代碼中的某些內容,請讓我知道,我會盡力幫助您。