【问题标题】:Spring Security 3.1.0.M1 - Direct an http block to call one authentication providerSpring Security 3.1.0.M1 - 指示 http 块调用一个身份验证提供程序
【发布时间】:2011-08-09 06:10:31
【问题描述】:

我正在使用 spring security 3.1.0 并且我有两个 http 块。一个用于 REST Web 服务层,我只想调用我的 userManager 身份验证提供程序,而不是两个身份验证提供程序。有没有办法将 http 块指向一个特定的身份验证提供者?

    <http pattern="/services/**" create-session="stateless">
        <intercept-url pattern="/**" access="ROLE_USER" />
        <http-basic />
    </http>
    <http access-denied-page="/auth/denied.html">
        <form-login
            login-processing-url="/j_spring_security_check.html"
            login-page="/auth/login.html"
            default-target-url="/registered/home.html"
            authentication-failure-url="/auth/login.html" />
         <logout invalidate-session="true" 
              logout-url="/auth/logout.html" 
              success-handler-ref="DCLogoutSuccessHandler"/>
        <anonymous username="guest" granted-authority="ROLE_ANONYMOUS"/>
        <custom-filter after="FORM_LOGIN_FILTER" ref="xmlAuthenticationFilter" />
    </http>

    <authentication-manager alias="am">
        <authentication-provider user-service-ref="userManager">
                <password-encoder ref="passwordEncoder" />
        </authentication-provider>
        <authentication-provider ref="xmlAuthenticationProvider" />
    </authentication-manager>

【问题讨论】:

    标签: spring spring-security


    【解决方案1】:

    请参阅configuring-spring-security-3-x-to-have-multiple-entry-points。您必须创建一个单独的令牌并覆盖身份验证提供程序的 supports 方法,以便提供程序只处理该令牌。

    【讨论】:

      猜你喜欢
      • 2012-02-18
      • 2012-03-07
      • 2011-01-03
      • 2012-01-15
      • 1970-01-01
      • 2016-05-23
      • 2018-05-07
      • 2019-07-16
      • 2011-02-09
      相关资源
      最近更新 更多