use of com.aliyuncs.auth.AlibabaCloudCredentials in project fc-java-sdk by aliyun.
the class Config method refreshCredentials.
/**
* refresh credentials if CredentialProvider set
*/
public void refreshCredentials() {
if (this.credsProvider == null)
return;
try {
AlibabaCloudCredentials creds = this.credsProvider.getCredentials();
this.accessKeyID = creds.getAccessKeyId();
this.accessKeySecret = creds.getAccessKeySecret();
if (creds instanceof BasicSessionCredentials) {
this.securityToken = ((BasicSessionCredentials) creds).getSessionToken();
}
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations