liveBook · Manning

Authentication

As explained in Building Web APIs with ASP.NET Core

Authentication is the process of verifying the identity of an API caller or other entity.

Authentication verifies that a person, computer, or software is what it claims to be. For a web API, it answers “Who is calling?” before the API decides what that caller may do. section 9.1.1 section 9.6

Consider a board-game API with endpoints that add or delete games, domains, and mechanics. Leaving those endpoints open lets anyone change the data. Authentication identifies callers so the API can distinguish a known user from an anonymous one; authorization then determines whether that user has permission to make the change. section 9.0 section 9.1.2

A typical access flow is:

  • Give anonymous callers only limited access, such as public content and a way to log in. section 9.1.2
  • Authenticate a caller whose login attempt succeeds. section 9.1.2
  • Check the caller’s permissions and allow or deny access to the restricted resource. section 9.1.2
Figure 9.1 Authentication and authorization flow
09-01

Use the flow diagram to trace how identifying a user and deciding access work together. A request for a restricted resource can also be denied while the caller is still anonymous. section 9.1.2

In an ASP.NET Core API, Identity provides abstractions for managing user accounts alongside roles, claims, tokens, and policies. User accounts and JSON Web Tokens are authentication options; authorization checks can then restrict endpoints. The choice needs care: a bearer token can carry information used for authorization without authenticating the client on every request, but anyone who gains access to the token may pose a security problem. section 9.0 section 9.6

Why identify the caller?

A user logging into a service is a familiar authentication example. Identifying users uniquely can also help attribute actions to their authors, support monitoring, and determine whether someone is logged in. Shared credentials weaken that accountability because actions cannot be reliably attributed to one person. section 9.1.1

How Building Web APIs with ASP.NET Core covers it

How deep it goes
Defines identity verification and walks through its access-control flow; stops short of showing authentication configuration or code in the supplied excerpts.
Examples
Uses login, fingerprint unlocking, and unrestricted board-game API write endpoints to make identity checks concrete.
What it assumes
Introduces authentication and authorization in plain terms while assuming familiarity with web API callers and endpoints.
What you can do after
Evaluate/understand when an API must identify callers and why identification alone does not grant permission.
How it connects
Connects authentication to authorization, access control lists, user accounts, claims, roles, and bearer tokens.

Also explained in

Compare how 34 books explain authentication →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Building Web APIs with ASP.NET Core. The section links point to the parts of the book it draws on.