public Map<String, Object> checkTokenForYh(String token, String sysFlag, HttpServletRequest request) {
String yHtoken = (String) request.getSession().getAttribute("YHtoken");
if (token.trim().equals(yHtoken.trim()) && sysFlag.trim().equals("fundcrm")) {
Map<String, Object> map = new HashMap<>();
map.put("result", "success");
map.put("userId", "liuzhi12");
map.put("userAlias", null);
map.put("userEmail", null);
map.put("userRoles", null);
map.put("userGroups", null);
map.put("param", null);
return map;
} else {
Map<String, Object> map = new HashMap<>();
map.put("result", "error");
map.put("userId", null);
map.put("userAlias", null);
map.put("userEmail", null);
map.put("userRoles", null);
map.put("userGroups", null);
map.put("param", null);
return map;
}
}
就是和传来的token 做了一下比对,返回个结果
@PostMapping("/fundcrmbiservice")
@ApiOperation("永洪回调接口")
@ApiResponse(response = Map.class, message = "success", code = 200)
@ApiImplicitParams({
@ApiImplicitParam(name = "token"),
@ApiImplicitParam(name = "sysFlag")
})
public Map<String, Object> checkTokenAndFlag(@RequestParam("token") String token,
@RequestParam("sysFlag") String sysFlag,
HttpServletRequest request) {
if ((token == null || token.trim().isEmpty()) ||
(sysFlag == null || sysFlag.trim().isEmpty())
) {
Map<String, Object> map = new HashMap<>();
map.put("result", "没有权限");
map.put("userId", null);
map.put("userAlias", null);
map.put("userEmail", null);
map.put("userRoles", null);
map.put("userGroups", null);
map.put("param", null);
return map;
} else {
YongHongService yongHongService = new YongHongServiceImpl();
return yongHongService.checkTokenForYh(token, sysFlag,request);
}
} |