public void AuthenticatoionFilter_should_save_principal_with_pullmonitor_credentials() { var authContext = GetAuthContext(_pullMonitorCredentials); var filter = new AuthenticationFilter(_endpointRegistryMock.Object, _credentialsProviderMock.Object); filter.AuthenticateAsync(authContext, CancellationToken.None); Assert.Equal(authContext.Principal.Identity.Name, _pullMonitorCredentials.Id.ToString()); }
public void AuthenticatoionFilter_should_save_principal_into_request_context() { var authContext = GetAuthContext(_requestCredentials); _endpointRegistryMock.Setup(m => m.GetById(_requestCredentials.Id)).Returns(_endpoint); var filter = new AuthenticationFilter(_endpointRegistryMock.Object, _credentialsProviderMock.Object); filter.AuthenticateAsync(authContext, CancellationToken.None); Assert.Equal(authContext.Principal.Identity.Name, _endpoint.Identity.Id.ToString()); }
public void AuthenticatoionFilter_should_not_authenticate_endpoint_with_invalid_credentials() { var invalidCredentials = new Credentials(Guid.NewGuid(), "invalid"); var authContext = GetAuthContext(invalidCredentials); var filter = new AuthenticationFilter(_endpointRegistryMock.Object, _credentialsProviderMock.Object); filter.AuthenticateAsync(authContext, CancellationToken.None); Assert.Null(authContext.Principal); }