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
servicesIServiceCollectionThe service collection to add authentication to.
configurationSectionIConfigurationSectionThe configuration section containing Auth0 settings (Domain and Audience).
configureJwtBearerAction<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
servicesIServiceCollectionThe service collection to add authentication to.
configureOptionsAction<Auth0ApiOptions>An action to configure the Auth0ApiOptions.
configureJwtBearerAction<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
servicesIServiceCollectionThe service collection to add authentication to.
authenticationSchemestringThe authentication scheme to use.
configurationSectionIConfigurationSectionThe configuration section containing Auth0 settings (Domain and Audience).
configureJwtBearerAction<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
servicesIServiceCollectionThe service collection to add authentication to.
authenticationSchemestringThe authentication scheme to use.
configureOptionsAction<Auth0ApiOptions>An action to configure the Auth0ApiOptions.
configureJwtBearerAction<JwtBearerOptions>An optional action to further configure the underlying JwtBearerOptions.
Returns
- Auth0ApiAuthenticationBuilder
An Auth0ApiAuthenticationBuilder for further configuration.