我想根据 login.jsp 页面中的一些隐藏值重定向我的页面,这是我的代码
public class AuthenticationHandler extends SavedRequestAwareAuthenticationSuccessHandler {
private final String HASH_URL = "hashURL";
@Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws ServletException, IOException {
super.onAuthenticationSuccess(request, response, authentication);
String hashValue = request.getParameter(HASH_URL);
if(hashValue != null){
if(!hashValue.isEmpty()){
setDefaultTargetUrl("/home/" + hashValue);
}
}
}
}
我可以看到 hashValue 正在从 login.jsp 页面获取最新值,但它总是在移动站点 /home/ 页面,这是我的配置
<security:form-login
login-page="/auth/login"
default-target-url="/home/"
authentication-success-handler-ref="customAuthenticationSuccessHandler"
always-use-default-target="true"
authentication-failure-url="/auth/login?error=true"/>