Definition
Assembly: Microsoft.OData.Mcp.Authentication.dll Namespace: Microsoft.OData.Mcp.Authentication.Models Inheritance: System.ObjectSyntax
Summary
Configuration options for MCP server authentication.Remarks
These options control how the MCP server validates and delegates authentication tokens. The server acts as an OAuth2 resource server, validating tokens issued by external authorization servers and optionally forwarding them to downstream OData services.Constructors
.ctor
Initializes a new instance of the McpAuthenticationOptions class.Syntax
.ctor Inherited
Inherited from
objectSyntax
Properties
Enabled
Gets or sets a value indicating whether authentication is enabled.Syntax
Property Value
Type:bool
true if authentication is enabled; otherwise, false.
Remarks
When disabled, the MCP server will allow all requests without authentication. This is useful for development scenarios or internal deployments where authentication is handled at a different layer.JwtBearer
Gets or sets the JWT bearer token options.Syntax
Property Value
Type:Microsoft.OData.Mcp.Authentication.Models.JwtBearerOptions
Configuration for JWT token validation.
Remarks
These options control how JWT tokens are validated, including issuer validation, audience validation, and token lifetime checks.MetadataCacheDuration
Gets or sets the cache duration for authentication metadata.Syntax
Property Value
Type:System.TimeSpan
The duration to cache authentication metadata like JWKS keys.
Remarks
Caching authentication metadata improves performance by avoiding repeated requests to authorization servers. The cache is automatically refreshed when metadata expires.RequireHttps
Gets or sets a value indicating whether to require HTTPS for authentication.Syntax
Property Value
Type:bool
true if HTTPS is required for authentication; otherwise, false.
Remarks
When true, the server will reject authentication attempts over insecure connections. This should be enabled in production environments to protect authentication tokens.Scheme
Gets or sets the authentication scheme to use.Syntax
Property Value
Type:string
The authentication scheme name (e.g., “Bearer”, “JWT”).
Remarks
This determines which authentication handler will be used to validate incoming requests. The default is “Bearer” for JWT bearer token authentication.ScopeAuthorization
Gets or sets the scope-based authorization options.Syntax
Property Value
Type:Microsoft.OData.Mcp.Authentication.Models.ScopeAuthorizationOptions
Configuration for OAuth2 scope-based access control.
Remarks
These options define which OAuth2 scopes are required for different MCP operations and how scope-based authorization is enforced.Timeout
Gets or sets the timeout for authentication operations.Syntax
Property Value
Type:System.TimeSpan
The timeout duration for authentication operations.
Remarks
This timeout applies to operations like token validation, metadata discovery, and communication with authorization servers.TokenDelegation
Gets or sets the token delegation options.Syntax
Property Value
Type:Microsoft.OData.Mcp.Authentication.Models.TokenDelegationOptions
Configuration for token delegation to downstream services.
Remarks
These options control how tokens are forwarded to OData services and other downstream dependencies that require authentication.Methods
Equals Inherited Virtual
Inherited from
objectSyntax
Parameters
| Name | Type | Description |
|---|---|---|
obj | object? | - |
Returns
Type:bool
Equals Inherited
Inherited from
objectSyntax
Parameters
| Name | Type | Description |
|---|---|---|
objA | object? | - |
objB | object? | - |
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
| Name | Type | Description |
|---|---|---|
objA | object? | - |
objB | object? | - |
Returns
Type:bool
ToString Override
Returns a string representation of the authentication options.Syntax
Returns
Type:string
A summary of the authentication configuration.
ToString Inherited Virtual
Inherited from
objectSyntax
Returns
Type:string?
Validate
Validates the authentication options for consistency and completeness.Syntax
Returns
Type:System.Collections.Generic.IEnumerable<string>
A collection of validation errors, or an empty collection if the options are valid.