1

环境:Spring 3.1.3 Spring 安全性:3.1.3 Spring ldap:1.3.1 JDK1.6

问题:我的登录处理 URL 上出现 404。

详细信息:我有三个 http 拦截块:一个公共的,第二个用于拦截和保护管理员的 URL(使用身份验证管理器 1),第三个用于普通用户(使用身份验证管理器 2)。

当 http 拦截块 1 中的登录表单将凭据发布到表单登录的 login-processing-url 时,它会产生 404。我确实明白这一点 - 因为表单登录宣布了 login-processing-url,不应该这样过滤器链识别那个 URL?

另外,我应该在表单的登录处理 url 上明确地执行“permitAll”,还是在幕后自动完成?

最后,有不同的 http 拦截器块有不同的登录处理 URL 是否有问题?(我不明白为什么 - 但我还是问)。

配置:

弹簧安全配置:

//...
<debug />
<global-method-security secured-annotations="enabled" />
<http pattern="/public/**" security="none"/>
<http use-expressions="true" pattern="/protected/x/support/**" authentication-manager-ref="lAdminAuthManager">
    <intercept-url pattern="/protected/x/support/**" access="hasRole('ROLE_ADMIN')"/>
    <form-login login-page="/public/login.jsp"
            login-processing-url="/protected/x/support/j_spring_security_check"
            username-parameter="username"
            password-parameter="password"
            authentication-failure-url="/login/form?error"
            default-target-url="/protected/x/support/index.html"/>
</http>
<http use-expressions="true" entry-point-ref="lUserLoginEntryPoint">
    <intercept-url pattern="/protected/x/foo1/**" access="permitAll"/>
    <intercept-url pattern="/protected/x/foo2/**" access="permitAll"/>
    <intercept-url pattern="/j_spring_security_check" access="permitAll"/>
    <intercept-url pattern="/**" access="hasRole('ROLE_USER')"/>
    <custom-filter ref="lUserLoginFilter" position="FORM_LOGIN_FILTER"/>
    <custom-filter ref="lPreauthAuthenticationFilter" position="PRE_AUTH_FILTER" />
</http>

//...

非常感谢任何提示!

谢谢,

乌玛

4

1 回答 1

0

任何方式检查以下链接。它可以帮助你

访问http://krams915.blogspot.com/2010/12/spring-security-mvc-integration_18.html

http://static.springsource.org/spring-security/site/docs/3.1.x/reference/springsecurity.html

即使配置文件中的小 url 冲突也会导致 404 错误。

于 2013-02-18T11:04:39.133 回答