Class OpenIdBearerInjectorMiddleware
- Namespace
- Arc4u.OAuth2.Middleware
- Assembly
- Arc4u.OAuth2.AspNetCore.dll
A middleware that gives a bearer token to requests authenticated with the OpenID Connect (cookie) authentication, so the token can be used by the code that reads the Authorization header.
The token is requested from the on-behalf-of provider when on-behalf-of settings exist, otherwise from the provider of the OpenID settings. The header is replaced by Bearer <token>
and the token is stored in the BootstrapContext. The culture of the principal profile is added to the request in the culture header.
public class OpenIdBearerInjectorMiddleware
- Inheritance
-
OpenIdBearerInjectorMiddleware
- Inherited Members
Constructors
OpenIdBearerInjectorMiddleware(RequestDelegate, IOptionsMonitor<OpenIdBearerInjectorSettingsOptions>)
Initializes a new instance of the OpenIdBearerInjectorMiddleware class.
public OpenIdBearerInjectorMiddleware(RequestDelegate next, IOptionsMonitor<OpenIdBearerInjectorSettingsOptions> options)
Parameters
nextRequestDelegateThe next middleware of the pipeline.
optionsIOptionsMonitor<OpenIdBearerInjectorSettingsOptions>The settings of the injector.
Exceptions
- ConfigurationException
The options have no current value.
- ArgumentNullException
nextis null.
Methods
InvokeAsync(HttpContext, IActivitySourceFactory, ILogger<OpenIdBearerInjectorMiddleware>)
Processes the request.
public Task InvokeAsync(HttpContext context, IActivitySourceFactory activitySourceFactory, ILogger<OpenIdBearerInjectorMiddleware> logger)
Parameters
contextHttpContextThe HTTP context.
activitySourceFactoryIActivitySourceFactoryThe factory of the activity source used for telemetry.
loggerILogger<OpenIdBearerInjectorMiddleware>The logger.
Returns
- Task
A task that completes when the rest of the pipeline is done.
Exceptions
- ArgumentNullException
contextis null.