public AuthenticateClient( IClientSecretBasicAuthentication clientSecretBasicAuthentication, IClientSecretPostAuthentication clientSecretPostAuthentication, IClientAssertionAuthentication clientAssertionAuthentication, IClientTlsAuthentication clientTlsAuthentication, IClientRepository clientRepository, IOAuthEventSource oAuthEventSource) { _clientSecretBasicAuthentication = clientSecretBasicAuthentication; _clientSecretPostAuthentication = clientSecretPostAuthentication; _clientAssertionAuthentication = clientAssertionAuthentication; _clientTlsAuthentication = clientTlsAuthentication; _clientRepository = clientRepository; _oauthEventSource = oAuthEventSource; }
public AuthenticateClient( IClientSecretBasicAuthentication clientSecretBasicAuthentication, IClientSecretPostAuthentication clientSecretPostAuthentication, IClientAssertionAuthentication clientAssertionAuthentication, IClientTlsAuthentication clientTlsAuthentication, IClientRepository clientRepository, ISimpleIdentityServerEventSource simpleIdentityServerEventSource) { _clientSecretBasicAuthentication = clientSecretBasicAuthentication; _clientSecretPostAuthentication = clientSecretPostAuthentication; _clientAssertionAuthentication = clientAssertionAuthentication; _clientTlsAuthentication = clientTlsAuthentication; _clientRepository = clientRepository; _simpleIdentityServerEventSource = simpleIdentityServerEventSource; }
/* * [Fact] * public void When_ThumbPrint_Is_Not_Correct_Then_Null_Is_Returned() * { * // ARRANGE * InitializeFakeObjects(); * var certificate = new X509Certificate2("testCert.pfx", "testPassword"); * * Assert.Null(_clientTlsAuthentication.AuthenticateClient(new AuthenticateInstruction * { * Certificate = certificate * }, new Client * { * Secrets = new List<ClientSecret> * { * new ClientSecret * { * Type = ClientSecretTypes.X509Thumbprint, * Value = "not_correct" * } * } * })); * } * * [Fact] * public void When_Name_Is_Not_Correct_Then_Null_Is_Returned() * { * // ARRANGE * InitializeFakeObjects(); * var certificate = new X509Certificate2("testCert.pfx", "testPassword"); * * Assert.Null(_clientTlsAuthentication.AuthenticateClient(new AuthenticateInstruction * { * Certificate = certificate * }, new Client * { * Secrets = new List<ClientSecret> * { * new ClientSecret * { * Type = ClientSecretTypes.X509Name, * Value = "not_correct" * } * } * })); * } * * [Fact] * public void When_Client_Is_Authenticated_Then_Client_Is_Returned() * { * // ARRANGE * InitializeFakeObjects(); * var certificate = new X509Certificate2("testCert.pfx", "testPassword"); * * // ACT * var result = _clientTlsAuthentication.AuthenticateClient(new AuthenticateInstruction * { * Certificate = certificate * }, new Client * { * Secrets = new List<ClientSecret> * { * new ClientSecret * { * Type = ClientSecretTypes.X509Name, * Value = certificate.SubjectName.Name * }, * new ClientSecret * { * Type = ClientSecretTypes.X509Thumbprint, * Value = certificate.Thumbprint * } * } * }); * * // ASSERTS * Assert.NotNull(result); * } */ private void InitializeFakeObjects() { _clientTlsAuthentication = new ClientTlsAuthentication(); }