public CredentialModel GetCredentials()

in aliyun-net-credentials/Provider/ProfileCredentialsProvider.cs [21:48]


        public CredentialModel GetCredentials()
        {
            string filePath = AuthUtils.EnvironmentCredentialsFile;
            if (filePath == null)
            {
                filePath = AuthConstant.GetDefaultFilePath();
            }
            else if (filePath.Length == 0)
            {
                throw new CredentialException("The specified credentials file is empty");
            }

            IniFileHelper iniFile;
            try
            {
                iniFile = new IniFileHelper(filePath);
            }
            catch (IOException)
            {
                throw new CredentialException(string.Format("Unable to open credentials file: {0}.", filePath));
            }

            if (!iniFile.Ini.ContainsKey(AuthUtils.ClientType))
            {
                throw new CredentialException("Client is not open in the specified credentials file");
            }
            return CreateCredential(iniFile.Ini[AuthUtils.ClientType]);
        }