ConfidentialClientApplicationBuilder.WithClientAssertion Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
WithClientAssertion(String) |
Obsolete.
Sets the application client assertion. See https://aka.ms/msal-net-client-assertion. This will create an assertion that will be held within the client application's memory for the duration of the client. You can use WithClientAssertion(Func<String>) to set a delegate that will be executed for each authentication request. This will allow you to update the client assertion used by the client application once the assertion expires. |
WithClientAssertion(Func<CancellationToken,Task<String>>) |
Configures an async delegate that creates a client assertion. See https://aka.ms/msal-net-client-assertion |
WithClientAssertion(Func<AssertionRequestOptions,Task<String>>) |
Configures an async delegate that creates a client assertion. The delegate is invoked only when a token cannot be retrieved from the cache. See https://aka.ms/msal-net-client-assertion |
WithClientAssertion(Func<AssertionRequestOptions,CancellationToken,Task<ClientSignedAssertion>>) |
Configures the client application to use a client assertion for authentication. |
WithClientAssertion(Func<String>) |
Configures a delegate that creates a client assertion. See https://aka.ms/msal-net-client-assertion |
WithClientAssertion(String)
Caution
This method is not recommended. Use overload with Func<AssertionRequestOptions, Task<string>> instead, and return a non-expired assertion, which can be a Federated Credential. See https://aka.ms/msal-net-client-assertion
Sets the application client assertion. See https://aka.ms/msal-net-client-assertion. This will create an assertion that will be held within the client application's memory for the duration of the client. You can use WithClientAssertion(Func<String>) to set a delegate that will be executed for each authentication request. This will allow you to update the client assertion used by the client application once the assertion expires.
[System.Obsolete("This method is not recommended. Use overload with Func<AssertionRequestOptions, Task<string>> instead, and return a non-expired assertion, which can be a Federated Credential. See https://aka.ms/msal-net-client-assertion", false)]
public Microsoft.Identity.Client.ConfidentialClientApplicationBuilder WithClientAssertion(string signedClientAssertion);
[<System.Obsolete("This method is not recommended. Use overload with Func<AssertionRequestOptions, Task<string>> instead, and return a non-expired assertion, which can be a Federated Credential. See https://aka.ms/msal-net-client-assertion", false)>]
member this.WithClientAssertion : string -> Microsoft.Identity.Client.ConfidentialClientApplicationBuilder
Public Function WithClientAssertion (signedClientAssertion As String) As ConfidentialClientApplicationBuilder
Parameters
- signedClientAssertion
- String
The client assertion used to prove the identity of the application to Azure AD. This is a Base-64 encoded JWT.
Returns
- Attributes
Applies to
WithClientAssertion(Func<CancellationToken,Task<String>>)
Configures an async delegate that creates a client assertion. See https://aka.ms/msal-net-client-assertion
public Microsoft.Identity.Client.ConfidentialClientApplicationBuilder WithClientAssertion(Func<System.Threading.CancellationToken,System.Threading.Tasks.Task<string>> clientAssertionAsyncDelegate);
member this.WithClientAssertion : Func<System.Threading.CancellationToken, System.Threading.Tasks.Task<string>> -> Microsoft.Identity.Client.ConfidentialClientApplicationBuilder
Public Function WithClientAssertion (clientAssertionAsyncDelegate As Func(Of CancellationToken, Task(Of String))) As ConfidentialClientApplicationBuilder
Parameters
- clientAssertionAsyncDelegate
- Func<CancellationToken,Task<String>>
An async delegate computing the client assertion used to prove the identity of the application to Azure AD. This is a delegate that computes a Base-64 encoded JWT for each authentication call.
Returns
The ConfidentialClientApplicationBuilder to chain more .With methods
Remarks
Callers can use this mechanism to cache their assertions
Applies to
WithClientAssertion(Func<AssertionRequestOptions,Task<String>>)
Configures an async delegate that creates a client assertion. The delegate is invoked only when a token cannot be retrieved from the cache. See https://aka.ms/msal-net-client-assertion
public Microsoft.Identity.Client.ConfidentialClientApplicationBuilder WithClientAssertion(Func<Microsoft.Identity.Client.AssertionRequestOptions,System.Threading.Tasks.Task<string>> clientAssertionAsyncDelegate);
member this.WithClientAssertion : Func<Microsoft.Identity.Client.AssertionRequestOptions, System.Threading.Tasks.Task<string>> -> Microsoft.Identity.Client.ConfidentialClientApplicationBuilder
Public Function WithClientAssertion (clientAssertionAsyncDelegate As Func(Of AssertionRequestOptions, Task(Of String))) As ConfidentialClientApplicationBuilder
Parameters
- clientAssertionAsyncDelegate
- Func<AssertionRequestOptions,Task<String>>
An async delegate that returns the client assertion. Assertion lifetime is the responsibility of the caller.
Returns
The ConfidentialClientApplicationBuilder to chain more .With methods
Remarks
Callers can use this mechanism to cache their assertions
Applies to
WithClientAssertion(Func<AssertionRequestOptions,CancellationToken,Task<ClientSignedAssertion>>)
Configures the client application to use a client assertion for authentication.
public Microsoft.Identity.Client.ConfidentialClientApplicationBuilder WithClientAssertion(Func<Microsoft.Identity.Client.AssertionRequestOptions,System.Threading.CancellationToken,System.Threading.Tasks.Task<Microsoft.Identity.Client.ClientSignedAssertion>> clientSignedAssertionProvider);
member this.WithClientAssertion : Func<Microsoft.Identity.Client.AssertionRequestOptions, System.Threading.CancellationToken, System.Threading.Tasks.Task<Microsoft.Identity.Client.ClientSignedAssertion>> -> Microsoft.Identity.Client.ConfidentialClientApplicationBuilder
Public Function WithClientAssertion (clientSignedAssertionProvider As Func(Of AssertionRequestOptions, CancellationToken, Task(Of ClientSignedAssertion))) As ConfidentialClientApplicationBuilder
Parameters
- clientSignedAssertionProvider
- Func<AssertionRequestOptions,CancellationToken,Task<ClientSignedAssertion>>
A delegate that asynchronously provides an ClientSignedAssertion based on the given AssertionRequestOptions and CancellationToken. This delegate must not be null
.
Returns
The ConfidentialClientApplicationBuilder instance configured with the specified client assertion.
Exceptions
Thrown if clientSignedAssertionProvider
is null
.
Remarks
This method allows the client application to authenticate using a custom client assertion, which can be useful in scenarios where the assertion needs to be dynamically generated or retrieved.
Applies to
WithClientAssertion(Func<String>)
Configures a delegate that creates a client assertion. See https://aka.ms/msal-net-client-assertion
public Microsoft.Identity.Client.ConfidentialClientApplicationBuilder WithClientAssertion(Func<string> clientAssertionDelegate);
member this.WithClientAssertion : Func<string> -> Microsoft.Identity.Client.ConfidentialClientApplicationBuilder
Public Function WithClientAssertion (clientAssertionDelegate As Func(Of String)) As ConfidentialClientApplicationBuilder
Parameters
delegate computing the client assertion used to prove the identity of the application to Azure AD. This is a delegate that computes a Base-64 encoded JWT for each authentication call.
Returns
The ConfidentialClientApplicationBuilder to chain more .With methods
Remarks
Callers can use this mechanism to cache their assertions