Class BaseAbstractAcquireTokenParameterBuilder<T>
Base class for builders of token requests, which attempt to acquire a token based on the provided parameters.
public abstract class BaseAbstractAcquireTokenParameterBuilder<T> where T : BaseAbstractAcquireTokenParameterBuilder<T>
Type Parameters
T
- Inheritance
-
BaseAbstractAcquireTokenParameterBuilder<T>
- Derived
- Inherited Members
Constructors
BaseAbstractAcquireTokenParameterBuilder()
Default constructor for AbstractAcquireTokenParameterBuilder.
protected BaseAbstractAcquireTokenParameterBuilder()
Methods
ExecuteAsync()
Executes the Token request asynchronously.
public Task<AuthenticationResult> ExecuteAsync()
Returns
- Task<AuthenticationResult>
Authentication result containing a token for the requested scopes and parameters set in the builder.
ExecuteAsync(CancellationToken)
Executes the Token request asynchronously, with a possibility of cancelling the asynchronous method.
public abstract Task<AuthenticationResult> ExecuteAsync(CancellationToken cancellationToken)
Parameters
cancellationToken
CancellationTokenCancellation token. See CancellationToken
Returns
- Task<AuthenticationResult>
Authentication result containing a token for the requested scopes and parameters set in the builder.
Remarks
Cancellation is not guaranteed, it is best effort. If the operation reaches a point of no return, e.g. tokens are acquired and written to the cache, the task will complete even if cancellation was requested. Do not rely on cancellation tokens for strong consistency.
To learn more about potential exceptions thrown by the function, refer to Exceptions in MSAL.NET.
Validate()
Validates the parameters of the AcquireToken operation.
protected virtual void Validate()
WithCorrelationId(Guid)
Sets the correlation id to be used in the authentication request. Used to track a request in the logs of both the SDK and the Identity Provider service. If not set, a random one will be generated.
public T WithCorrelationId(Guid correlationId)
Parameters
correlationId
GuidCorrelation id of the authentication request.
Returns
- T
The builder to chain the .With methods.
WithExtraQueryParameters(Dictionary<string, string>)
Sets Extra Query Parameters for the query string in the HTTP authentication request.
public T WithExtraQueryParameters(Dictionary<string, string> extraQueryParameters)
Parameters
extraQueryParameters
Dictionary<string, string>This parameter will be appended as is to the query string in the HTTP authentication request to the authority as a string of segments of the form
key=value
separated by an ampersand character. The parameter can be null.
Returns
- T
The builder to chain the .With methods.