• 2024-10-21ASP.NET Cookie身份认证
    1.添加Cookie身份验证方案services.AddAuthentication(option=>{option.DefaultAuthenticateScheme=CookieAuthenticationDefaults.AuthenticationScheme;option.DefaultChallengeScheme=CookieAuthenticationDefaults.AuthenticationScheme;}).AddCookie(Coo
  • 2024-08-20.net core 手写一个url的鉴权
    思路::在startup.cs的configservice中配置自定义鉴权方式,在界面使用该方式本章节实现一个简单的自定义鉴权:要求每个url后面要有参数UrlToken并且值为liping-123456,才可以访问成功,否则失败 1:配置一个自定义鉴权的文件1publicclassCustomerAuthenticationConfig2{3
  • 2023-04-07Httpcontext.signIn() 执行了什么?
    asp.netcore登录的时候可以写 Httpcontext.signIn(user);这个方法,如果用cookie最后会些写cookie信息到Httpcontext.respones中。定义publicstaticTaskSignInAsync(thisHttpContextcontext,string?scheme,ClaimsPrincipalprincipal,AuthenticationProperties?p
  • 2023-01-30identityserver4 客户claims里没有用户姓名的问题
    客户端代码JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();services.AddAuthentication(options=>{options.DefaultSch
  • 2022-12-28asp.netcore Authentication, schema
    1. code likethiswillreporterror:  builder.Services.AddAuthentication("dd").AddCookie("ddd");builder.Services.AddAuthorization();InvalidOperationE
  • 2022-12-21asp.netcore Authentication
    Authenticationisforgettingtheuserinfomationfromcookie/token..Weuse Authenticationlikethis:builder.Services.AddAuthentication("cookie").AddCooki