随笔分类 -  ASP.NET Core

摘要:实体模型 public class BaseModel { public int Id { get; set;} } public class Authorization : BaseModel { public string Route { get; set; } public string Au 阅读全文
posted @ 2024-08-07 16:54 leafroc 阅读(53) 评论(0) 推荐(0) 编辑
摘要:Program.cs #region 授权 builder.Services.AddAuthorization(option => { //添加自定义授权策略 option.AddPolicy("MyPolicy",p => p.RequireClaim(ClaimTypes.NameIdentif 阅读全文
posted @ 2024-01-02 18:49 leafroc 阅读(1956) 评论(0) 推荐(1) 编辑
摘要:TokenAuthenticationHandler.cs 首先自定义一个类TokenAuthenticationHandler,然后需要继承IAuthenticationHandler接口 具体代码: public class TokenAuthenticationHandler : IAuthe 阅读全文
posted @ 2024-01-02 15:53 leafroc 阅读(470) 评论(0) 推荐(0) 编辑
摘要:鉴权(Authentication)授权(Authorization) 简单的理解:鉴权衡量你能不能进一道门,授权是你进门了可以干什么 Cookie 1.HTTP无连接无状态,Cookie和Session就是解决此问题。 2.客户端向服务器端发送一个请求的时,服务端向客户端发送一个Cookie 然后 阅读全文
posted @ 2023-12-28 17:46 leafroc 阅读(349) 评论(0) 推荐(1) 编辑
摘要:方法一 app.UseExceptionHandler(configure =>{ configure.Run(async context => { var excHandler = context.Features.Get<IExceptionHandlerPathFeature>(); var 阅读全文
posted @ 2023-12-28 12:13 leafroc 阅读(235) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示