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
devicesIDeviceFlowCodeServiceWhere device codes are kept, and removed from once redeemed, refused or expired.
profileIProfileServiceSays whether the user is still active.
throttlingIDeviceFlowThrottlingServiceSays whether a pending code is being polled too fast.
timeTimeProviderThe 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
contextDeviceCodeValidationContextThe presented code and the token request; the answer is written to its
Result.ctCancellationTokenCancels the store lookups and the profile service call.
Returns
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
contextisnull.