Skip to content

Commit

Permalink
#6673 - Fix of SNI auth not working in Cert based authentication
Browse files Browse the repository at this point in the history
After upgrade from ADAL to MSAL auth library, sendX5C flag was not set and it breaks SN+I authentication with AAD app registrations.
  • Loading branch information
mihanzlk committed Jul 28, 2023
1 parent b9603fb commit 8909744
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ protected override Lazy<IAuthenticator> BuildIAuthenticator()
return new Lazy<IAuthenticator>(
() =>
{
var clientApplication = CreateClientApplication(clientCertificate, MicrosoftAppId, CustomHttpClient);
var clientApplication = CreateClientApplication(clientCertificate, MicrosoftAppId, sendX5c, CustomHttpClient);
return new MsalAppCredentials(
clientApplication,
MicrosoftAppId,
Expand All @@ -151,11 +151,11 @@ protected override Lazy<IAuthenticator> BuildIAuthenticator()
LazyThreadSafetyMode.ExecutionAndPublication);
}

private Identity.Client.IConfidentialClientApplication CreateClientApplication(X509Certificate2 clientCertificate, string appId, HttpClient customHttpClient = null)
private Identity.Client.IConfidentialClientApplication CreateClientApplication(X509Certificate2 clientCertificate, string appId, bool sendX5c, HttpClient customHttpClient = null)
{
var clientBuilder = Identity.Client.ConfidentialClientApplicationBuilder.Create(appId)
.WithAuthority(new Uri(OAuthEndpoint), ValidateAuthority)
.WithCertificate(clientCertificate);
.WithCertificate(clientCertificate, sendX5c);

if (customHttpClient != null)
{
Expand Down

0 comments on commit 8909744

Please sign in to comment.