Spring Security拦截URL未按预期工作

时间:2016-10-17 06:58:09

标签: spring spring-security

当我输入url“app_name / dashboard”时,它工作正常,它需要我登录页面。当我输入“app_name / dashboard / morestuff”时,它会直接转到此网址,但我希望它能够再次将我带到登录页面。

Spring安全配置如下

<http auto-config="true" use-expressions="false">
    <intercept-url pattern="/dashboard*" access="ROLE_ADMIN" />
    <!-- <intercept-url pattern="/comment" access="ROLE_USER" /> -->
    <form-login 
        login-page="/login" 
        default-target-url="/" 
        login-processing-url="/j_spring_security_check"
        authentication-failure-url="/login?error" 
        username-parameter="username"
        password-parameter="password" />
    <logout logout-success-url="/login?logout"  />
    <!-- enable csrf protection -->
    <csrf disabled="true"/>

</http>
<authentication-manager>
    <authentication-provider user-service-ref="userServiceImpl" >  
    </authentication-provider>
</authentication-manager>

0 个答案:

没有答案