security-and-identity

Primary docs: - https://learn.microsoft.com/aspnet/core/security/ - https://learn.microsoft.com/aspnet/core/security/authentication/identity - https://learn.microsoft.com/aspnet/core/security/authorization/introduction

Security And Identity

Primary docs:

Security Defaults

Authentication And Authorization

Authentication answers who the user or caller is. Authorization answers what they can do.

Default pipeline order:

  1. UseAuthentication()
  2. UseAuthorization()

Apply authorization at boundaries:

Use AllowAnonymous sparingly and intentionally.

Identity

Use ASP.NET Core Identity when the app needs first-party user accounts, login flows, password management, email confirmation, MFA, or related account management.

Useful starting points:

Identity guidance:

On ASP.NET Core 10, Identity metrics are available for observing auth-related behavior. Use them when the app has meaningful authentication traffic or security monitoring requirements.

CSRF, CORS, And Browser Security

HTTPS, HSTS, And Forwarded Headers

Data Protection And Secrets

Blazor Note

For Blazor apps, read the general ASP.NET Core security guidance first and then the Blazor-specific security docs. Some Blazor security guidance adds to or supersedes the general guidance.