首页 > 编程语言 >Asp.Net.Core -Authentication认证

Asp.Net.Core -Authentication认证

时间:2024-04-28 15:34:47浏览次数:24  
标签:Core Asp 通过 认证 Authentication Net Scheme AuthenticationHandlerProvider

 

认证流程:

1.在Startup类中的ConfigureServices方法通过添加AddAuthentication注册我们最主要的三个对象AuthenticationService, AuthenticationHandlerProvider, AuthenticationSchemeProvider
2.通过AddAuthentication返回的AuthenticationBuilder 通过AddJwtBearer(或者AddCookie)来指定Scheme类型和需要验证的参数
3.在Startup类中的Configure方法通过添加UseAuthentication注册认证中间件
4.在认证过程中,通过AuthenticationSchemeProvider获取正确的Scheme,在AuthenticationService中通过Scheme和AuthenticationHandlerProvider获取正确的AuthenticationHandler,最后通过对应的AuthenticationHandler的AuthenticateAsync方法进行认证流程

 

参考

标签:Core,Asp,通过,认证,Authentication,Net,Scheme,AuthenticationHandlerProvider
From: https://www.cnblogs.com/sugarwxx/p/18163830

相关文章

  • asp.net core 多个授权策略选择单个策略
    首先假设我们依据官方示例有这样一个自定义的授权handlerpublicclassFunAuthorizeAttribute:AuthorizeAttribute,IAuthorizationRequirement,IAuthorizationRequirementData{publicFunAuthorizeAttribute():this(null,true){}publicFun......
  • C#的基于.net framework的Dll模块编程(四) - 编程手把手系列文章
          这次继续这个系列的介绍: 一、命名空间的起名;对于C#来说,一般命名空间的建议是:公司名(或个人名称).产品名.分类名,比如我这边是用的这个:Lzhdim.LPF.Helper,意思是个人名Lzhdim,加上LPF为平台名,加上Helper分类为帮助类,其它的更长的请读者自己添加。  ......
  • ocelot系列文章02---在.netcore项目中集成
    1、创建项目并引入安装包首先,创建2个WebApi项目,WebApi01和WebApi02,地址分别https://localhost:44313和https://localhost:44390,其中WebApi01当作网关,WebApi02当作具体的微服务Api。然后,将Ocelot的NuGet软件包安装到WebApi01项目中。注意我这里安装的是17.0.0版本,配置方面会有点......
  • Simple Neural Network
    神经网络——从PLA到BP神经网络0.推荐阅读B站白板推导系列二十三(没有任何数学推导,能够看得很舒服)李沐-动手学深度学习1.感知机学习算法(PerceptronLearningAlgorithm)相信能看到神经网络的朋友对于机器学习的基础算法已经了解了个大概了,如果你没有听说过感知机算法,......
  • 【BFS】abc351D Grid and Magnet 题解
    传送门D-GridandMagnet题意:给定h行w列的图表,其中部分位置有磁铁,人物会在磁铁四周((x+1,y),(x-1,y),(x,y+1),(x,y-1))停止,某点的自由度定义为从该点出发最多可到的方块数目可以走重复路前置例题:求连通块大小洛谷P1141思路:由自由度的定义联想到连通块的大小,从而决定用BFS......
  • [abc 351] [D - Grid and Magnet]
    搜索importjava.io.BufferedReader;importjava.io.IOException;importjava.io.InputStreamReader;importjava.math.BigInteger;importjava.util.*;publicclassMain{staticinth;staticintw;staticchar[][]board;staticboolean[][]......
  • asp.net basic auth middleware
    dotnet-6-basic-authentication-api/Entities/User.csnamespaceWebApi.Entities;usingSystem.Text.Json.Serialization;publicclassUser{publicintId{get;set;}publicstringFirstName{get;set;}publicstringLastName{get;set;}......
  • 论文解读(MAML)《Model-Agnostic Meta-Learning for Fast Adaptation of Deep Networks
    Note:[wechat:Y466551|可加勿骚扰,付费咨询]论文信息论文标题:Model-AgnosticMeta-LearningforFastAdaptationofDeepNetworks论文作者:ChelseaFinn、PieterAbbeel、SergeyLevine论文来源:2017 论文地址:download 论文代码:download视屏讲解:click1-摘要我们提出......
  • middleware的注册和使用 asp.net
    middleware的编写和注册编写中间件类(middleware-class)通常,中间件封装在类中,并且通过扩展方法公开。具有类型为RequestDelegate的参数的公共构造函数。publicLoggingMiddleware(RequestDelegatenext){_next=next;}名为Invoke或InvokeAsync的公共方法......
  • centos7出现网络不可达connect network is unreachable?
    centos7出现网络不可达connect:networkisunreachable?问题:在Linux系统中,用户尝试修改IP地址配置后,遇到ping命令提示connect:networkisunreachable,表明网络不可达。原因分析:IP配置错误:修改后的IP地址可能不在正确的子网内,或者与默认网关不在同一网段,导致无法正常通信......