Asp.net core asp.net核心:AuthenticationHandler和IAAuthenticationService的关系如何?
我试图理解asp.net核心身份验证 我看到,为了处理自定义模式,可以使用从AuthenticationHandler派生的类:Asp.net core asp.net核心:AuthenticationHandler和IAAuthenticationService的关系如何?,asp.net-core,authentication,Asp.net Core,Authentication,我试图理解asp.net核心身份验证 我看到,为了处理自定义模式,可以使用从AuthenticationHandler派生的类: services.AddAuthentication("BasicAuthentication") .AddScheme<AuthenticationSchemeOptions, BasicAuthenticationHandler>("BasicAuthentication", null);
services.AddAuthentication("BasicAuthentication")
.AddScheme<AuthenticationSchemeOptions, BasicAuthenticationHandler>("BasicAuthentication", null);
services.AddAuthentication(“基本验证”)
.AddScheme(“基本验证”,null);
但是这个类与IAAuthenticationService有什么关系呢?默认实现是否在某个点调用处理程序
谢谢 调用函数
AddScheme()
时,它会执行以下操作:
services.AddTransient()
)services.AddOptions)
iaauthenticationservice
默认实现AuthenticationService
当其功能authenticateSync()时
使用一个特定的方案调用,它将使用我上面解释的这个映射解析特定的处理程序。更具体地说,它将使用iaAuthenticationHandlerProvider
对于这个作业,它的默认实现是AuthenticationHandlerProvider
它有一个函数[GetHandlerAsync()][2]
搜索(方案/处理程序)的映射并返回与方案匹配的适当处理程序
当然,这是身份验证处理程序在后台使用身份验证方案和处理程序所做的简化版本,但我希望它能回答您的问题^^