AuthenticationServiceCollectionExtensions.AddAuthentication 方法

定义

重载

AddAuthentication(IServiceCollection)

注册身份验证服务所需的服务。

AddAuthentication(IServiceCollection, Action<AuthenticationOptions>)

注册身份验证服务所需的服务,并配置 AuthenticationOptions

AddAuthentication(IServiceCollection, Action<SharedAuthenticationOptions>)
AddAuthentication(IServiceCollection, String)

注册身份验证服务所需的服务。 defaultScheme 指定在未请求特定方案时默认要使用的方案的名称。

AddAuthentication(IServiceCollection)

Source:
AuthenticationServiceCollectionExtensions.cs
Source:
AuthenticationServiceCollectionExtensions.cs
Source:
AuthenticationServiceCollectionExtensions.cs

注册身份验证服务所需的服务。

public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddAuthentication (this Microsoft.Extensions.DependencyInjection.IServiceCollection services);
public static Microsoft.AspNetCore.Authentication.AuthenticationBuilder AddAuthentication (this Microsoft.Extensions.DependencyInjection.IServiceCollection services);
static member AddAuthentication : Microsoft.Extensions.DependencyInjection.IServiceCollection -> Microsoft.Extensions.DependencyInjection.IServiceCollection
static member AddAuthentication : Microsoft.Extensions.DependencyInjection.IServiceCollection -> Microsoft.AspNetCore.Authentication.AuthenticationBuilder
<Extension()>
Public Function AddAuthentication (services As IServiceCollection) As IServiceCollection
<Extension()>
Public Function AddAuthentication (services As IServiceCollection) As AuthenticationBuilder

参数

返回

可用于进一步配置身份验证的 AuthenticationBuilder

适用于

AddAuthentication(IServiceCollection, Action<AuthenticationOptions>)

Source:
AuthenticationServiceCollectionExtensions.cs
Source:
AuthenticationServiceCollectionExtensions.cs
Source:
AuthenticationServiceCollectionExtensions.cs

注册身份验证服务所需的服务,并配置 AuthenticationOptions

public static Microsoft.AspNetCore.Authentication.AuthenticationBuilder AddAuthentication (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Action<Microsoft.AspNetCore.Authentication.AuthenticationOptions> configureOptions);
static member AddAuthentication : Microsoft.Extensions.DependencyInjection.IServiceCollection * Action<Microsoft.AspNetCore.Authentication.AuthenticationOptions> -> Microsoft.AspNetCore.Authentication.AuthenticationBuilder
<Extension()>
Public Function AddAuthentication (services As IServiceCollection, configureOptions As Action(Of AuthenticationOptions)) As AuthenticationBuilder

参数

configureOptions
Action<AuthenticationOptions>

要配置 AuthenticationOptions的委托。

返回

可用于进一步配置身份验证的 AuthenticationBuilder

适用于

AddAuthentication(IServiceCollection, Action<SharedAuthenticationOptions>)

public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddAuthentication (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Action<Microsoft.AspNetCore.Authentication.SharedAuthenticationOptions> configureOptions);
static member AddAuthentication : Microsoft.Extensions.DependencyInjection.IServiceCollection * Action<Microsoft.AspNetCore.Authentication.SharedAuthenticationOptions> -> Microsoft.Extensions.DependencyInjection.IServiceCollection
<Extension()>
Public Function AddAuthentication (services As IServiceCollection, configureOptions As Action(Of SharedAuthenticationOptions)) As IServiceCollection

参数

返回

适用于

AddAuthentication(IServiceCollection, String)

Source:
AuthenticationServiceCollectionExtensions.cs
Source:
AuthenticationServiceCollectionExtensions.cs
Source:
AuthenticationServiceCollectionExtensions.cs

注册身份验证服务所需的服务。 defaultScheme 指定在未请求特定方案时默认要使用的方案的名称。

public static Microsoft.AspNetCore.Authentication.AuthenticationBuilder AddAuthentication (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, string defaultScheme);
static member AddAuthentication : Microsoft.Extensions.DependencyInjection.IServiceCollection * string -> Microsoft.AspNetCore.Authentication.AuthenticationBuilder
<Extension()>
Public Function AddAuthentication (services As IServiceCollection, defaultScheme As String) As AuthenticationBuilder

参数

defaultScheme
String

用作所有其他方案的回退的默认方案。

返回

可用于进一步配置身份验证的 AuthenticationBuilder

适用于