public async Task it_should_challenge_the_response() { var response = this.CreateResponse(); await _authenticationProvider.Process(response); response.Headers.WWWAuthenticate.Should().Be(BasicAuthenticationProvider.AuthenticationScheme + " realm=\"" + RequestExtensions.DefaultHost + "\""); }
public async Task it_should_authenticate_user() { var expectedUser = "******"; var expectedPassword = "******"; var authorization = "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(expectedUser + ":" + expectedPassword)); var request = this.CreateRequest(new Header("Authorization", authorization)); _identityProvider.Setup(instance => instance.ValidateCredentials(expectedUser, expectedPassword)).Returns(new BasicClaimBasedIdentity(expectedUser)); await _authenticationProvider.Process(request); request.Identity.IsAuthenticated.Should().BeTrue(); request.Identity[ClaimTypes.Name].Should().Contain(expectedUser); }