Skip to main content

Definition

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

Syntax

Summary

Runs the RFC 6749 authorization code grant with RFC 7636 PKCE over an RFC 8252 loopback redirect: build the authorization URL with an S256 challenge and a bound state, then exchange the returned code — after the RFC 9207 iss check — for a token.

Remarks

Per specs/v3/AUTHENTICATION.md “Grants → Authorization code + PKCE + loopback”: S256 is required and a server that publishes code_challenge_methods_supported without it is refused rather than downgraded to plain; the SDK’s obsolete AuthorizationRedirectDelegate is never used; and an iss that disagrees with the selected issuer stops the grant <em>before</em> the code reaches any token endpoint, which is the RFC 9207 mix-up defense. Per AUTH-12 the code verifier, the code, and the state never reach a log: the Debug lines carry only the endpoints.

Examples

Constructors

.ctor

Initializes a new instance of the AuthorizationCodePkceGrant class.

Syntax

Parameters

Exceptions

.ctor Inherited

Inherited from object

Syntax

Methods

Begin

Builds the authorization URL the operator signs in at, together with the state and code verifier the response is validated and exchanged against.

Syntax

Parameters

Returns

Type: (System.Uri, string, string) The absolute authorization URI, the freshly generated state, and the code verifier.

Exceptions

Examples

Remarks

The returned code verifier is a secret: it is the only thing that proves the process redeeming the code is the one that requested it, so it must never be logged, elicited, or placed on OutboundConsentRequest. Existing query parameters on the authorization endpoint — a tenant hint, for instance — are preserved rather than replaced.

Equals Inherited Virtual

Inherited from object

Syntax

Parameters

Returns

Type: bool

Equals Inherited

Inherited from object

Syntax

Parameters

Returns

Type: bool

ExchangeAsync

Exchanges an authorization code for a token, after proving the response came from the authorization server this grant was started against.

Syntax

Parameters

Returns

Type: System.Threading.Tasks.Task<Microsoft.OData.Mcp.Authentication.Outbound.TokenEndpointResponse> The successful token response.

Exceptions

Remarks

The iss check runs before anything is sent, so a code minted by another authorization server is never presented to this one — the whole point of RFC 9207. An absent iss is not invented: the grant still relies on the state binding the loopback callback enforced.

GetHashCode Inherited Virtual

Inherited from object

Syntax

Returns

Type: int

GetType Inherited

Inherited from object

Syntax

Returns

Type: System.Type

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?