Table of Contents

Class AuthenticationHeaderParser

Namespace
Microsoft.Identity.Client
Assembly
Microsoft.Identity.Client.dll

Parsed authentication headers to retrieve header values from HttpResponseHeaders.

public class AuthenticationHeaderParser
Inheritance
AuthenticationHeaderParser
Inherited Members

Constructors

AuthenticationHeaderParser()

public AuthenticationHeaderParser()

Properties

AuthenticationInfoParameters

Parameters returned by the Authentication-Info header. This allows for more complex authentication scenarios, such as Proof-Of-Possession.

public AuthenticationInfoParameters AuthenticationInfoParameters { get; }

Property Value

AuthenticationInfoParameters

PopNonce

Nonce parsed from HttpResponseHeaders. This is acquired from the Proof-of-Possession WWW-Authenticate header or the Authentication-Info header

public string PopNonce { get; }

Property Value

string

WwwAuthenticateParameters

Parameters returned by the WWW-Authenticate header. This allows for dynamic scenarios such as Claims challenge, Continuous Access Evaluation (CAE), and Conditional Access auth context. See our documentation for additional details.

public IReadOnlyList<WwwAuthenticateParameters> WwwAuthenticateParameters { get; }

Property Value

IReadOnlyList<WwwAuthenticateParameters>

Methods

ParseAuthenticationHeaders(HttpResponseHeaders)

Creates a parsed set of parameters from the provided HttpResponseHeaders.

public static AuthenticationHeaderParser ParseAuthenticationHeaders(HttpResponseHeaders httpResponseHeaders)

Parameters

httpResponseHeaders HttpResponseHeaders

HTTP response headers.

Returns

AuthenticationHeaderParser

An instance of AuthenticationHeaderParser.

Remarks

For known values, such as the nonce used for Proof-of-Possession, the parser will first check for it in the WWW-Authenticate headers If it cannot find it, it will then check the Authentication-Info parameters for the value.

ParseAuthenticationHeadersAsync(string, HttpClient, CancellationToken)

Creates the authentication parameters by attempting to call the resource unauthenticated and analyzing the response.

public static Task<AuthenticationHeaderParser> ParseAuthenticationHeadersAsync(string resourceUri, HttpClient httpClient, CancellationToken cancellationToken = default)

Parameters

resourceUri string

Resource URI.

httpClient HttpClient

Instance of HttpClient to make the request with.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<AuthenticationHeaderParser>

An instance of AuthenticationHeaderParser containing authentication header data.

Exceptions

ArgumentNullException

Thrown if the resourceUri or httpClient is null.

ParseAuthenticationHeadersAsync(string, CancellationToken)

Creates the authentication parameters by attempting to call the resource unauthenticated and analyzing the response.

public static Task<AuthenticationHeaderParser> ParseAuthenticationHeadersAsync(string resourceUri, CancellationToken cancellationToken = default)

Parameters

resourceUri string

Resource URI.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<AuthenticationHeaderParser>

An instance of AuthenticationHeaderParser containing authentication header data.