private async Task CreateCredentialAsync()

in aliyun-net-credentials/Provider/ProfileCredentialsProvider.cs [118:152]


        private async Task<CredentialModel> CreateCredentialAsync(Dictionary<string, string> clientConfig)
        {
            string configType = clientConfig[AuthConstant.IniType];
            if (string.IsNullOrWhiteSpace(configType))
            {
                throw new CredentialException("The configured client type is empty");
            }

            switch (configType)
            {
                case AuthConstant.IniTypeArn:
                    return await GetSTSAssumeRoleSessionCredentialsAsync(clientConfig);
                case AuthConstant.IniTypeKeyPair:
                    return await GetSTSGetSessionAccessKeyCredentialsAsync(clientConfig);
                case AuthConstant.IniTypeRam:
                    return await GetInstanceProfileCredentialsAsync(clientConfig);
                case AuthConstant.OIDCRoleArn:
                    return await GetSTSOIDCRoleSessionCredentialsAsync(clientConfig);
            }

            string accessKeyId = clientConfig[AuthConstant.IniAccessKeyId];
            string accessKeySecret = clientConfig[AuthConstant.IniAccessKeyIdsecret];
            if (string.IsNullOrWhiteSpace(accessKeyId) || string.IsNullOrWhiteSpace(accessKeySecret))
            {
                throw new CredentialException("The configured access_key_id or access_key_secret is empty");
            }

            return new CredentialModel
            {
                AccessKeyId = accessKeyId,
                AccessKeySecret = accessKeySecret,
                Type = AuthConstant.AccessKey,
                ProviderName = "static_ak"
            };
        }