我在让我的登录总是重定向到同一个地方时遇到了一些麻烦。我做过这样的事
<http auto-config="true" use-expressions="true" entry-point-ref="gaeEntryPoint" >
<intercept-url pattern="/_ah/login" access="permitAll"/>
<intercept-url pattern="/**" access="isAuthenticated()"/>
<custom-filter position="PRE_AUTH_FILTER" ref="gaeFilter"/>
<form-login authentication-success-handler-ref="authSuccessHandler"/>
</http>
<beans:bean id="authSuccessHandler"
class="dk.lindhardt.arbejdsfordeling.server.security.AuthenticationSuccessHandlerImpl"/>
和
public class AuthenticationSuccessHandlerImpl implements AuthenticationSuccessHandler {
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication)
throws IOException, ServletException {
if (authentication != null && authentication.isAuthenticated()) {
response.sendRedirect(OrganizationListServlet.URL);
}
}
}
它永远不会进入上面的这个方法。我如何让它这样做?
编辑:我正在遵循本指南 http://blog.springsource.com/2010/08/02/spring-security-in-google-app-engine/
最佳答案
您不应该需要那个 servlet 然后进行重定向。您可以在配置本身中进行重定向。
<http auto-config="true">
<intercept-url pattern="/app/login" filters="none" />
<form-login
login-page="/app/login"
login-processing-url="/app/dologin"
authentication-failure-url="/app/login?login_error=1"
default-target-url="/app/home"/>
</http>
关于java - 登录后重定向(GAE 上的 Spring 安全性),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5157902/