这是我配置 Spring-security 的方式:
<security:http auto-config="true">
<security:remember-me key="123456" /> <!-- Be Aware -->
<!-- Restrict URLs based on role -->
<security:intercept-url pattern="/index*" access="IS_AUTHENTICATED_ANONYMOUSLY" />
<security:intercept-url pattern="/account/*" access="IS_AUTHENTICATED_ANONYMOUSLY" />
<security:intercept-url pattern="/assets/**" access="IS_AUTHENTICATED_ANONYMOUSLY" />
<security:intercept-url pattern="/**" access="ROLE_USER" />
<!-- Override default login and logout pages -->
<security:form-login login-page="/account/login.html"
login-processing-url="/account/loginProcess"
default-target-url="/home.html"
authentication-failure-url="/account/login.html?login_error=1" />
<security:logout logout-url="/account/logout" logout-success-url="/account/login.html" />
</security:http>
我的登录页面还包括 Spring 安全性的所有必要项目(记住我的复选框、j_username、j_password)。要指出的另一件事是我登录后创建的 Spring-security cookie。但是,下次我启动浏览器时,我不会自动重定向到主页。(虽然会话存在,如果我尝试输入home.html我可以)。我想知道也许这是我应该在我的配置中暗示重定向到 home.html 的东西。但是我在互联网上找到的任何例子都提到了它。你能帮我吗?