采用JWT实现WebAPI认证
JWT WebAPI(.NetFramework 4.5框架)
Author:TJ Date:2020.11.18
创建Asp.net web app项目
选择.net framework 4.5
Web api
Nuget
Cors 跨域
接受
Jwt
确定
添加TokenManager.cs类
添加控制器Controller
路由route
运行run
http://localhost:60304/account/validLogin?username=tj&userpassword=1234 http://localhost:60304/account/validLogin?username=tj&userpassword=tj
再次运行
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6InRqIiwibmJmIjoxNjA1ODAyNzA0LCJleHAiOjE2MDU4MDYzMDMsImlhdCI6MTYwNTgwMjcwNH0.RrTrbiGCscjAR0iQUdMlFrlGAO7ZnwrZiy_VuJXoxkw
add filter
Postman
无Header
错误header
正确header
结束。