Table of Contents

Class ServiceCollectionExtensions

Namespace
Auth0.AspNetCore.Authentication.Api
Assembly
Auth0.AspNetCore.Authentication.Api.dll

Contains IServiceCollection extension(s) for registering Auth0.

public static class ServiceCollectionExtensions
Inheritance
ServiceCollectionExtensions
Inherited Members

Methods

AddAuth0ApiAuthentication(IServiceCollection, IConfigurationSection, Action<JwtBearerOptions>?)

Adds Auth0 API authentication using configuration from an IConfigurationSection. This is the recommended approach as it supports appsettings.json, environment variables, and other configuration providers out of the box.

public static Auth0ApiAuthenticationBuilder AddAuth0ApiAuthentication(this IServiceCollection services, IConfigurationSection configurationSection, Action<JwtBearerOptions>? configureJwtBearer = null)

Parameters

services IServiceCollection

The service collection to add authentication to.

configurationSection IConfigurationSection

The configuration section containing Auth0 settings (Domain and Audience).

configureJwtBearer Action<JwtBearerOptions>

An optional action to further configure the underlying JwtBearerOptions.

Returns

Auth0ApiAuthenticationBuilder

An Auth0ApiAuthenticationBuilder for further configuration.

AddAuth0ApiAuthentication(IServiceCollection, Action<Auth0ApiOptions>, Action<JwtBearerOptions>?)

Adds Auth0 API authentication using a delegate to configure options programmatically.

public static Auth0ApiAuthenticationBuilder AddAuth0ApiAuthentication(this IServiceCollection services, Action<Auth0ApiOptions> configureOptions, Action<JwtBearerOptions>? configureJwtBearer = null)

Parameters

services IServiceCollection

The service collection to add authentication to.

configureOptions Action<Auth0ApiOptions>

An action to configure the Auth0ApiOptions.

configureJwtBearer Action<JwtBearerOptions>

An optional action to further configure the underlying JwtBearerOptions.

Returns

Auth0ApiAuthenticationBuilder

An Auth0ApiAuthenticationBuilder for further configuration.

AddAuth0ApiAuthentication(IServiceCollection, string, IConfigurationSection, Action<JwtBearerOptions>?)

Adds Auth0 API authentication using configuration from an IConfigurationSection with a custom authentication scheme.

public static Auth0ApiAuthenticationBuilder AddAuth0ApiAuthentication(this IServiceCollection services, string authenticationScheme, IConfigurationSection configurationSection, Action<JwtBearerOptions>? configureJwtBearer = null)

Parameters

services IServiceCollection

The service collection to add authentication to.

authenticationScheme string

The authentication scheme to use.

configurationSection IConfigurationSection

The configuration section containing Auth0 settings (Domain and Audience).

configureJwtBearer Action<JwtBearerOptions>

An optional action to further configure the underlying JwtBearerOptions.

Returns

Auth0ApiAuthenticationBuilder

An Auth0ApiAuthenticationBuilder for further configuration.

AddAuth0ApiAuthentication(IServiceCollection, string, Action<Auth0ApiOptions>, Action<JwtBearerOptions>?)

Adds Auth0 API authentication using a delegate to configure options programmatically with a custom authentication scheme.

public static Auth0ApiAuthenticationBuilder AddAuth0ApiAuthentication(this IServiceCollection services, string authenticationScheme, Action<Auth0ApiOptions> configureOptions, Action<JwtBearerOptions>? configureJwtBearer = null)

Parameters

services IServiceCollection

The service collection to add authentication to.

authenticationScheme string

The authentication scheme to use.

configureOptions Action<Auth0ApiOptions>

An action to configure the Auth0ApiOptions.

configureJwtBearer Action<JwtBearerOptions>

An optional action to further configure the underlying JwtBearerOptions.

Returns

Auth0ApiAuthenticationBuilder

An Auth0ApiAuthenticationBuilder for further configuration.