EOSS单点登录初稿

This commit is contained in:
owan 2024-11-08 16:39:15 +08:00
parent a57a7e2f48
commit c5c4d075e5
2 changed files with 24 additions and 23 deletions

View File

@ -59,8 +59,7 @@ public class AuthService {
* @return
*/
public static String getUserInfo(String token,String eoss_ip,String client_id,String client_secret){
// SystemParamServiceHelper.getP
logger.info("getUserInfo→请求地址%s", token);
logger.info("getUserInfo→请求token%s", token);
HttpHeaders api_headers = new HttpHeaders();//请求头
api_headers.add("Content-Type", "application/json; charset=utf-8");
HashMap<String, Object> requestBody = new HashMap<>();

View File

@ -64,11 +64,12 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler {
if (StringUtils.isEmpty(code)){
logger.error("getTrdSSOAuth→统一认证授权码为空");
result.setSucess(false);
}
}else {
try {
//TODO:调用accessToken方法
String data = AuthService.accessToken(code, EOSS_IP, CLIENT_ID, CLIENT_SECRET);
logger.info(String.format("accessToken返回数据%s", data));
//TODO:调用getUserInfo方法
String access_token = JSON.parseObject(data).getString("access_token");
String user = AuthService.getUserInfo(access_token, EOSS_IP, CLIENT_ID, CLIENT_SECRET);
@ -83,11 +84,12 @@ public class SSOPluginLogin implements ThirdSSOAuthHandler {
result.setUserType(UserName);
result.setUser(loginName);
result.setSucess(true);
logger.info("SSO用户登录成功进入苍穹系统");
}
} catch (Exception e) {
e.printStackTrace();
}
logger.info("SSO用户登录成功进入苍穹系统");
}
return result;
}
}