Class MicrosoftIdentityWebApiServiceCollectionExtensions
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
IServiceCollectionService collection to which to add authentication.
configuration
IConfigurationThe Configuration object.
configSectionName
stringThe configuration section with the necessary settings to initialize authentication options.
jwtBearerScheme
stringThe JwtBearer scheme name to be used. By default it uses "Bearer".
subscribeToJwtBearerMiddlewareDiagnosticsEvents
boolSet to true if you want to debug, or just understand the JwtBearer events.
Returns
- MicrosoftIdentityWebApiAuthenticationBuilderWithConfiguration
The authentication builder to chain extension methods.