Table of Contents

Class DefaultDeviceFlowCodeService

Namespace
Fdyay.IdentityServer.Services
Assembly
Fdyay.IdentityServer.Core.dll

Supports all classes in the .NET class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all .NET classes; it is the root of the type hierarchy.

public sealed class DefaultDeviceFlowCodeService : IDeviceFlowCodeService
Inheritance
DefaultDeviceFlowCodeService
Implements
Inherited Members

Remarks

Both codes are hashed with HashHandle(string), as authorization codes, refresh tokens and reference tokens already are here, so a copy of the device flow store is no list of codes to poll with or to type in. Duende hashes with SHA-256 too, in standard Base64; this server's hashes are its own handles' format, base64url. The device code is this server's 32-byte handle, as before; Duende's is 32 bytes in hex.

An upgrade drops the device authorizations in flight. They were stored under the codes as issued, and are now looked up by their hashes: a device that was polling when the host upgraded is told its code is invalid and starts again. They last minutes, so nothing is migrated.

Constructors

DefaultDeviceFlowCodeService(IDeviceFlowStore, IHandleGenerationService)

A code service over store.

public DefaultDeviceFlowCodeService(IDeviceFlowStore store, IHandleGenerationService handles)

Parameters

store IDeviceFlowStore

The store the hashed codes are kept in.

handles IHandleGenerationService

What mints the device code.

Methods

FindByDeviceCodeAsync(string, CancellationToken)

The authorization for a device code, or null.

public Task<DeviceCode?> FindByDeviceCodeAsync(string deviceCode, CancellationToken cancellationToken = default)

Parameters

deviceCode string
cancellationToken CancellationToken

Returns

Task<DeviceCode>

FindByUserCodeAsync(string, CancellationToken)

The authorization for a user code, or null.

public Task<DeviceCode?> FindByUserCodeAsync(string userCode, CancellationToken cancellationToken = default)

Parameters

userCode string
cancellationToken CancellationToken

Returns

Task<DeviceCode>

RemoveByDeviceCodeAsync(string, CancellationToken)

Removes the authorization for a device code.

public Task RemoveByDeviceCodeAsync(string deviceCode, CancellationToken cancellationToken = default)

Parameters

deviceCode string
cancellationToken CancellationToken

Returns

Task

StoreDeviceAuthorizationAsync(string, DeviceCode, CancellationToken)

Makes a device code, stores the authorization under it and the user code, and returns the device code.

public Task<string> StoreDeviceAuthorizationAsync(string userCode, DeviceCode data, CancellationToken cancellationToken = default)

Parameters

userCode string
data DeviceCode
cancellationToken CancellationToken

Returns

Task<string>

UpdateByUserCodeAsync(string, DeviceCode, CancellationToken)

Replaces the authorization for a user code — an approval or a denial.

public Task UpdateByUserCodeAsync(string userCode, DeviceCode data, CancellationToken cancellationToken = default)

Parameters

userCode string
data DeviceCode
cancellationToken CancellationToken

Returns

Task