liveBook · Manning

SignInManager<T>

As explained in ASP.NET Core in Action, 3e

SignInManager<T> is an ASP.NET Core Identity service for signing users in and out and managing request authentication state.

SignInManager<T> handles the central work of signing users in and out with ASP.NET Core Identity. During login, it loads the user, validates the submitted password, creates an authenticated ClaimsPrincipal, assigns it to HttpContext.User, and stores the principal in an encrypted authentication cookie. section 23.1.2 section 23.7

A typical sign-in request proceeds as follows:

  • A Razor Page receives the username and password through model binding. section 23.1.2
  • SignInManager loads the matching user entity and checks the password; Identity stores passwords as strong one-way hashes rather than plain text. section 23.1.2
  • After successful validation, SignInManager replaces the anonymous request principal, adds claims such as the email address, and sets the encrypted cookie. section 23.1.2
  • The default Identity UI uses SignInManager<T> for registration and login flows, while application code supplies or customizes the UI. section 23.7
Figure 23.2 Signing in to an ASP.NET Core application. SignInManager is responsible for setting HttpContext.User to the new principal and serializing the principal to the encrypted cookie.
CH23_F02_Lock3

Trace the login request from form submission through principal creation, HttpContext.User assignment, and encrypted-cookie serialization. section 23.1.2

How ASP.NET Core in Action, 3e covers it

How deep it goes
Explains login processing from credential validation through cookie creation, but does not detail the service API methods.
Examples
Uses a Razor login form, database user lookup, password validation, claims creation, and encrypted-cookie persistence.
What it assumes
Assumes a configured ASP.NET Core Identity system and user store, while introducing principals, claims, cookies, and password hashing.
What you can do after
Apply via ASP.NET Core Identity to connect a login UI with credential validation and persistent authenticated requests.
How it connects
Connects authentication middleware, HttpContext.User, ClaimsPrincipal, cookies, Razor Pages, UserManager<T>, and Identity UI.

Also explained in

Compare how 2 books explain SignInManager<T> →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ASP.NET Core in Action, 3e. The section links point to the parts of the book it draws on.