Class ProtectedResourceErrorResult
- Namespace
- Fdyay.IdentityServer.Hosting
- Assembly
- Fdyay.IdentityServer.AspNetCore.dll
Writes a protected resource's refusal: its status, and a WWW-Authenticate challenge (RFC 6750).
public sealed class ProtectedResourceErrorResult : IEndpointResult
- Inheritance
-
ProtectedResourceErrorResult
- Implements
- Inherited Members
Remarks
The status is the error's, as RFC 6750 §3.1 gives it and Duende 8.0.1 maps it: invalid_request is 400,
insufficient_scope is 403, and a token that is not good — invalid_token, expired_token, and anything
else — is 401. expired_token is challenged as error="invalid_token" with
error_description="The access token expired", as Duende's writes it (0.174.0).
Constructors
ProtectedResourceErrorResult(string, string)
Refuses with a challenge naming how the token should have been presented.
public ProtectedResourceErrorResult(string error, string challenge = "Bearer")
Parameters
Remarks
The scheme is a parameter because a refusal is the only place a client is told what it is holding.
RFC 9449 §7.1: a key-bound token refused with a Bearer challenge sends the client back to
retry the one way that cannot work.
Properties
DPoPNonce
A nonce for the client's next DPoP proof, written as the DPoP-Nonce header (RFC 9449 §9).
public string? DPoPNonce { get; init; }
Property Value
ErrorDescription
The challenge's error_description, when the refusal has one to give (RFC 6750 §3).
public string? ErrorDescription { get; init; }
Property Value
Methods
ExecuteAsync(HttpContext)
Writes the status (400 for invalid_request, 403 for insufficient_scope, otherwise 401), the
WWW-Authenticate challenge, and the DPoP-Nonce header when there is a nonce.
public Task ExecuteAsync(HttpContext context)
Parameters
contextHttpContextThe request whose response is written.
Returns
- Task
A completed task.