Table of Contents

Class DeviceAuthorizationResponseGenerator

Namespace
Fdyay.IdentityServer.ResponseHandling
Assembly
Fdyay.IdentityServer.Core.dll

Duende's default device authorization response generator.

public class DeviceAuthorizationResponseGenerator : IDeviceAuthorizationResponseGenerator
Inheritance
DeviceAuthorizationResponseGenerator
Implements
Inherited Members

Constructors

DeviceAuthorizationResponseGenerator(IOptions<IdentityServerOptions>, IUserCodeService, IDeviceFlowCodeService, TimeProvider)

Creates the generator.

public DeviceAuthorizationResponseGenerator(IOptions<IdentityServerOptions> options, IUserCodeService userCodeService, IDeviceFlowCodeService deviceFlowCodeService, TimeProvider timeProvider)

Parameters

options IOptions<IdentityServerOptions>

The server's options, for the device flow's lifetime, interval and verification URL.

userCodeService IUserCodeService

Finds the generator for a user code type.

deviceFlowCodeService IDeviceFlowCodeService

Stores the device authorization and looks user codes up.

timeProvider TimeProvider

The clock the device code's creation time is read from.

Exceptions

ArgumentNullException

options is null.

Properties

DeviceFlowCodeService

Makes and keeps device codes, and never hands the store one as issued. Duende's.

protected IDeviceFlowCodeService DeviceFlowCodeService { get; }

Property Value

IDeviceFlowCodeService

Options

The server's options; DeviceFlow holds the defaults a client's registration can override.

protected IdentityServerOptions Options { get; }

Property Value

IdentityServerOptions

TimeProvider

The clock a device code's creation time is read from.

protected TimeProvider TimeProvider { get; }

Property Value

TimeProvider

UserCodeService

Finds the user code generator for the client's user code type, or the server's default type.

protected IUserCodeService UserCodeService { get; }

Property Value

IUserCodeService

Methods

ProcessAsync(DeviceAuthorizationRequestValidationResult, string, CancellationToken)

Generates and stores the codes for a validated request and builds the response for the device.

public virtual Task<DeviceAuthorizationResponse> ProcessAsync(DeviceAuthorizationRequestValidationResult validationResult, string baseUrl, CancellationToken ct)

Parameters

validationResult DeviceAuthorizationRequestValidationResult

The successfully validated device authorization request.

baseUrl string

The server's base URL, which a local verification URL is resolved against.

ct CancellationToken

Cancels the code generation and storage.

Returns

Task<DeviceAuthorizationResponse>

The device code, user code, verification URIs, lifetime and polling interval.

Exceptions

ArgumentNullException

validationResult is null.

ArgumentException

baseUrl is null, empty or whitespace, or the validated request names no client.

InvalidOperationException

No user code generator is registered for the type, or none of its tries produced a user code not already in use.