# Cookie Authentication and \[Authorize\]

Turn on cookie authentication in Program.cs, sign users in with claims and SignInAsync, protect actions with \[Authorize\] and roles, and show who's signed in with User.

![Cheat sheet: Cookie Authentication and \[Authorize\]](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/a27eb158c93c47d6b1f93c00d1f59822.webp)

- Category: ASP.NET Core
- Level: Journeyman
- Tags: \[Authorize\], aspnet-core, Authentication Middleware, Claims and ClaimsPrincipal, Cookie Authentication, c-sharp
- Updated: November 3, 2026

Source: https://www.ask-codey.com/cheat-sheets/security-and-sessions-cookie-authentication-and-authorize-cheat-sheet
