public CredentialModel GetSTSOIDCRoleSessionCredentials()

in aliyun-net-credentials/Provider/ProfileCredentialsProvider.cs [285:313]


        public CredentialModel GetSTSOIDCRoleSessionCredentials(Dictionary<string, string> clientConfig)
        {
            string roleSessionName = DictionaryUtil.Get(clientConfig, AuthConstant.IniRoleSessionName);
            string roleArn = DictionaryUtil.Get(clientConfig, AuthConstant.IniRoleArn);
            string OIDCProviderArn = DictionaryUtil.Get(clientConfig, AuthConstant.IniOIDCProviderArn);
            string OIDCTokenFilePath = DictionaryUtil.Get(clientConfig, AuthConstant.IniOIDCTokenFilePath);
            string regionId = DictionaryUtil.Get(clientConfig, AuthConstant.DefaultRegion);
            string policy = DictionaryUtil.Get(clientConfig, AuthConstant.IniPolicy);

            if (string.IsNullOrWhiteSpace(roleArn))
            {
                throw new CredentialException("The configured role_arn is empty");
            }

            if (string.IsNullOrWhiteSpace(OIDCProviderArn))
            {
                throw new CredentialException("The configured oidc_provider_arn is empty");
            }

            OIDCRoleArnCredentialProvider provider = new OIDCRoleArnCredentialProvider.Builder()
                .RoleArn(roleArn)
                .OIDCProviderArn(OIDCProviderArn)
                .OIDCTokenFilePath(OIDCTokenFilePath)
                .RoleSessionName(roleSessionName)
                .RegionId(regionId)
                .Policy(policy)
                .Build();
            return provider.GetCredentials();
        }