ApacheDS 1.5.7 - SASL 配置

发布于 2024-11-07 10:25:45 字数 127 浏览 0 评论 0原文

我目前尝试设置 ApacheDS 实例来测试 SASL 机制。

有人设法让 SASL 在 ApacheDS 中工作吗?

我正在寻找 ApacheDS 1.5.7 的工作设置说明并确认这在实践中有效......

I currently try to setup an ApacheDS instance to test SASL mechanisms.

Anyone out there that managed to get SASL in ApacheDS to work?

I am looking for a working setup instruction for ApacheDS 1.5.7 and a confirmation of that this works in practice...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

昔日梦未散 2024-11-14 10:25:45

1.5.7 支持 SASL,但我建议您尝试最新版本的 2.0 M2。
(1.5.7 非常旧,如果出现某些问题,我们可能不支持您)

1.5.7 has support for SASL but I would suggest you try the latest release of version 2.0 M2.
(1.5.7 is very old and we may not support you in case of some issues)

雾里花 2024-11-14 10:25:45

好吧,我做了一个测试 Spring 应用程序,以便对用户进行身份验证。我不确定这是否是您想要的,但无论如何我都会发布解决方案。 (这篇文章有点晚了..但是)

就像我说的,我使用了 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 中我制作了一个简单的用户和用户组(管理员/用户)结构。

就是这样!如果您不理解代码中的某些内容,请告诉我,我会尽力提供帮助。

Well I made a test Spring App in order to do authentication of users.. I am not sure if this is what you want, but I will post the solution anyway. (this post is a little bit late.. but)

Like I said I used spring, spring security and 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>

And this is the 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>

And In apache DS I made a simple structure of users and group of users (admin/user).

That is it! If you dont understand something in the code just let me know and I will try to help..

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文