本文采用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方式提交請求 }