Partager via


MicrosoftIdentityWebAppServiceCollectionExtensions.AddMicrosoftIdentityWebAppAuthentication Method

Definition

Add authentication with Microsoft identity platform. This method expects the configuration file will have a section, (by default named "AzureAd"), with the necessary settings to initialize the authentication options.

public static Microsoft.Identity.Web.MicrosoftIdentityWebAppAuthenticationBuilderWithConfiguration AddMicrosoftIdentityWebAppAuthentication (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Microsoft.Extensions.Configuration.IConfiguration configuration, string configSectionName = "AzureAd", string openIdConnectScheme = "OpenIdConnect", string cookieScheme = "Cookies", bool subscribeToOpenIdConnectMiddlewareDiagnosticsEvents = false, string? displayName = default);
static member AddMicrosoftIdentityWebAppAuthentication : Microsoft.Extensions.DependencyInjection.IServiceCollection * Microsoft.Extensions.Configuration.IConfiguration * string * string * string * bool * string -> Microsoft.Identity.Web.MicrosoftIdentityWebAppAuthenticationBuilderWithConfiguration
<Extension()>
Public Function AddMicrosoftIdentityWebAppAuthentication (services As IServiceCollection, configuration As IConfiguration, Optional configSectionName As String = "AzureAd", Optional openIdConnectScheme As String = "OpenIdConnect", Optional cookieScheme As String = "Cookies", Optional subscribeToOpenIdConnectMiddlewareDiagnosticsEvents As Boolean = false, Optional displayName As String = Nothing) As MicrosoftIdentityWebAppAuthenticationBuilderWithConfiguration

Parameters

services
IServiceCollection

Service collection to which to add authentication.

configuration
IConfiguration

The IConfiguration object.

configSectionName
String

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

openIdConnectScheme
String

Optional name for the open id connect authentication scheme (by default OpenIdConnectDefaults.AuthenticationScheme). This can be specified when you want to support several OpenIdConnect identity providers.

cookieScheme
String

Optional name for the cookie authentication scheme (by default CookieAuthenticationDefaults.AuthenticationScheme).

subscribeToOpenIdConnectMiddlewareDiagnosticsEvents
Boolean

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

displayName
String

A display name for the authentication handler.

Returns

The authentication builder to chain extension methods.

Applies to