Table of Contents

Class ConsentMessage

Namespace
Fdyay.IdentityServer.Services
Assembly
Fdyay.IdentityServer.AspNetCore.dll

An authorization decision, carried from the consent UI back to the authorize endpoint.

public sealed class ConsentMessage
Inheritance
ConsentMessage
Inherited Members

Remarks

The consent page knows the decision but not the validated protocol request; the authorize endpoint has the validated client, redirect URI and state but never sees the decision. This message closes that gap, so the response is still built where every other authorize response is built.

It carries grants as well as denials, and the grant half is not symmetry for its own sake. A user who declines an optional scope leaves a stored consent narrower than the request that prompted it, and reading that back would send the browser to the consent page again — for scopes it has just answered, forever. The decision has to reach the request it was made for, and this is how the denial already did it.

Since 0.161.0 it is the default IConsentMessageStore that writes and reads it, for the consent page and the authorize endpoint, which go through Duende's store.

Properties

ClientId

The client the decision was made for — checked against the in-flight request before it is honoured.

public string ClientId { get; init; }

Property Value

string

Created

The UTC ticks the decision was made at: the Created it was written from.

public long Created { get; init; }

Property Value

long

Remarks

Since 0.161.0; zero on a decision written before.

Description

The name the user gave the grant on the consent page, for the authorization code it becomes.

public string? Description { get; init; }

Property Value

string

Error

The error to return to the client.

public InteractionError Error { get; init; }

Property Value

InteractionError

ErrorCode

The OAuth 2.0 / OpenID Connect error code for Error.

public string ErrorCode { get; }

Property Value

string

ErrorDescription

The human-readable description of the error, if there is one.

public string? ErrorDescription { get; init; }

Property Value

string

Granted

Whether this decision authorized the request.

public bool Granted { get; }

Property Value

bool

ScopesConsented

The scopes the user consented to, or null when the decision was a denial.

public IReadOnlyCollection<string>? ScopesConsented { get; init; }

Property Value

IReadOnlyCollection<string>

Remarks

Null and empty mean different things: null is "this message is a denial", and an empty grant is not a state the consent page can produce — it answers that as a denial, because a grant of nothing is not a grant.

SubjectId

The subject who made the decision — checked against the signed-in user before it is honoured.

public string SubjectId { get; init; }

Property Value

string