无法在Spring Security中找到j_spring_security_check

时间:2015-06-09 12:14:03

标签: spring spring-mvc web-applications spring-security web.xml

我正在开发Spring Security,我遇到的问题是“访问问题/ CustomRole / j_spring_security_check”

我的web.xml文件如下

<sec:http auto-config="true" disable-url-rewriting="true"
    use-expressions="true">
    <!-- When access is refused, will go to the 403.jsp -->
    <sec:intercept-url pattern="/login.jsp" filters="none" />
    <sec:form-login login-page="/login.jsp"
        authentication-failure-url="/login.jsp?error=true"
        login-processing-url="/j_spring_security_check.action"
        default-target-url="/index.jsp"
        always-use-default-target="true" />
    <sec:logout logout-success-url="/login.jsp" />
    <sec:http-basic />
    <!-- An increase in filter and Acegi, this is not the same, can not modify 
        the default filter, the filter is located in the FILTER_SECURITY_INTERCEPTOR 
        before> -->
    <sec:custom-filter before="FILTER_SECURITY_INTERCEPTOR"
        ref="myFilter" />
</sec:http>

<!-- A custom filter, you must include the authenticationManager, accessDecisionManager, 
    securityMetadataSource three attributes, All control we will achieve in the 
    three class, explain the specific configuration, see> -->
<beans:bean id="myFilter"
    class="com.demo.security.MyFilterSecurityInterceptor">
    <beans:property name="authenticationManager" ref="authenticationManager" />
    <beans:property name="accessDecisionManager" ref="myAccessDecisionManagerBean" />
    <beans:property name="securityMetadataSource" ref="securityMetadataSource" />
</beans:bean>

<!-- The authentication manager, entrance for user authentication, which 
    implements the UserDetailsService interface can be -->
<authentication-manager alias="authenticationManager">
    <authentication-provider user-service-ref="myUserDetailService">
        <!-- If the user's password using encryption, you can add a little salt 
            "" <password-encoder hash="md5"/> -->
    </authentication-provider>
</authentication-manager>
<beans:bean id="myUserDetailService" class="com.demo.security.MyUserDetailService" />

<!-- Access decision device, determines whether a user has a role, that 
    you have sufficient permissions to access a resource -->
<beans:bean id="myAccessDecisionManagerBean" class="com.demo.security.MyAccessDecisionManager">
</beans:bean>

<!-- Resource source data definition, the definition of a resource can be 
    what role access -->
<beans:bean id="securityMetadataSource"
    class="com.demo.security.MyInvocationSecurityMetadataSource" />

点击启动页面后,它成功打开登录页面。但是当我提供登录凭证并尝试登录时,它失败并抛出与“j_spring_security_check”相关的错误

我已根据http://www.programering.com/a/MTNygjMwATY.html

上的可用代码创建了代码

0 个答案:

没有答案