Share via


MicrosoftIdentityWebApiServiceCollectionExtensions.AddMicrosoftIdentityWebApiAuthentication Method

Definition

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 Microsoft.Identity.Web.MicrosoftIdentityWebApiAuthenticationBuilderWithConfiguration AddMicrosoftIdentityWebApiAuthentication (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Microsoft.Extensions.Configuration.IConfiguration configuration, string configSectionName = "AzureAd", string jwtBearerScheme = "Bearer", bool subscribeToJwtBearerMiddlewareDiagnosticsEvents = false);
static member AddMicrosoftIdentityWebApiAuthentication : Microsoft.Extensions.DependencyInjection.IServiceCollection * Microsoft.Extensions.Configuration.IConfiguration * string * string * bool -> Microsoft.Identity.Web.MicrosoftIdentityWebApiAuthenticationBuilderWithConfiguration
<Extension()>
Public Function AddMicrosoftIdentityWebApiAuthentication (services As IServiceCollection, configuration As IConfiguration, Optional configSectionName As String = "AzureAd", Optional jwtBearerScheme As String = "Bearer", Optional subscribeToJwtBearerMiddlewareDiagnosticsEvents As Boolean = false) As MicrosoftIdentityWebApiAuthenticationBuilderWithConfiguration

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
Boolean

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

Returns

The authentication builder to chain extension methods.

Applies to