Definition
Assembly: Microsoft.OData.Mcp.Authentication.dll Namespace: Microsoft.OData.Mcp.Authentication.Outbound Inheritance: System.ObjectSyntax
Summary
Discovers an RFC 8414 authorization server metadata document (or its OpenID Connect discovery document counterpart) over the handler-free"OAuth" named HttpClient, probing the well-known
candidates for a base URI in the order that prefers a Microsoft identity platform v2 document over its
v1 counterpart.
Remarks
A new"OAuth" client is requested from IHttpClientFactory on every call rather than
cached, matching the “Two named HttpClients” table in specs/v3/AUTHENTICATION.md. Per AUTH-14,
an Entra-style authorization server publishes both a v1 (OpenID Connect only) and a v2 (RFC 8414 and OpenID
Connect) document at the same base URI; Uri) orders the v2 candidates
first so discovery never selects the v1 issuer when a v2 one is available. Response bodies are never
logged.
Examples
Constructors
.ctor
Initializes a new instance of the AuthorizationServerMetadataClient class.Syntax
Parameters
Exceptions
.ctor Inherited
Inherited from
objectSyntax
Methods
CandidateDocuments
Builds the well-known authorization server metadata candidates for a base URI, in probe order.Syntax
Parameters
Returns
Type:System.Collections.Generic.IReadOnlyList<System.Uri>
Five candidates when baseUri carries a path beyond /: the versioned (v2)
RFC 8414 document, the versioned OpenID Connect document, the unversioned RFC 8414 document, the RFC
8414 §3.1 path-prefixed document, and the unversioned OpenID Connect document, in that order. The
path-prefixed candidate is omitted, leaving four candidates, when baseUri has no
path beyond /.
Exceptions
Remarks
A trailing/ on baseUri is trimmed before any suffix is appended, so no
candidate carries a doubled path separator. The versioned candidates are listed first so that an
Entra-style authorization server, which publishes a v1 (OpenID Connect only) document at the
unversioned base and a v2 (RFC 8414 and OpenID Connect) document under /v2.0, is discovered
through its v2 issuer.
DiscoverAsync
Probes Uri) in order and returns the first candidate that resolves to a usable metadata document.Syntax
Parameters
Returns
Type:System.Threading.Tasks.Task<Microsoft.OData.Mcp.Authentication.Outbound.AuthorizationServerMetadata?>
The first candidate’s parsed document, or null when every candidate is non-fatally
unusable (missing, unparseable, or lacking a token_endpoint).
Exceptions
Examples
Remarks
Every probe is attempted overhttp only when its host is loopback; discovery stops at the first
candidate with a token_endpoint, so a later candidate (such as the legacy v1 document) is never
requested once an earlier one has already succeeded.
Equals Inherited Virtual
Inherited from
objectSyntax
Parameters
Returns
Type:bool
Equals Inherited
Inherited from
objectSyntax
Parameters
Returns
Type:bool
GetHashCode Inherited Virtual
Inherited from
objectSyntax
Returns
Type:int
GetType Inherited
Inherited from
objectSyntax
Returns
Type:System.Type
MemberwiseClone Inherited
Inherited from
objectSyntax
Returns
Type:object
ReferenceEquals Inherited
Inherited from
objectSyntax
Parameters
Returns
Type:bool
ToString Inherited Virtual
Inherited from
objectSyntax
Returns
Type:string?
TryGetAsync
Attempts to fetch and parse the authorization server metadata document at a well-known URL.Syntax
Parameters
Returns
Type:System.Threading.Tasks.Task<Microsoft.OData.Mcp.Authentication.Outbound.AuthorizationServerMetadata?>
The parsed document on a 200 response with a well-formed body carrying an absolute
token_endpoint; otherwise null after a 401, 403, 404, unparseable body, a
document without a usable token_endpoint, or any other non-retryable non-success status.