Explore a collection of sample projects demonstrating various authentication and authorization strategies within ASP.NET Core MVC applications.
A straightforward implementation of user authentication using cookies. Demonstrates registration, login, logout, and protecting specific routes.
GET /msdn/documentation/dotnet/core/samples/aspnetcore-mvc-auth/basic-cookie
View Sample Details | Download Sample
Implement token-based authentication suitable for API scenarios or single-page applications. Covers generating, validating, and using JWT tokens.
GET /msdn/documentation/dotnet/core/samples/aspnetcore-mvc-auth/jwt-bearer
View Sample Details | Download Sample
Integrate with popular social identity providers like Google and Facebook for seamless user authentication. This sample leverages ASP.NET Core's built-in OAuth/OpenID Connect middleware.
GET /msdn/documentation/dotnet/core/samples/aspnetcore-mvc-auth/social-login
View Sample Details | Download Sample
Learn how to restrict access to controllers or actions based on user roles. This sample demonstrates defining roles and assigning them to users.
GET /msdn/documentation/dotnet/core/samples/aspnetcore-mvc-auth/role-authorization
View Sample Details | Download Sample
Implement more granular authorization logic using custom authorization policies. This sample shows how to create and apply policies based on claims, roles, or other conditions.
GET /msdn/documentation/dotnet/core/samples/aspnetcore-mvc-auth/policy-authorization
View Sample Details | Download Sample
Important: These samples are designed to illustrate specific authentication and authorization patterns. Always follow best practices for secure credential storage and validation in production environments.