From bbfe78615a7abfe7b00de790a6754654e7647867 Mon Sep 17 00:00:00 2001 From: CeciliaAvila Date: Thu, 12 Oct 2023 10:27:43 -0300 Subject: [PATCH] Revert changes in CertificateServiceClientCredentialsFactory --- ...tificateServiceClientCredentialsFactory.cs | 19 +------------------ ...ateServiceClientCredentialsFactoryTests.cs | 4 ++-- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/libraries/Microsoft.Bot.Connector/Authentication/CertificateServiceClientCredentialsFactory.cs b/libraries/Microsoft.Bot.Connector/Authentication/CertificateServiceClientCredentialsFactory.cs index 0506aefd4d..0b52de3b27 100644 --- a/libraries/Microsoft.Bot.Connector/Authentication/CertificateServiceClientCredentialsFactory.cs +++ b/libraries/Microsoft.Bot.Connector/Authentication/CertificateServiceClientCredentialsFactory.cs @@ -17,7 +17,6 @@ namespace Microsoft.Bot.Connector.Authentication public class CertificateServiceClientCredentialsFactory : ServiceClientCredentialsFactory { private readonly X509Certificate2 _certificate; - private readonly bool _sendX5c = false; private readonly string _appId; private readonly string _tenantId; private readonly HttpClient _httpClient; @@ -46,22 +45,6 @@ public CertificateServiceClientCredentialsFactory(X509Certificate2 certificate, _logger = logger; } - /// - /// Initializes a new instance of the class. - /// - /// The certificate to use for authentication. - /// If true will send the public certificate to Azure AD along with the token request, so that - /// Azure AD can use it to validate the subject name based on a trusted issuer policy. - /// Microsoft application Id related to the certificate. - /// The oauth token tenant. - /// A custom httpClient to use. - /// A logger instance to use. - public CertificateServiceClientCredentialsFactory(X509Certificate2 certificate, bool sendX5c, string appId, string tenantId = null, HttpClient httpClient = null, ILogger logger = null) - : this(certificate, appId, tenantId, httpClient, logger) - { - _sendX5c = sendX5c; - } - /// public override Task IsValidAppIdAsync(string appId, CancellationToken cancellationToken) { @@ -85,7 +68,7 @@ public override Task CreateCredentialsAsync( } return Task.FromResult( - new CertificateAppCredentials(_certificate, _sendX5c, _appId, _tenantId, _httpClient, _logger)); + new CertificateAppCredentials(_certificate, _appId, _tenantId, _httpClient, _logger)); } } } diff --git a/tests/Microsoft.Bot.Connector.Tests/Authentication/CertificateServiceClientCredentialsFactoryTests.cs b/tests/Microsoft.Bot.Connector.Tests/Authentication/CertificateServiceClientCredentialsFactoryTests.cs index 25ea221f0d..e1bf5ed6bc 100644 --- a/tests/Microsoft.Bot.Connector.Tests/Authentication/CertificateServiceClientCredentialsFactoryTests.cs +++ b/tests/Microsoft.Bot.Connector.Tests/Authentication/CertificateServiceClientCredentialsFactoryTests.cs @@ -64,7 +64,7 @@ public void IsAuthenticationDisabledTest() [Fact] public async void CanCreateCredentials() { - var factory = new CertificateServiceClientCredentialsFactory(certificate.Object, false, TestAppId); + var factory = new CertificateServiceClientCredentialsFactory(certificate.Object, TestAppId); var credentials = await factory.CreateCredentialsAsync( TestAppId, TestAudience, "https://login.microsoftonline.com", true, CancellationToken.None); @@ -76,7 +76,7 @@ public async void CanCreateCredentials() [Fact] public void CannotCreateCredentialsWithInvalidAppId() { - var factory = new CertificateServiceClientCredentialsFactory(certificate.Object, false, TestAppId); + var factory = new CertificateServiceClientCredentialsFactory(certificate.Object, TestAppId); Assert.ThrowsAsync(() => factory.CreateCredentialsAsync( "InvalidAppId", TestAudience, "https://login.microsoftonline.com", true, CancellationToken.None));