单点登录教程(三)——跨域单点登录
现在需求改了,联合国规定凡在手机购票了可以到广州塔和巴黎铁塔。显然广州和巴黎不是同一个国家了。我们可以不用到广州塔下买票,也不用到巴黎去买票,但能随时随地买票。
跨域单点登录
http://www.guangzhouta.com/ssm_crud1/index
http://www.senbowuguan.com/ssm_crud2/index
http://www.checkcookie.com/sso_crud3/checkCookie
@RequestMapping(value="/doLogin")
public ModelAndView doLogin(String username, String password, HttpServletRequest request){
ModelAndView mav = new ModelAndView();
Map<String,String> map = new HashMap<String, String>();
map.put("username", username);
map.put("password", password);
String result = _guangzhoutaToolUtil.doGet("http://www.checkcookie.com/sso_crud3/doLogin", map);
if(result.equals("1")){
List<String> hiddenUrl = new ArrayList<String>();
hiddenUrl.add("http://www.guangzhouta.com/ssm_crud1/addCookie");
hiddenUrl.add("http://www.senbowuguan.com/ssm_crud2/addCookie");
mav.addObject("hiddenUrl",hiddenUrl);
mav.setViewName("index1");
return mav;
}
mav.addObject("gotoUrl", "http://www.guangzhouta.com/ssm_crud1/index");
mav.setViewName("login");
return mav;
}
注意:需要本文资源可关注微信号艳辉网 回复关键字‘java152’获取。