Пример #1
0
        public void Reuse_last_used_credentials()
        {
            // Arrange
            var cache = new HttpCredentialCache
            {
                new BasicCredentials(new Uri("http://example.org"), username: "", password: "")
            };

            var authService = new CredentialService(cache);
            var request = new HttpRequestMessage(){RequestUri = new Uri("http://example.org")};
            authService.CreateAuthenticationHeaderFromChallenge(request, new[] { new AuthenticationHeaderValue("basic", "") });

            // Act
            var header = authService.CreateAuthenticationHeaderFromRequest(request);

            // Assert
            Assert.Equal("basic", header.Scheme);

        }
Пример #2
0
 public AuthMessageHandler(HttpMessageHandler innerHandler, CredentialService credentialService)
 {
     InnerHandler = innerHandler;
     _credentialService = credentialService;
 }
Пример #3
0
 public AuthMessageHandler(HttpMessageHandler innerHandler, CredentialService credentialService)
 {
     InnerHandler       = innerHandler;
     _credentialService = credentialService;
 }