Share via


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>)
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)

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

Registers services required by authentication 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);

Parameters

Returns

A AuthenticationBuilder that can be used to further configure authentication.

Applies to

AddAuthentication(IServiceCollection, Action<AuthenticationOptions>)

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

Registers services required by authentication services and configures AuthenticationOptions.

public static Microsoft.AspNetCore.Authentication.AuthenticationBuilder AddAuthentication(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Action<Microsoft.AspNetCore.Authentication.AuthenticationOptions> configureOptions);

Parameters

configureOptions
Action<AuthenticationOptions>

A delegate to configure AuthenticationOptions.

Returns

A AuthenticationBuilder that can be used to further configure authentication.

Applies to

AddAuthentication(IServiceCollection, Action<SharedAuthenticationOptions>)

public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddAuthentication(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Action<Microsoft.AspNetCore.Authentication.SharedAuthenticationOptions> configureOptions);

Parameters

Returns

Applies to

AddAuthentication(IServiceCollection, String)

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

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 static Microsoft.AspNetCore.Authentication.AuthenticationBuilder AddAuthentication(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, string defaultScheme);

Parameters

defaultScheme
String

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

Returns

A AuthenticationBuilder that can be used to further configure authentication.

Applies to