1、调用的流程
2、本地通过httpclient的方式获取外部服务的token
String getToken(){
// 通过账号密码获取华为云Token Begin
String requestBody = "{\"auth\":{\"identity\":{\"methods\":[\"password\"],\"password\":{\"user\":{\"name\":\"hw47723473\",\"password\":\"hd12345\",\"domain\":{\"name\":\"hw47723473\"}}}},\"scope\":{\"project\":{\"name\":\"cn-north-4\"}}}}";
RestTemplate restTemplate = new RestTemplate();
String url = "https://iam.cn-north-4.myhuaweicloud.com/v3/auth/tokens";
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
ResponseEntity<String> response = restTemplate.postForEntity(url, requestBody, String.class);
String token = response.getHeaders().get("X-Subject-Token").toString();
return token.substring(1,token.length()-1);
// 通过账号密码获取华为云Token End
}