Skip to main content

TokenHandler Class

Abblix.Oidc.Server

Abblix.Oidc.Server.Endpoints.Token

TokenHandler Class

Manages the processing of token requests according to OAuth 2.0 and OpenID Connect specifications. This includes validating the request for compliance with the protocol requirements and processing it to issue, renew or exchange tokens as appropriate.

public class TokenHandler : Abblix.Oidc.Server.Endpoints.Token.Interfaces.ITokenHandler

Inheritance System.Object → TokenHandler

Implements ITokenHandler

Constructors

TokenHandler(ITokenRequestValidator, ITokenRequestProcessor) Constructor

Manages the processing of token requests according to OAuth 2.0 and OpenID Connect specifications. This includes validating the request for compliance with the protocol requirements and processing it to issue, renew or exchange tokens as appropriate.

public TokenHandler(Abblix.Oidc.Server.Endpoints.Token.Interfaces.ITokenRequestValidator validator, Abblix.Oidc.Server.Endpoints.Token.Interfaces.ITokenRequestProcessor processor);

Parameters

validator ITokenRequestValidator

An implementation of ITokenRequestValidator responsible for ensuring that token requests meet the required validation criteria.

processor ITokenRequestProcessor

An implementation of ITokenRequestProcessor responsible for executing the logic necessary to issue, renew, or exchange tokens based on validated requests.

Methods

TokenHandler.HandleAsync(TokenRequest, ClientRequest) Method

Asynchronously handles a token request by first validating it and then, if the validation is successful, processing the request to issue, renew, or exchange tokens as required by the request parameters.

public System.Threading.Tasks.Task<Abblix.Utils.Result<Abblix.Oidc.Server.Endpoints.Token.Interfaces.TokenIssued,Abblix.Oidc.Server.Common.OidcError>> HandleAsync(Abblix.Oidc.Server.Model.TokenRequest tokenRequest, Abblix.Oidc.Server.Model.ClientRequest clientRequest);

Parameters

tokenRequest TokenRequest

An object containing the details of the token request, including the grant type, client credentials and other necessary parameters.

clientRequest ClientRequest

Additional information about the client making the request, used for contextual validation.

Implements HandleAsync(TokenRequest, ClientRequest)

Returns

System.Threading.Tasks.Task<Abblix.Utils.Result<TokenIssued,OidcError>>
A System.Threading.Tasks.Task that resolves to a TokenIssued, indicating the outcome of the request handling. The success response includes the issued tokens, while an OidcError details the reason for failure if the request does not pass validation or cannot be processed.

Remarks

This method is integral to the security and functionality of the OAuth 2.0 and OpenID Connect framework, ensuring that only valid and authorized requests result in the issuance, renewal, or exchange of tokens. It employs rigorous validation to prevent unauthorized access and to maintain the integrity of the token lifecycle management process.