liveBook · Manning

Challenge scheme

As explained in Building Distributed Applications that Work

A challenge scheme determines the authentication action taken when an unauthenticated user requests a protected resource.

A challenge scheme decides what happens when an unauthenticated user requests a protected resource. It differs from the authentication scheme, which reads the current identity to determine whether the user is authenticated. In the UI app, cookies handle authentication and OpenID Connect (OIDC) handles the challenge by redirecting the user to an identity provider. section 8.3

builder.Services.AddAuthentication(options =>
{
    options.DefaultScheme =
        CookieAuthenticationDefaults.AuthenticationScheme;
    options.DefaultChallengeScheme =
        OpenIdConnectDefaults.AuthenticationScheme;
})
.AddCookie(
    CookieAuthenticationDefaults.AuthenticationScheme)
.AddOpenIdConnect()
.ConfigureWebAppOpenIdConnect();

The startup configuration sets DefaultScheme to cookies and DefaultChallengeScheme to OIDC, then registers both schemes. section 8.3

Protected UI resource

When an unauthenticated user requests a UI resource marked [Authorize], the configured OIDC challenge redirects them to sign in. section 8.3

How Building Distributed Applications that Work covers it

How deep it goes
Explains the distinction from cookie authentication and shows scheme registration, without detailing the challenge flow.
Examples
Shows startup configuration pairing a cookie default scheme with an OIDC default challenge scheme.
What it assumes
Assumes familiarity with ASP.NET Core service registration while explaining the two schemes’ different jobs.
What you can do after
Operate/configure it by selecting OIDC as the default challenge scheme for a cookie-authenticated UI.
How it connects
Links challenge schemes to cookie authentication, OpenID Connect, authorization, and identity providers.

This explainer was generated by Manning's knowledge graph from the text of Building Distributed Applications that Work. The section links point to the parts of the book it draws on.