liveBook · Manning

Authorization

As explained in Building Distributed Applications that Work

Authorization is the process of determining which actions or resources an authenticated principal is permitted to access.

Authorization determines whether an authenticated client has permission to access a requested resource. It answers a different question from authentication: proving who the client is does not, by itself, grant access. An admin-only page is one example of a resource that needs a permission check. section 8.1 section 8.6

In an online shop, anyone can browse the product catalog, but placing an order requires a registered, logged-in user. A shared identity provider supports single sign-on; OpenID Connect handles authentication, while OAuth provides the authorization mechanism. The UI can pass credentials and permission information to a backend API in a JWT. section 8.1 section 8.6 section 1.1

For an ASP.NET Core UI, put the access check into the request pipeline:

  • Configure authentication with cookies and OpenID Connect so the UI can establish the user's identity. section 8.3
  • Register authorization with AddAuthorization(), then call UseAuthentication() and UseAuthorization() in that order. section 8.3
  • Mark a UI page that requires a signed-in user with [Authorize]. Leave catalog browsing available without that restriction. section 8.3 section 8.1

Catalog versus checkout

A shopper can inspect products without logging in. Attempting to place an order instead requires registration and login; after registration, the shopper returns to the web frontend with access to its protected functionality. section 8.1

How Building Distributed Applications that Work covers it

How deep it goes
Defines permission checks and shows UI registration, middleware, and a page attribute; leaves protocol details at a high level.
Examples
Uses an open product catalog, restricted ordering, an admin-only page, and ASP.NET Core authorization calls.
What it assumes
Assumes an existing identity provider and UI application, but requires only a high-level understanding of OpenID Connect and OAuth.
What you can do after
Operate/configure it by registering ASP.NET Core authorization, adding its middleware, and protecting a UI page with [Authorize].
How it connects
Links authorization to authentication, single sign-on, OAuth, OpenID Connect, identity providers, and JWTs.

Also explained in

Compare how 28 books explain authorization →

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.