Class DeviceModel
- Namespace
- Fdyay.IdentityServer.UI.Pages
- Assembly
- Fdyay.IdentityServer.UI.dll
Where a user approves a device that cannot show them a browser.
[Authorize]
public class DeviceModel : PageModel, IAsyncPageFilter, IPageFilter, IFilterMetadata
- Inheritance
-
DeviceModel
- Implements
- Inherited Members
Remarks
Requires a signed-in user, because approving is an act by a person: the code identifies which request is being approved, never who is approving it.
Constructors
DeviceModel(IDeviceFlowInteractionService, IOptions<IdentityServerOptions>, IEventService)
Creates the page model, as the container resolves it.
public DeviceModel(IDeviceFlowInteractionService interaction, IOptions<IdentityServerOptions> options, IEventService events)
Parameters
interactionIDeviceFlowInteractionServiceResolves the user code to its request, and records the answer.
optionsIOptions<IdentityServerOptions>The server options;
DeviceFlow.UserCodeParameternames the user code's query parameter.eventsIEventServiceReceives the ConsentGrantedEvent or ConsentDeniedEvent for a recorded answer.
Properties
CodeNotRecognised
Set when a submitted code does not identify a live request, so the page can say so and re-prompt.
public bool CodeNotRecognised { get; set; }
Property Value
Decided
Whether the user's answer was recorded on this post.
public bool Decided { get; set; }
Property Value
DeviceRequest
The device authorization the user code identifies; null when no code was given or it identifies no live request.
public DeviceFlowAuthorizationRequest? DeviceRequest { get; set; }
Property Value
Granted
Whether the recorded answer granted at least one scope.
public bool Granted { get; set; }
Property Value
Input
The posted form: the user code, which button was pressed, the ticked scopes and the grant's name.
[BindProperty]
public DeviceModel.InputModel Input { get; set; }
Property Value
Scopes
What the page offers, one row per scope this request validated.
public IReadOnlyList<ConsentScope> Scopes { get; }
Property Value
Methods
OnGetAsync()
Prompts for a user code, or — with one in the query string under DeviceFlow.UserCodeParameter, as
verification_uri_complete carries it — shows the request it identifies.
public Task<IActionResult> OnGetAsync()
Returns
- Task<IActionResult>
The page.
OnPostAsync()
Resolves the posted user code and, when a button was pressed, records the answer: Allow with at least one scope
ticked grants those scopes; Deny, or Allow with nothing ticked, denies it with access_denied.
public Task<IActionResult> OnPostAsync()
Returns
- Task<IActionResult>
The page, showing the request or the outcome.