Class ForceOpenIdMiddleWareOptionsExtension
- Namespace
- Arc4u.OAuth2.Middleware
- Assembly
- Arc4u.OAuth2.AspNetCore.dll
Registers and adds the ForceOpenIdMiddleWare.
public static class ForceOpenIdMiddleWareOptionsExtension
- Inheritance
-
ForceOpenIdMiddleWareOptionsExtension
- Inherited Members
Methods
AddForceOpenId(IServiceCollection, IConfiguration, string)
Registers the ForceOpenIdMiddleWareOptions from a configuration section.
public static IServiceCollection AddForceOpenId(this IServiceCollection services, IConfiguration configuration, string sectionName = "Authentication:ClaimsMiddleWare:ForceOpenId")
Parameters
servicesIServiceCollectionThe service collection.
configurationIConfigurationThe configuration.
sectionNamestringThe section to bind. The default is
Authentication:ClaimsMiddleWare:ForceOpenId.
Returns
- IServiceCollection
The service collection, to chain calls.
Examples
builder.Services.AddForceOpenId(builder.Configuration);
Exceptions
- ArgumentNullException
An argument is null.
AddForceOpenId(IServiceCollection, Action<ForceOpenIdMiddleWareOptions>)
Registers the ForceOpenIdMiddleWareOptions from code.
public static IServiceCollection AddForceOpenId(this IServiceCollection services, Action<ForceOpenIdMiddleWareOptions> configureOptions)
Parameters
servicesIServiceCollectionThe service collection.
configureOptionsAction<ForceOpenIdMiddleWareOptions>The action that configures the options.
Returns
- IServiceCollection
The service collection, to chain calls.
Examples
builder.Services.AddForceOpenId(options =>
{
options.ForceAuthenticationForPaths.Add("/swagger*");
});
Exceptions
- ArgumentNullException
An argument is null.
UseForceOpenId(IApplicationBuilder)
Adds the ForceOpenIdMiddleWare to the request pipeline. Call it after the authentication middleware.
public static IApplicationBuilder UseForceOpenId(this IApplicationBuilder app)
Parameters
appIApplicationBuilderThe application builder.
Returns
- IApplicationBuilder
The application builder, to chain calls.
Exceptions
- ArgumentNullException
appis null.