Exemplo n.º 1
0
        public async ValueTask UpdateHttpRequestHeadersAsync(HttpClient httpClient)
        {
            var credentials = await _credentialsProvider.GetCredentialsAsync();

            var val = Convert.ToBase64String(Encoding.ASCII.GetBytes($"{credentials.Username}:{credentials.Password}"));

            httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", val);
        }
Exemplo n.º 2
0
        private async Task <string> GetCredentialsOrDefault(string credentialsId)
        {
            if (credentialsId == null)
            {
                return("anonymous");
            }

            var credentials = await _credentialsProvider.GetCredentialsAsync <UsernamePasswordCredentialsViewModel>(credentialsId);

            if (credentials == null)
            {
                throw new Exception("Failed to retrieve steam credentials for provisioning");
            }

            return($"{credentials.Username} {credentials.Password}");
        }