本文采用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的安全框架实现的登录流程示例。通过配置RedirectView来控制登录后的重定向行为,并确保了登录请求是以POST方式提交的。示例中还包含了如何从客户端获取证书信息并验证其有效性。
1145

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



