Definition
Assembly: Microsoft.OData.Mcp.Authentication.dll Namespace: Microsoft.OData.Mcp.Authentication.ServicesSyntax
Summary
Provides services for delegating authentication tokens to downstream services.Remarks
This service handles the complexities of token delegation, including token forwarding, exchange, and on-behalf-of flows. It ensures that user identity is preserved while enabling secure communication with downstream OData services.Methods
ClearCachedTokensAsync Abstract
Clears all cached tokens for a specific user.Syntax
Parameters
Returns
Type:System.Threading.Tasks.Task
A task that represents the asynchronous operation.
Exceptions
ExchangeTokenAsync Abstract
Exchanges a token for a new token with different scopes or audience.Syntax
Parameters
Returns
Type:System.Threading.Tasks.Task<Microsoft.OData.Mcp.Authentication.Models.DelegatedToken>
A task that represents the asynchronous operation. The task result contains the exchanged token.
Exceptions
GetCachedTokenAsync Abstract
Gets the cached token for a specific service and user, if available.Syntax
Parameters
Returns
Type:System.Threading.Tasks.Task<Microsoft.OData.Mcp.Authentication.Models.DelegatedToken?>
A task that represents the asynchronous operation. The task result contains the cached token, or null if not found.
Exceptions
GetOnBehalfOfTokenAsync Abstract
Performs an OAuth2 on-behalf-of flow to get a token for a downstream service.Syntax
Parameters
Returns
Type:System.Threading.Tasks.Task<Microsoft.OData.Mcp.Authentication.Models.DelegatedToken>
A task that represents the asynchronous operation. The task result contains the on-behalf-of token.
Exceptions
GetTokenForServiceAsync Abstract
Gets an authentication token for making requests to a specific target service.Syntax
Parameters
Returns
Type:System.Threading.Tasks.Task<Microsoft.OData.Mcp.Authentication.Models.DelegatedToken>
A task that represents the asynchronous operation. The task result contains the delegated token.
Exceptions
GetTokenForUrlAsync Abstract
Gets an authentication token for making requests to a target URL.Syntax
Parameters
Returns
Type:System.Threading.Tasks.Task<Microsoft.OData.Mcp.Authentication.Models.DelegatedToken>
A task that represents the asynchronous operation. The task result contains the delegated token.
Exceptions
RefreshTokenAsync Abstract
Refreshes a delegated token if it supports refresh operations.Syntax
Parameters
Returns
Type:System.Threading.Tasks.Task<Microsoft.OData.Mcp.Authentication.Models.DelegatedToken>
A task that represents the asynchronous operation. The task result contains the refreshed token.
Exceptions
RevokeTokenAsync Abstract
Revokes a delegated token if the target service supports token revocation.Syntax
Parameters
Returns
Type:System.Threading.Tasks.Task
A task that represents the asynchronous operation.
Exceptions
ValidateTokenForDelegationAsync Abstract
Validates that a token is suitable for delegation to a specific service.Syntax
Parameters
Returns
Type:System.Threading.Tasks.Task<bool>
A task that represents the asynchronous operation. The task result indicates whether the token is valid for delegation.