【发布时间】:2011-05-17 13:06:36
【问题描述】:
我目前尝试设置一个 ApacheDS 实例来测试 SASL 机制。
有人设法让 ApacheDS 中的 SASL 工作吗?
我正在寻找 ApacheDS 1.5.7 的工作设置说明,并确认这在实践中有效...
【问题讨论】:
我目前尝试设置一个 ApacheDS 实例来测试 SASL 机制。
有人设法让 ApacheDS 中的 SASL 工作吗?
我正在寻找 ApacheDS 1.5.7 的工作设置说明,并确认这在实践中有效...
【问题讨论】:
1.5.7 支持 SASL,但我建议您尝试最新版本的 2.0 M2 版本。 (1.5.7 太老了,如果出现一些问题我们可能不支持你)
【讨论】:
好吧,我做了一个测试 Spring App 来对用户进行身份验证。我不确定这是否是你想要的,但无论如何我都会发布解决方案。 (这篇文章有点晚了..但是)
就像我说的,我使用了 spring、spring security 和 apacheDS。
spring-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 中,我创建了一个简单的用户结构和用户组(管理员/用户)。
就是这样!如果您不理解代码中的某些内容,请告诉我,我会尽力提供帮助..
【讨论】: