Table of Contents

Class MicrosoftIdentityWebApiAuthenticationBuilderExtensions

Namespace
Microsoft.Identity.Web
Assembly
Microsoft.Identity.Web.dll

Extensions for AuthenticationBuilder for startup initialization of web APIs.

public static class MicrosoftIdentityWebApiAuthenticationBuilderExtensions
Inheritance
MicrosoftIdentityWebApiAuthenticationBuilderExtensions
Inherited Members

Methods

AddMicrosoftIdentityWebApi(AuthenticationBuilder, IConfiguration, string, string, bool)

Protects the web API with Microsoft identity platform (formerly Azure AD v2.0). This method expects the configuration file will have a section, named "AzureAd" as default, with the necessary settings to initialize authentication options.

public static MicrosoftIdentityWebApiAuthenticationBuilderWithConfiguration AddMicrosoftIdentityWebApi(this AuthenticationBuilder builder, IConfiguration configuration, string configSectionName = "AzureAd", string jwtBearerScheme = "Bearer", bool subscribeToJwtBearerMiddlewareDiagnosticsEvents = false)

Parameters

builder AuthenticationBuilder

The AuthenticationBuilder to which to add this configuration.

configuration IConfiguration

The configuration instance.

configSectionName string

The configuration section with the necessary settings to initialize authentication options.

jwtBearerScheme string

The JWT bearer scheme name to be used. By default it uses "Bearer".

subscribeToJwtBearerMiddlewareDiagnosticsEvents bool

Set to true if you want to debug, or just understand the JWT bearer events.

Returns

MicrosoftIdentityWebApiAuthenticationBuilderWithConfiguration

The authentication builder to chain.

AddMicrosoftIdentityWebApi(AuthenticationBuilder, IConfigurationSection, string, bool)

Protects the web API with Microsoft identity platform (formerly Azure AD v2.0). This method expects the configuration file will have a section, named "AzureAd" as default, with the necessary settings to initialize authentication options.

public static MicrosoftIdentityWebApiAuthenticationBuilderWithConfiguration AddMicrosoftIdentityWebApi(this AuthenticationBuilder builder, IConfigurationSection configurationSection, string jwtBearerScheme = "Bearer", bool subscribeToJwtBearerMiddlewareDiagnosticsEvents = false)

Parameters

builder AuthenticationBuilder

The AuthenticationBuilder to which to add this configuration.

configurationSection IConfigurationSection

The configuration second from which to fill-in the options.

jwtBearerScheme string

The JWT bearer scheme name to be used. By default it uses "Bearer".

subscribeToJwtBearerMiddlewareDiagnosticsEvents bool

Set to true if you want to debug, or just understand the JWT bearer events.

Returns

MicrosoftIdentityWebApiAuthenticationBuilderWithConfiguration

The authentication builder to chain.

AddMicrosoftIdentityWebApi(AuthenticationBuilder, Action<JwtBearerOptions>, Action<MicrosoftIdentityOptions>, string, bool)

Protects the web API with Microsoft identity platform (formerly Azure AD v2.0).

public static MicrosoftIdentityWebApiAuthenticationBuilder AddMicrosoftIdentityWebApi(this AuthenticationBuilder builder, Action<JwtBearerOptions> configureJwtBearerOptions, Action<MicrosoftIdentityOptions> configureMicrosoftIdentityOptions, string jwtBearerScheme = "Bearer", bool subscribeToJwtBearerMiddlewareDiagnosticsEvents = false)

Parameters

builder AuthenticationBuilder

The AuthenticationBuilder to which to add this configuration.

configureJwtBearerOptions Action<JwtBearerOptions>

The action to configure Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerOptions.

configureMicrosoftIdentityOptions Action<MicrosoftIdentityOptions>

The action to configure the Microsoft.Identity.Web.MicrosoftIdentityOptions.

jwtBearerScheme string

The JWT bearer scheme name to be used. By default it uses "Bearer".

subscribeToJwtBearerMiddlewareDiagnosticsEvents bool

Set to true if you want to debug, or just understand the JWT bearer events.

Returns

MicrosoftIdentityWebApiAuthenticationBuilder

The authentication builder to chain.