private static Map<String, String> authorization(HttpMethodName name, String uri,
Map<String, String> params) throws URISyntaxException {
// 实际调用
BceV1Signer bceV1Signer = new BceV1Signer();
InternalRequest internalRequest = new InternalRequest(name, new URI(uri));
internalRequest.setParameters(params);
BceCredentials bceCredentials = new BceCredentials() {
@Override
public String getAccessKeyId() {
return accessKey;
}
@Override
public String getSecretKey() {
return secretKey;
}
};
SignOptions signOptions = new SignOptions();
signOptions.setHeadersToSign(Sets.newHashSet("host"));
bceV1Signer.sign(internalRequest, bceCredentials, signOptions);
Map<String, String> headers = internalRequest.getHeaders();
return headers;
}
百度云API获取认证-java
最新推荐文章于 2024-03-16 17:17:22 发布