Table of Contents

Class MicrosoftIdentityWebApiServiceCollectionExtensions

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

Extension for IServiceCollection for startup initialization of web APIs.

public static class MicrosoftIdentityWebApiServiceCollectionExtensions
Inheritance
MicrosoftIdentityWebApiServiceCollectionExtensions
Inherited Members

Methods

AddMicrosoftIdentityWebApiAuthentication(IServiceCollection, 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 AddMicrosoftIdentityWebApiAuthentication(this IServiceCollection services, IConfiguration configuration, string configSectionName = "AzureAd", string jwtBearerScheme = "Bearer", bool subscribeToJwtBearerMiddlewareDiagnosticsEvents = false)

Parameters

services IServiceCollection

Service collection to which to add authentication.

configuration IConfiguration

The Configuration object.

configSectionName string

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

jwtBearerScheme string

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

subscribeToJwtBearerMiddlewareDiagnosticsEvents bool

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

Returns

MicrosoftIdentityWebApiAuthenticationBuilderWithConfiguration

The authentication builder to chain extension methods.