Skip to content

OidcResults Class

Turns an OAuth/OIDC error into an Microsoft.AspNetCore.Http.IResult and decorates results with headers, mirroring the MVC integration's ActionResultExtensions so both adapters emit identical HTTP error shapes.

C#
public static class OidcResults

Inheritance System.Object → OidcResults

Methods

OidcResults.Format(this OidcError, int, string) Method

Formats an OidcError as an HTTP error response per RFC 6750 §3 / RFC 6749 §5.2: invalid_token returns 401 with a WWW-Authenticate Bearer challenge and no body; insufficient_scope returns 403 with the header; invalid_client returns 401 with a Basic challenge and the JSON error body; everything else uses the fallback status code with a JSON body.

C#
public static Microsoft.AspNetCore.Http.IResult Format(this Abblix.Oidc.Server.Common.OidcError error, int fallbackStatusCode, string? realm=null);

Parameters

error OidcError
fallbackStatusCode System.Int32
realm System.String

Returns

Microsoft.AspNetCore.Http.IResult

OidcResults.Format(this OidcError, int, string, IEnumerable<string>, bool) Method

Formats an OidcError as an HTTP error response that advertises the DPoP scheme (RFC 9449 §7.1) on the WWW-Authenticate header, optionally alongside Bearer. UseDPoPNonceError additionally emits the DPoP-Nonce header so the client can echo the freshly issued nonce on retry.

C#
public static Microsoft.AspNetCore.Http.IResult Format(this Abblix.Oidc.Server.Common.OidcError error, int fallbackStatusCode, string? realm, System.Collections.Generic.IEnumerable<string> dpopAlgs, bool advertiseBearer);

Parameters

error OidcError
fallbackStatusCode System.Int32
realm System.String
dpopAlgs System.Collections.Generic.IEnumerable<System.String>
advertiseBearer System.Boolean

Returns

Microsoft.AspNetCore.Http.IResult

OidcResults.WithAntiFramingHeaders(this IResult) Method

Decorates a self-rendered HTML result (the form_post auto-submit page) with the anti-framing headers so it can never be embedded in another origin's frame (clickjacking defense, RFC 9700 Section 4.16). The check_session page cannot use this path: its CSP carries a per-request nonce generated inside the result, so it sets the header itself.

C#
public static Microsoft.AspNetCore.Http.IResult WithAntiFramingHeaders(this Microsoft.AspNetCore.Http.IResult inner);

Parameters

inner Microsoft.AspNetCore.Http.IResult

Returns

Microsoft.AspNetCore.Http.IResult

OidcResults.WithAppendCookie(this IResult, string, string, CookieOptions) Method

Decorates a result to append a cookie to the response before the inner result executes.

C#
public static Microsoft.AspNetCore.Http.IResult WithAppendCookie(this Microsoft.AspNetCore.Http.IResult inner, string name, string value, Microsoft.AspNetCore.Http.CookieOptions options);

Parameters

inner Microsoft.AspNetCore.Http.IResult
name System.String
value System.String
options Microsoft.AspNetCore.Http.CookieOptions

Returns

Microsoft.AspNetCore.Http.IResult

OidcResults.WithDeleteCookie(this IResult, string, CookieOptions) Method

Decorates a result to delete a cookie from the response before the inner result executes.

C#
public static Microsoft.AspNetCore.Http.IResult WithDeleteCookie(this Microsoft.AspNetCore.Http.IResult inner, string name, Microsoft.AspNetCore.Http.CookieOptions options);

Parameters

inner Microsoft.AspNetCore.Http.IResult
name System.String
options Microsoft.AspNetCore.Http.CookieOptions

Returns

Microsoft.AspNetCore.Http.IResult

OidcResults.WithHeader(this IResult, string, string) Method

Decorates a result to set a response header before the inner result executes.

C#
public static Microsoft.AspNetCore.Http.IResult WithHeader(this Microsoft.AspNetCore.Http.IResult inner, string name, string value);

Parameters

inner Microsoft.AspNetCore.Http.IResult
name System.String
value System.String

Returns

Microsoft.AspNetCore.Http.IResult

OidcResults.WithHeader(this IResult, string, IEnumerable<string>) Method

Decorates a result to append each value as a separate header line under the same name.

C#
public static Microsoft.AspNetCore.Http.IResult WithHeader(this Microsoft.AspNetCore.Http.IResult inner, string name, System.Collections.Generic.IEnumerable<string> values);

Parameters

inner Microsoft.AspNetCore.Http.IResult
name System.String
values System.Collections.Generic.IEnumerable<System.String>

Returns

Microsoft.AspNetCore.Http.IResult