UserCodeVerificationService Class
Abblix.Oidc.Server
Abblix.Oidc.Server.Features.DeviceAuthorization
UserCodeVerificationService Class
Implements the user code verification service for the Device Authorization Grant flow (RFC 8628). This service handles the verification, approval, and denial of device authorization requests with built-in brute force protection.
public class UserCodeVerificationService : Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeVerificationService
Inheritance System.Object → UserCodeVerificationService
Implements IUserCodeVerificationService
Constructors
UserCodeVerificationService(IDeviceAuthorizationStorage, IUserCodeRateLimiter, IUserCodeNormalizer, IHttpContextAccessor, TimeProvider) Constructor
Implements the user code verification service for the Device Authorization Grant flow (RFC 8628). This service handles the verification, approval, and denial of device authorization requests with built-in brute force protection.
public UserCodeVerificationService(Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IDeviceAuthorizationStorage storage, Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeRateLimiter rateLimiter, Abblix.Oidc.Server.Features.DeviceAuthorization.Interfaces.IUserCodeNormalizer normalizer, Microsoft.AspNetCore.Http.IHttpContextAccessor httpContextAccessor, System.TimeProvider timeProvider);
Parameters
storage IDeviceAuthorizationStorage
The storage service for device authorization requests.
rateLimiter IUserCodeRateLimiter
The rate limiter for preventing brute force attacks.
normalizer IUserCodeNormalizer
Canonicalizes user-entered codes before lookup (RFC 8628 Section 6.1).
httpContextAccessor Microsoft.AspNetCore.Http.IHttpContextAccessor
Accessor for the current HTTP context to retrieve client IP.
timeProvider System.TimeProvider
Provides the current time for deriving the request's remaining lifetime.
Methods
UserCodeVerificationService.ApproveAsync(string, AuthorizedGrant) Method
Approves the device authorization request, linking the user's authorization to the pending device.
public System.Threading.Tasks.Task<bool> ApproveAsync(string userCode, Abblix.Oidc.Server.Endpoints.Token.Interfaces.AuthorizedGrant authorizedGrant);
Parameters
userCode System.String
The user-entered verification code.
authorizedGrant AuthorizedGrant
The authorized grant containing the user's authentication session and context.
Implements ApproveAsync(string, AuthorizedGrant)
Returns
System.Threading.Tasks.Task<System.Boolean>
A task that returns true if the approval was successful; false if the code is invalid or expired.
UserCodeVerificationService.DenyAsync(string) Method
Denies the device authorization request.
public System.Threading.Tasks.Task<bool> DenyAsync(string userCode);
Parameters
userCode System.String
The user-entered verification code.
Implements DenyAsync(string)
Returns
System.Threading.Tasks.Task<System.Boolean>
A task that returns true if the denial was successful; false if the code is invalid or expired.
UserCodeVerificationService.VerifyAsync(string) Method
Verifies a user code and returns the associated device authorization request details.
public System.Threading.Tasks.Task<Abblix.Oidc.Server.Features.DeviceAuthorization.UserCodeVerificationResult> VerifyAsync(string userCode);
Parameters
userCode System.String
The user-entered verification code.
Implements VerifyAsync(string)
Returns
System.Threading.Tasks.Task<UserCodeVerificationResult>
A task that returns the verification result containing request details if valid,
or an appropriate error if the code is invalid, expired, or already used.