共用方式為


AuthenticationServiceCollectionExtensions.AddAuthentication 方法

定義

多載

AddAuthentication(IServiceCollection)

註冊驗證服務所需的服務。

AddAuthentication(IServiceCollection, Action<AuthenticationOptions>)

註冊驗證服務所需的服務,並設定 AuthenticationOptions

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

註冊驗證服務所需的服務。 defaultScheme 指定未要求特定配置時,預設要使用的配置名稱。

AddAuthentication(IServiceCollection)

來源:
AuthenticationServiceCollectionExtensions.cs
來源:
AuthenticationServiceCollectionExtensions.cs
來源:
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>)

來源:
AuthenticationServiceCollectionExtensions.cs
來源:
AuthenticationServiceCollectionExtensions.cs
來源:
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)

來源:
AuthenticationServiceCollectionExtensions.cs
來源:
AuthenticationServiceCollectionExtensions.cs
來源:
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 可用來進一步設定驗證。

適用於