AuthenticationServiceCollectionExtensions.AddAuthentication Method

Definition

Overloads

AddAuthentication(IServiceCollection)

Registers services required by authentication services.

AddAuthentication(IServiceCollection, Action<AuthenticationOptions>)

Registers services required by authentication services and configures AuthenticationOptions.

AddAuthentication(IServiceCollection, Action<SharedAuthenticationOptions>)

Adds authentication services to the specified IServiceCollection.

AddAuthentication(IServiceCollection, String)

Registers services required by authentication services. defaultScheme specifies the name of the scheme to use by default when a specific scheme isn't requested.

AddAuthentication(IServiceCollection)

Registers services required by authentication services.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ AddAuthentication(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services);
public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Authentication::AuthenticationBuilder ^ AddAuthentication(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services);
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

Parameters

Returns

IServiceCollection
AuthenticationBuilder

A AuthenticationBuilder that can be used to further configure authentication.

Applies to

AddAuthentication(IServiceCollection, Action<AuthenticationOptions>)

Registers services required by authentication services and configures AuthenticationOptions.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Authentication::AuthenticationBuilder ^ AddAuthentication(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Action<Microsoft::AspNetCore::Authentication::AuthenticationOptions ^> ^ configureOptions);
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

Parameters

configureOptions
Action<AuthenticationOptions>

A delegate to configure AuthenticationOptions.

Returns

AuthenticationBuilder

A AuthenticationBuilder that can be used to further configure authentication.

Applies to

AddAuthentication(IServiceCollection, Action<SharedAuthenticationOptions>)

Adds authentication services to the specified IServiceCollection.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ AddAuthentication(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Action<Microsoft::AspNetCore::Authentication::SharedAuthenticationOptions ^> ^ configureOptions);
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

Parameters

services
IServiceCollection

The IServiceCollection to add services to.

configureOptions
Action<SharedAuthenticationOptions>

An action delegate to configure the provided SharedAuthenticationOptions.

Returns

IServiceCollection

The IServiceCollection so that additional calls can be chained.

Applies to

AddAuthentication(IServiceCollection, String)

Registers services required by authentication services. defaultScheme specifies the name of the scheme to use by default when a specific scheme isn't requested.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Authentication::AuthenticationBuilder ^ AddAuthentication(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, System::String ^ 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

Parameters

defaultScheme
String

The default scheme used as a fallback for all other schemes.

Returns

AuthenticationBuilder

A AuthenticationBuilder that can be used to further configure authentication.

Applies to