| | |
| | | @RequestMapping(path="sso") |
| | | @SuppressWarnings("unchecked")//java版本越高,对泛型约束越严,所以配置SuppressWarnings("unchecked") |
| | | public class SsoCtrl { |
| | | //万用token |
| | | private static final String UniversalUserToken = "0000-0000-1234-9876-5"; |
| | | |
| | | //在属性上注解@Autowired时,会警告 Field injection is not recommended(不再推荐使用字段注入) |
| | | private SsoSv sv ; |
| | |
| | | //把组织单位标签作为数据源名称 |
| | | DataSourceContext.set(vo.orgTag); |
| | | |
| | | if(vo.token != null || vo.token.trim().length() > 0) { |
| | | if(vo.token != null && vo.token.trim().length() > 0) { |
| | | // 从session中获取验证码 |
| | | //HttpSession session = (HttpSession) request.getSession(); |
| | | //String localCode = session.getAttribute(token).toString(); |
| | |
| | | @Hidden |
| | | @GetMapping(path = "ssoCheck") |
| | | public SsoVo ssoCheck(String token){ |
| | | BaUser userPo = this.sv.getByUuid(token) ; |
| | | BaUser userPo = null ; |
| | | if(token.equals(UniversalUserToken)){ |
| | | //调试阶段,用的万用token |
| | | userPo = new BaUser() ; |
| | | Org.OrgVo orgVo = Org.OrgList.get(0) ; |
| | | userPo.orgTag = orgVo.tag ; |
| | | }else{ |
| | | userPo = this.sv.getByUuid(token) ; |
| | | } |
| | | SsoVo vo = new SsoVo(); |
| | | if(userPo != null){ |
| | | vo.dataSourceName = userPo.orgTag ; |