天天看點

Asp.net Core Web Mvc項目添加Jwt驗證

1、建立Asp.net Core Web Mvc項目

Asp.net Core Web Mvc項目添加Jwt驗證

 2、項目目錄結構如下:

Asp.net Core Web Mvc項目添加Jwt驗證

 3、修改launchSettings.json

4、Nuget包下載下傳安裝

Microsoft.AspNetCore.Authentication.JwtBearer

5、添加JwtManage.cs

6、添加UserController.cs

7、修改Startup.cs

8、修改HomeController.cs

9、Views檔案下添加User檔案夾并添加index.cshtml

10、啟動運作,輸入admin,admin