当前位置:网站首页>. Net 7 JWT configuration is too convenient!
. Net 7 JWT configuration is too convenient!
2022-06-30 03:48:00 【Dotnet cross platform】
Microsoft announces .NET 7 preview5 There are some big improvements , Include JWT Simplified and automated authentication configuration .
I installed. preview 5 Tried a new JWT Identity configuration . If you want to update an existing project to .Net 7 preview 5, Here is a quick update command .
Update all Microsoft.AspNetCore.* package references to 7.0.0-preview.5.*.
Update all Microsoft.Extensions.* package references to 7.0.0-preview.5.*..NET 7 Previous JWT Authentication configuration
Microsoft says it has received feedback , stay ASP.NET Core Configuration in the project JWT, It's writing API Is one of the hardest parts . It takes many steps , This includes adding middleware and configuring services during startup .
.Net The team knows JWT Configure in protection API The importance of , That's why they have improved and simplified the ASP.NET Core Configuration in the project JWT The process of Authentication .
A simplified JWT To configure
WebApplicationBuilder Added a new Authentication attribute , You can then call AddJwtBearer() Method , as follows
var builder = WebApplication.CreateBuilder(args);
builder.Authentication.AddJwtBearer();
var app = builder.Build();Use this new property to set JWT Authentication automatically adds the required middleware , No additional code is required .
most important of all , Now you can directly appsettings.json To configure JWT, You can easily configure multiple environments .
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"Authentication": {
"DefaultScheme" : "JwtBearer",
"Schemes": {
"JwtBearer": {
"Audiences": [ "http://localhost:5000",
"https://localhost:5001" ],
"ClaimsIssuer": "user-jwt-here"
}
}
}
}Above is .NET 7 preview 5 Simplified in JWT To configure , This is very convenient , This improvement can really help developers save time on configuring projects .
END
Made a .NET The learning website , Covering distributed systems , Data structure and algorithm , Design patterns , operating system , Computer network, etc , And job recommendation and interview experience sharing , Welcome to flirt .

边栏推荐
- 1150_ Makefile learning_ Duplicate name target processing in makefile
- Learning cyclic redundancy CRC check
- (03).NET MAUI实战 基础控件
- Laravel9 installation locale
- [FAQ] page cross domain and interface Cross Domain
- Buffer pool of MySQL notes
- Chapter 2 control structure and function (programming problem)
- yarn的安装和使用
- 11: I came out at 11:04 after the interview. What I asked was really too
- 关于智能视觉组上的机械臂
猜你喜欢

毕业设计EMS办公管理系统(B/S结构)+J2EE+SQLserver8.0

【力扣刷题总结】数据库题目按知识点分类总结(持续更新/简单和中等题已完结)

Tidb 6.0: rendre les GRT plus efficaces 丨 tidb Book Rush

第2章 控制结构和函数(编程题)

【图像融合】基于交叉双边滤波器和加权平均实现多焦点和多光谱图像融合附matlab代码
![[note] on May 27, 2022, MySQL is operated through pychart](/img/34/36a3765683b2af485ca7c3e366da59.png)
[note] on May 27, 2022, MySQL is operated through pychart

Arrangement of language resources of upgraded version

11: I came out at 11:04 after the interview. What I asked was really too

C#【高级篇】 C# 多线程

巧用 Bitmap 实现亿级海量数据统计
随机推荐
Redis在windows系统中使用
深入浅出掌握grpc通信框架
【常见问题】浏览器环境、node环境的模块化问题
[note] on May 28, 2022, data is obtained from the web page and written into the database
Ubuntu20.04 PostgreSQL 14 installation configuration record
专升本高数(四)
利用反射整合ViewBinding和ViewHolder
解决navicat连接数据库遇到的问题
Feign 坑
Node-RED系列(二八):基于OPC UA节点与西门子PLC进行通讯
1151_ Makefile learning_ Static matching pattern rules in makefile
Version correspondence table of tensorflow, CUDA and bazel
[qt] qmap usage details
UML diagrams and list collections
A GPU approach to particle physics
[note] on May 27, 2022, MySQL is operated through pychart
[operation] MySQL query operation 2 on May 25, 2022
Semantic segmentation resources
yarn的安装和使用
Wang Shuang - assembly language learning summary