com.aliyuncs.v5.auth.StaticCredentialsProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aliyun-java-sdk-core-v5 Show documentation
Show all versions of aliyun-java-sdk-core-v5 Show documentation
Aliyun Open API SDK for Java
Copyright (C) Alibaba Cloud Computing
All rights reserved.
版权所有 (C)阿里云计算有限公司
http://www.aliyun.com
The newest version!
package com.aliyuncs.v5.auth;
import com.aliyuncs.v5.profile.IClientProfile;
public class StaticCredentialsProvider implements AlibabaCloudCredentialsProvider {
private AlibabaCloudCredentials credentials = null;
public StaticCredentialsProvider(AlibabaCloudCredentials credentials) {
this.credentials = credentials;
}
@SuppressWarnings("deprecation")
public StaticCredentialsProvider(IClientProfile clientProfile) {
IClientProfile clientProfile1 = clientProfile;
Credential legacyCredential = clientProfile1.getCredential();
if (null != legacyCredential.getSecurityToken()) {
this.credentials = new BasicSessionCredentials(legacyCredential.getAccessKeyId(), legacyCredential
.getAccessSecret(), legacyCredential.getSecurityToken());
} else {
this.credentials = new LegacyCredentials(legacyCredential);
}
}
@Override
public AlibabaCloudCredentials getCredentials() {
return this.credentials;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy