liveBook · Manning

ClaimsPrincipal

ClaimsPrincipal is a .NET security class representing a principal through one or more identities and their associated claims.

How 2 Manning books explain it

ASP.NET Core in Action, 3e

ClaimsPrincipal is a .NET security object that represents an authenticated user through a collection of claims and identities.

How it is used
Represents the current request user so application code can inspect user information and behave accordingly.
How deep it goes
Defines principals and claims, then traces sign-in, cookie restoration, and custom-claim use without detailing ClaimsPrincipal internals.
Examples
Uses an anonymous request, email-and-password sign-in, and a FullName claim added during registration and read in a Razor template.
What you can do after
Apply it via ASP.NET Core Identity to add a user claim and read it from the current principal.

Read how ASP.NET Core in Action, 3e explains ClaimsPrincipal →

Building Web APIs with ASP.NET Core

ClaimsPrincipal is a .NET identity object representing a user or caller through one or more claims-based identities.

How it is used
Supports policy-based authorization by exposing the current user's claims to assertion checks.
How deep it goes
Explains claim inspection and value transformation, but stops short of implementing custom requirements and authorization handlers.
Examples
Uses moderator and mobile-phone claims plus a date-of-birth claim to demonstrate policy checks.
What you can do after
Apply it via ASP.NET Core authorization policies to inspect claims and restrict controllers, actions, or Minimal API methods.

Read how Building Web APIs with ASP.NET Core explains ClaimsPrincipal →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.