mildronize/DotNetCore-Sample
.NET Core 5 - Template
.NET Core 5 Samples
Prefix
Mild.DesignPattern.**: Design Pattern SeriesMild.EF.**: Entity FrameworkMild.MVC.**: ASP.NET Core MVCMicrosoft.Learn.**: Microsoft docs & learn modulesMicrosoft.**: Sample Code from Microsoft example
All Sample
- Microsoft.Learn.SecureAspnetCoreIdentity
- Microsoft.React.Authentication.Starter
- Mild.DesignPattern.MementoPattern
- Mild.EF.RazorPage.Example.ContosoUniversity
- Mild.MVC.Authentication.Minimal
- Mild.MVC.Authentication.Openiddict.OAuth2.AuthorizationCodeRefreshToken
- Mild.MVC.Authentication.Openiddict.OAuth2.ClientCredentials
- Mild.MVC.Authentication.Openiddict.React
- Mild.MVC.Minimal
- Mild.React.Starter
Microsoft.Learn.SecureAspnetCoreIdentity
This project will be followed the learn modules: Secure an ASP.NET Core web app with the Identity framework
This project was created from the Code
Project Structure
├───start ## Starter template
└───final ## Final code from this tutorial
Note: The original article was designed in Azure Cloud Shell. Some how I can't use it one the website. So, I modify the article for local development.
The original article provides PosgreSQL & SQL Server, this article will apply docker and PosgreSQL for local development.
Lesson
- Introduction
- Set up the environment
- Configure Identity support
- Customize Identity
- Configure multi-factor authentication
- Use claims with policy-based authorization
Unit 1: Introduction
An online dog toy retailer, named Contoso Pets, is creating an app for viewing and managing the product catalog. You're asked to secure the app.
This module explores using ASP.NET Core Identity to support authentication and authorization in an ASP.NET Core Razor Pages web app.
Learning objectives
In this module, you will:
- Configure Identity support in an existing ASP.NET Core web app.
- Provide new user registration capabilities.
- Extend Identity UI components.
- Customize multi-factor login capabilities.
- Implement policy-based authorization using claims.
- Customize and extend the underlying Identity data store.
Microsoft.React.Authentication.Starter
Setup .NET Core 5 with React
Using react template (dotnet new reactredux -au Individual)
Features
- useSPA
- Class components
- Openid Connect with Identity Server
Note: this project for educational purpose.
Mild.DesignPattern.MementoPattern
Demonstrate Memento Pattern: It able to undo and redo a state of objects.
Mild.EF.RazorPage.Example.ContosoUniversity
Following in Doc: docs.microsoft.com - Razor Pages with Entity Framework Core in ASP.NET Core
All explanation are inside inline comment
Features
- Razor Page
- SQLite
Mild.MVC.Authentication.Minimal
Features
- MVC
- Cookie Authentication (SSR)
- Razor Page controlled by the Controller
- Session Management
Limitation
- No connect to any DB
Mild.MVC.Authentication.Openiddict.OAuth2.AuthorizationCodeRefreshToken
-
Enable the the Client Credentials Flow, which is suitable for machine-to-machine applications.
-
Enable the Authorization Code Flow with PKCE which is the recommended flow for Single Page Applications (SPA) and native/mobile applications.
-
Enable the Refresh Token
Features
- MVC
- Cookie Authentication (SSR)
- Razor Page controlled by the Controller
- Session Management
- Use
Openiddictfor OAuth2
Limitation
- No connect to any DB
Mild.MVC.Authentication.Openiddict.OAuth2.ClientCredentials
Enable the the Client Credentials Flow, which is suitable for machine-to-machine applications.
Features
- MVC
- Cookie Authentication (SSR)
- Razor Page controlled by the Controller
- Session Management
- Use
Openiddictfor OAuth2
Limitation
- No connect to any DB
Mild.MVC.Authentication.Openiddict.React
Mild.MVC.Minimal
Just a basic MVC
Mild.React.Starter
Moved to SukreepCode/Mild.ReactTS.Starter
Minimal setup .NET Core 5 with React TypeScript.
Using reactredux template (dotnet new reactredux), removed Redux.
Refactor from a class component to functional component.
Features
- useSPA
- TypeScript
- No Redux
- Functional components
For building this file
node merge-md.js