Share via


IMsalMtlsHttpClientFactory Interface

Definition

A factory responsible for creating HttpClient instances configured for mutual TLS (mTLS). This factory is intended for use to secure communication with Azure AD using mTLS. For more details on HttpClient instancing, see https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-8.0#instancing.

public interface IMsalMtlsHttpClientFactory : Microsoft.Identity.Client.IMsalHttpClientFactory
type IMsalMtlsHttpClientFactory = interface
    interface IMsalHttpClientFactory
Public Interface IMsalMtlsHttpClientFactory
Implements IMsalHttpClientFactory
Implements

Remarks

Implementations of this interface must be thread-safe. It is important to reuse HttpClient instances to avoid socket exhaustion. Do not create a new HttpClient for each call to GetHttpClient(X509Certificate2). If your application requires Integrated Windows Authentication, set UseDefaultCredentials to true. This interface is designed to support mTLS scenarios.

Methods

Name Description
GetHttpClient()

Method returning an HTTP client that will be used to communicate with Azure AD. This enables advanced scenarios. See https://aka.ms/msal-net-application-configuration.

(Inherited from IMsalHttpClientFactory)
GetHttpClient(X509Certificate2)

Returns an HttpClient configured with a certificate for mutual TLS authentication. This method enables advanced MTLS scenarios within Azure AD communications in MSAL.

Applies to