Table of Contents

Class DeviceCodeValidator

Namespace
Fdyay.IdentityServer.Validation
Assembly
Fdyay.IdentityServer.Core.dll

Duende's default device code validator.

public class DeviceCodeValidator : IDeviceCodeValidator
Inheritance
DeviceCodeValidator
Implements
Inherited Members

Constructors

DeviceCodeValidator(IDeviceFlowCodeService, IProfileService, IDeviceFlowThrottlingService, TimeProvider)

Creates the validator.

public DeviceCodeValidator(IDeviceFlowCodeService devices, IProfileService profile, IDeviceFlowThrottlingService throttling, TimeProvider time)

Parameters

devices IDeviceFlowCodeService

Where device codes are kept, and removed from once redeemed, refused or expired.

profile IProfileService

Says whether the user is still active.

throttling IDeviceFlowThrottlingService

Says whether a pending code is being polled too fast.

time TimeProvider

The clock a code's expiry is judged against.

Methods

ValidateAsync(DeviceCodeValidationContext, CancellationToken)

Validates the context's device code and sets its Result.

public virtual Task ValidateAsync(DeviceCodeValidationContext context, CancellationToken ct)

Parameters

context DeviceCodeValidationContext

The presented code and the token request; the answer is written to its Result.

ct CancellationToken

Cancels the store lookups and the profile service call.

Returns

Task

A task that completes once Result is set.

Remarks

Where ours differs: expiry is checked before throttling, and throttling only while the code is pending, so a fast poll after the user has answered collects the answer rather than slow_down.

Exceptions

ArgumentNullException

context is null.