Skip to main content

DeviceCodeGrantHandler Class

Abblix.Oidc.Server

Abblix.Oidc.Server.Endpoints.Token.Grants

DeviceCodeGrantHandler Class

Handles the Device Code grant type as defined in RFC 8628. This handler validates token requests for the device authorization flow, checking the device code status and returning tokens when authorized.

public class DeviceCodeGrantHandler : Abblix.Oidc.Server.Endpoints.Token.Grants.IAuthorizationGrantHandler, Abblix.Oidc.Server.Common.Interfaces.IGrantTypeInformer

Inheritance System.Object → DeviceCodeGrantHandler

Implements IAuthorizationGrantHandler, IGrantTypeInformer

Constructors

DeviceCodeGrantHandler(IDeviceAuthorizationStorage, TimeProvider, IOptions<OidcOptions>) Constructor

Handles the Device Code grant type as defined in RFC 8628. This handler validates token requests for the device authorization flow, checking the device code status and returning tokens when authorized.

public DeviceCodeGrantHandler(Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IDeviceAuthorizationStorage storage, System.TimeProvider timeProvider, Microsoft.Extensions.Options.IOptions<Abblix.Oidc.Server.Common.Configuration.OidcOptions> options);

Parameters

storage IDeviceAuthorizationStorage

Service for storing and retrieving device authorization requests.

timeProvider System.TimeProvider

Provides access to the current time.

options Microsoft.Extensions.Options.IOptions<OidcOptions>

Configuration options containing polling interval settings.

Properties

DeviceCodeGrantHandler.GrantTypesSupported Property

The grant types supported by this component, as defined in OAuth 2.0 and OpenID Connect specifications.

public System.Collections.Generic.IEnumerable<string> GrantTypesSupported { get; }

Implements GrantTypesSupported

Property Value

System.Collections.Generic.IEnumerable<System.String>

Remarks

Common grant types include:

  • "authorization_code" - Authorization Code Grant
  • "implicit" - Implicit Grant
  • "refresh_token" - Refresh Token Grant
  • "client_credentials" - Client Credentials Grant
  • "password" - Resource Owner Password Credentials Grant

Methods

DeviceCodeGrantHandler.AuthorizeAsync(TokenRequest, ClientInfo) Method

Resolves the grant-specific input from request (authorization code, refresh token, device code, client credentials, JWT assertion, etc.) into the AuthorizedGrant that will drive token issuance, or an OidcError such as invalid_grant, authorization_pending, or slow_down.

public System.Threading.Tasks.Task<Abblix.Utils.Result<Abblix.Oidc.Server.Endpoints.Token.Interfaces.AuthorizedGrant,Abblix.Oidc.Server.Common.OidcError>> AuthorizeAsync(Abblix.Oidc.Server.Model.TokenRequest request, Abblix.Oidc.Server.Features.ClientInformation.ClientInfo clientInfo);

Parameters

request TokenRequest

The token request (already authenticated against the client).

clientInfo ClientInfo

The authenticated client; used to enforce that the grant was issued to the same client that is now redeeming it.

Implements AuthorizeAsync(TokenRequest, ClientInfo)

Returns

System.Threading.Tasks.Task<Abblix.Utils.Result<AuthorizedGrant,OidcError>>