本文采用spring3.0说明解决方案:
重点在:
RedirectView("/j_spring_security_check", true, false, true);//false代表以post方式提交请求
第二个参数觉得是否提交, 否则安全框架默认不允许get的方式提交。
@RequestMapping(value = "caLogin.html") public RedirectView caLogin(HttpServletRequest request, ModelMap model) throws Exception { String caStr=this.getCaStr(request); if(!StringUtils.hasLength(caStr)) throw new CAException(caStr+" CA服务器认证失败!请确认是否插入key"); User user=BeanHelper.getBean(UserService.class).getUserByCa(caStr); log.info("ca证书="+caStr+" ca用户="+user.getName()); model.put("j_username", user.getUsername()); model.put("j_password", user.getPassword()); return new RedirectView("/j_spring_security_check", true, false, true);//false代表以post方式提交请求 }
本文介绍如何使用Spring 3.0实现登录流程中的重定向,特别是如何设置重定向视图以POST方式提交请求,确保安全框架正确处理登录过程。
1152

被折叠的 条评论
为什么被折叠?



