use of com.aliyuncs.auth.sts.AssumeRoleResponse in project aliyun-oss-java-sdk by aliyun.
the class STSAssumeRoleSessionCredentialsProvider method getNewSessionCredentials.
private BasicCredentials getNewSessionCredentials() {
AssumeRoleRequest assumeRoleRequest = new AssumeRoleRequest();
assumeRoleRequest.setRoleArn(roleArn);
assumeRoleRequest.setRoleSessionName(roleSessionName);
assumeRoleRequest.setDurationSeconds(expiredDurationSeconds);
AssumeRoleResponse response = null;
try {
response = ramClient.getAcsResponse(assumeRoleRequest);
} catch (ClientException e) {
LogUtils.logException("RamClient.getAcsResponse Exception:", e);
return null;
}
return new BasicCredentials(response.getCredentials().getAccessKeyId(), response.getCredentials().getAccessKeySecret(), response.getCredentials().getSecurityToken(), expiredDurationSeconds).withExpiredFactor(expiredFactor);
}
Aggregations