更新 spring 3 到 4 HandlerInterceptorAdapter preHandle 方法后,将 HttpServletRequest RequestURI 获取为 /login 但用户已成功通过身份验证并重定向到 /dashboard API
在 prehandle 方法中它总是返回登录并返回 true
onAuthenticationSuccess 方法
@Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
Authentication authentication) throws IOException, ServletException {
....
....
sendRedirect(request, response, "/" + Path.ADMIN_DASHBOARD);
....
....
}
HandlerInterceptorAdapter代码
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
String reqMapParam = request.getServletPath();
String uri = request.getRequestURI();
......
if (uri.endsWith("login")) {
request.getSession().invalidate();
return true;
}
response.sendRedirect(request.getContextPath() + "/dashboard");
return false;
}
我正在使用的版本 春天 - 4.3.0.RELEASE Spring Security - 4.2.3.RELEASE
所以非常感谢任何帮助。谢谢