|
|
@@ -216,41 +216,46 @@ public class CollegeUserServiceImpl extends ServiceImpl<CollegeUserMapper, Colle
|
|
|
public CommonResult<String> getUser(HttpServletRequest httpServletRequest) {
|
|
|
//根据code获取token
|
|
|
String code = httpServletRequest.getParameter("code");
|
|
|
- String url = ssoUrl+ "/oauth2/oauth/token";
|
|
|
- String key = APP_ID_TT;
|
|
|
-
|
|
|
- String grant_type ="authorization_code";
|
|
|
- String secret = PRIVATE_KEY_TT;
|
|
|
- HashMap<String,String> param = new HashMap<String,String>(2);
|
|
|
-
|
|
|
- //资源认证服务器地址
|
|
|
- param.put("code",code);
|
|
|
- param.put("grant_type",grant_type);
|
|
|
-
|
|
|
-
|
|
|
- log.info("根据code获取token请求参数============"+param.toString());
|
|
|
-
|
|
|
- String mapflag= HttpRequest.sendForm(url,param,key,secret);
|
|
|
- JSONObject jsonmsg = JSONObject.parseObject(mapflag);
|
|
|
- String token = jsonmsg.getString("access_token");
|
|
|
-
|
|
|
-
|
|
|
- //根据token获取用户信息请求参数
|
|
|
- JSONObject paramUser = new JSONObject();
|
|
|
- paramUser.put("token",token);
|
|
|
- paramUser.put("key",key);
|
|
|
- paramUser.put("secret",secret);
|
|
|
- String userUrl = ssoUrl+"/resourcesb/resources/index";
|
|
|
-
|
|
|
- log.info("根据token获取用户信息请求参数============"+paramUser.toString());
|
|
|
-
|
|
|
-
|
|
|
- String rs = HttpRequest.sendPost(userUrl, paramUser.toString());
|
|
|
- JSONObject userRs = JSONObject.parseObject(rs);
|
|
|
-
|
|
|
- JSONObject user=userRs.getJSONObject("data");
|
|
|
- String account=user.getString("iamUserCode");
|
|
|
|
|
|
+ if(ObjectUtil.isEmpty(code)){
|
|
|
+ return CommonResult.error("code为空");
|
|
|
+ }
|
|
|
+//
|
|
|
+// String url = ssoUrl+ "/oauth2/oauth/token";
|
|
|
+// String key = APP_ID_TT;
|
|
|
+//
|
|
|
+// String grant_type ="authorization_code";
|
|
|
+// String secret = PRIVATE_KEY_TT;
|
|
|
+// HashMap<String,String> param = new HashMap<String,String>(2);
|
|
|
+//
|
|
|
+// //资源认证服务器地址
|
|
|
+// param.put("code",code);
|
|
|
+// param.put("grant_type",grant_type);
|
|
|
+//
|
|
|
+//
|
|
|
+// log.info("根据code获取token请求参数============"+param.toString());
|
|
|
+//
|
|
|
+// String mapflag= HttpRequest.sendForm(url,param,key,secret);
|
|
|
+// JSONObject jsonmsg = JSONObject.parseObject(mapflag);
|
|
|
+// String token = jsonmsg.getString("access_token");
|
|
|
+//
|
|
|
+//
|
|
|
+// //根据token获取用户信息请求参数
|
|
|
+// JSONObject paramUser = new JSONObject();
|
|
|
+// paramUser.put("token",token);
|
|
|
+// paramUser.put("key",key);
|
|
|
+// paramUser.put("secret",secret);
|
|
|
+// String userUrl = ssoUrl+"/resourcesb/resources/index";
|
|
|
+//
|
|
|
+// log.info("根据token获取用户信息请求参数============"+paramUser.toString());
|
|
|
+//
|
|
|
+//
|
|
|
+// String rs = HttpRequest.sendPost(userUrl, paramUser.toString());
|
|
|
+// JSONObject userRs = JSONObject.parseObject(rs);
|
|
|
+//
|
|
|
+// JSONObject user=userRs.getJSONObject("data");
|
|
|
+// String account=user.getString("iamUserCode");
|
|
|
+ String account="ww";
|
|
|
SaBaseLoginUser saBaseLoginUser = loginUserApi.getUserByAccount(account);
|
|
|
|
|
|
if(ObjectUtil.isEmpty(saBaseLoginUser)){
|