Search in sources :

Example 1 with AlibabaCloudCredentials

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();
    }
}
Also used : BasicSessionCredentials(com.aliyuncs.auth.BasicSessionCredentials) AlibabaCloudCredentials(com.aliyuncs.auth.AlibabaCloudCredentials) IOException(java.io.IOException)

Aggregations

AlibabaCloudCredentials (com.aliyuncs.auth.AlibabaCloudCredentials)1 BasicSessionCredentials (com.aliyuncs.auth.BasicSessionCredentials)1 IOException (java.io.IOException)1