liveBook · Manning

Authentication scheme

As explained in Building Distributed Applications that Work

An authentication scheme defines how an application reads and validates the current authenticated identity.

An authentication scheme reads the current identity to determine whether a user is authenticated. In the UI application, the default scheme is Cookies: it manages and validates authentication cookies. This is separate from the challenge scheme, which determines what happens when an unauthenticated user requests a protected resource. OpenID Connect (OIDC) is the default challenge scheme and redirects that user to authenticate. section 8.3

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

The startup configuration sets the cookie scheme as DefaultScheme, the OIDC scheme as DefaultChallengeScheme, and registers both handlers. section 8.3

How Building Distributed Applications that Work covers it

How deep it goes
Defines the distinction between authentication and challenge schemes and shows their startup registration, without detailing cookie validation internals.
Examples
Shows ASP.NET Core startup code setting DefaultScheme to Cookies and DefaultChallengeScheme to OpenID Connect.
What you can do after
Operate/configure it by registering cookie and OpenID Connect handlers and selecting separate default authentication and challenge schemes.
How it connects
Connects cookie authentication with OpenID Connect challenges, dependency injection, and protected resources.

Related concepts

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.