use of com.aliyuncs.auth.sts.GetSessionAccessKeyRequest in project aliyun-oss-java-sdk by aliyun.
the class STSKeyPairSessionCredentialsProvider method getNewSessionCredentials.
private BasicCredentials getNewSessionCredentials() {
GetSessionAccessKeyRequest request = new GetSessionAccessKeyRequest();
request.setPublicKeyId(keyPairCredentials.getAccessKeyId());
request.setDurationSeconds((int) expiredDurationSeconds);
request.setProtocol(ProtocolType.HTTPS);
GetSessionAccessKeyResponse response = null;
try {
response = this.ramClient.getAcsResponse(request);
} catch (ClientException e) {
LogUtils.logException("RamClient.getAcsResponse Exception:", e);
return null;
}
return new BasicCredentials(response.getSessionAccesskey().getSessionAccessKeyId(), response.getSessionAccesskey().getSessionAccessKeySecert(), null, expiredDurationSeconds).withExpiredFactor(expiredFactor);
}
Aggregations