Skip to main content

Definition

Assembly: Microsoft.OData.Mcp.AspNetCore.dll Namespace: Microsoft.OData.Mcp.AspNetCore.Authentication Inheritance: System.Object

Syntax

Summary

Publishes RFC 9728 protected resource metadata for the configured route bases, and rewrites the WWW-Authenticate challenge on a 401 beneath one of those bases so a client is told where that document lives.

Remarks

ProtectedResourceMetadataStartupFilter puts this at the very front of the pipeline, before authentication and authorization, because a protected resource metadata document that answers 401 is useless — a client that follows resource_metadata into a challenge has learned nothing. That is the “Graph trap” in specs/v3/AUTHENTICATION.md, and the only defence against it is serving the document anonymously. The default route base is the application root. Explicit ProtectedResourceMetadataOptions.Prefixes entries are Endpoint Routing route bases, including an empty string.

Examples

Constructors

.ctor

Initializes a new instance of the ProtectedResourceMetadataMiddleware class.

Syntax

Parameters

Exceptions

.ctor Inherited

Inherited from object

Syntax

Methods

Equals Inherited Virtual

Inherited from object

Syntax

Parameters

Returns

Type: bool

Equals Inherited

Inherited from object

Syntax

Parameters

Returns

Type: bool

GetHashCode Inherited Virtual

Inherited from object

Syntax

Returns

Type: int

GetType Inherited

Inherited from object

Syntax

Returns

Type: System.Type

InvokeAsync

Serves a protected resource metadata document, or arms the challenge annotation for a request that falls beneath a covered route base, then continues the pipeline.

Syntax

Parameters

Returns

Type: System.Threading.Tasks.Task A task that completes when the request has been handled.

Exceptions

Remarks

A well-known path that names a prefix this app does not serve is passed through untouched rather than answered with a 404: the path may belong to another component in the same host.

MemberwiseClone Inherited

Inherited from object

Syntax

Returns

Type: object

ReferenceEquals Inherited

Inherited from object

Syntax

Parameters

Returns

Type: bool

ToString Inherited Virtual

Inherited from object

Syntax

Returns

Type: string?