Definition
Assembly: Microsoft.OData.Mcp.Authentication.dll Namespace: Microsoft.OData.Mcp.Authentication.Models Inheritance: System.ObjectSyntax
Summary
Represents client credentials for OAuth2 authentication.Remarks
These credentials identify the MCP server to authorization servers when performing OAuth2 flows that require client authentication, such as token exchange or on-behalf-of flows.Constructors
.ctor
Initializes a new instance of the ClientCredentials class.Syntax
.ctor
Initializes a new instance of the ClientCredentials class with client secret authentication.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
clientId | string | The client identifier. |
clientSecret | string | The client secret. |
Exceptions
| Exception | Description |
|---|---|
ArgumentException | Thrown when clientId or clientSecret is null or whitespace. |
.ctor
Initializes a new instance of the ClientCredentials class with certificate authentication.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
clientId | string | The client identifier. |
certificate | Microsoft.OData.Mcp.Authentication.Models.ClientCertificate | The client certificate configuration. |
Exceptions
| Exception | Description |
|---|---|
ArgumentException | Thrown when clientId is null or whitespace. |
ArgumentNullException | Thrown when certificate is null. |
.ctor Inherited
Inherited from
objectSyntax
Properties
AuthenticationMethod
Gets or sets the client authentication method.Syntax
Property Value
Type:Microsoft.OData.Mcp.Authentication.Models.ClientAuthenticationMethod?
The method used to authenticate the client to the authorization server.
Remarks
Different authorization servers support different client authentication methods. The most common are client secrets and certificate-based authentication.Certificate
Gets or sets the certificate for certificate-based authentication.Syntax
Property Value
Type:Microsoft.OData.Mcp.Authentication.Models.ClientCertificate?
Configuration for client certificate authentication.
Remarks
This certificate is used when the authentication method requires certificate-based authentication. It provides a more secure alternative to client secrets.ClientAssertion
Gets or sets the assertion for JWT-based client authentication.Syntax
Property Value
Type:string?
The JWT assertion used for client authentication.
Remarks
This is used when the authentication method is PrivateKeyJwt or ClientSecretJwt. The assertion must be properly signed and contain the required claims.ClientAssertionType
Gets or sets the assertion type for JWT-based client authentication.Syntax
Property Value
Type:string?
The type of the client assertion.
Remarks
This is typically “urn:ietf:params:oauth:client-assertion-type:jwt-bearer” for JWT-based client authentication methods.ClientId
Gets or sets the client identifier.Syntax
Property Value
Type:string
The client ID registered with the authorization server.
Remarks
The client ID uniquely identifies the MCP server application to the authorization server. It is typically a GUID or other unique string assigned during application registration.ClientSecret
Gets or sets the client secret for secret-based authentication.Syntax
Property Value
Type:string?
The client secret registered with the authorization server.
Remarks
This secret is used when the authentication method is ClientSecret or ClientSecretPost. It should be kept secure and rotated regularly for security best practices.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 client credentials.Syntax
Returns
Type:string
A summary of the client credentials configuration.
ToString Inherited Virtual
Inherited from
objectSyntax
Returns
Type:string?
Validate
Validates the client credentials for consistency and completeness.Syntax
Returns
Type:System.Collections.Generic.IEnumerable<string>
A collection of validation errors, or an empty collection if the credentials are valid.