Browse Source

第三方添加江宁大数据局

release_hzx
蚂蚁哥 3 months ago
parent
commit
e2463a88a7
1 changed files with 11 additions and 2 deletions
  1. +11
    -2
      tuoheng_oidc_server/src/main/java/com/tuoheng/service/impl/ThirdServiceImpl.java

+ 11
- 2
tuoheng_oidc_server/src/main/java/com/tuoheng/service/impl/ThirdServiceImpl.java View File

log.info("clientId is {}, userName is {}",clientId,userName); log.info("clientId is {}, userName is {}",clientId,userName);


if(ThirdConstant.TUOHENG_AIRPORT_ADMIN.equals(clientId) && StringUtils.isEmpty(userName) && userName.equals("jnbigdata")){ if(ThirdConstant.TUOHENG_AIRPORT_ADMIN.equals(clientId) && StringUtils.isEmpty(userName) && userName.equals("jnbigdata")){
log.info("enterjnbigdata");
username = "jnbigdata"; username = "jnbigdata";
password = "thjs2023"; password = "thjs2023";
}else if(ThirdConstant.TUOHENG_AIRPORT_ADMIN.equals(clientId)){ }else if(ThirdConstant.TUOHENG_AIRPORT_ADMIN.equals(clientId)){
// username = "jnbigdata";
// password = "thjs2023";
log.info("enterclientId");
username = "jnbigdata";
password = "thjs2023";
username = ThirdConstant.GZJJ_USERNAME; username = ThirdConstant.GZJJ_USERNAME;
password = ThirdConstant.GZJJ_PASSWORD; password = ThirdConstant.GZJJ_PASSWORD;
}else if(ThirdConstant.TUOHENG_TELECOMUMALE_ADMIN.equals(clientId)){ }else if(ThirdConstant.TUOHENG_TELECOMUMALE_ADMIN.equals(clientId)){
return JsonResult.error("clientId error"); return JsonResult.error("clientId error");
} }


log.info("userName is {},password is {}" , username,password);
//通过oidc的密码模式获取授权token 等相关信息数据 //通过oidc的密码模式获取授权token 等相关信息数据
TokenResult tokenResult = getToken(clientId,username,password); TokenResult tokenResult = getToken(clientId,username,password);
tokenResult.setUserName(username); tokenResult.setUserName(username);
headers.add("Authorization", "Basic " + authorization); headers.add("Authorization", "Basic " + authorization);
HttpEntity<MultiValueMap<String, String>> httpEntity = new HttpEntity(params, headers); HttpEntity<MultiValueMap<String, String>> httpEntity = new HttpEntity(params, headers);


String jsonString = JSONObject.toJSONString(params);
String jsonString1 = JSONObject.toJSONString(headers);
log.info("sign json is " + jsonString);
log.info("sign json1 is " + jsonString1);

ResponseEntity<TokenResult> response = restTemplate.exchange(url, HttpMethod.POST, httpEntity, parameterizedTypeReference); ResponseEntity<TokenResult> response = restTemplate.exchange(url, HttpMethod.POST, httpEntity, parameterizedTypeReference);
log.info("sign result is " + JSONObject.toJSONString(response));
return response.getBody(); return response.getBody();
} }



Loading…
Cancel
Save