Table of Contents

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

next RequestDelegate

The next middleware of the pipeline.

options IOptionsMonitor<OpenIdBearerInjectorSettingsOptions>

The settings of the injector.

Exceptions

ConfigurationException

The options have no current value.

ArgumentNullException

next is null.

Methods

InvokeAsync(HttpContext, IActivitySourceFactory, ILogger<OpenIdBearerInjectorMiddleware>)

Processes the request.

public Task InvokeAsync(HttpContext context, IActivitySourceFactory activitySourceFactory, ILogger<OpenIdBearerInjectorMiddleware> logger)

Parameters

context HttpContext

The HTTP context.

activitySourceFactory IActivitySourceFactory

The factory of the activity source used for telemetry.

logger ILogger<OpenIdBearerInjectorMiddleware>

The logger.

Returns

Task

A task that completes when the rest of the pipeline is done.

Exceptions

ArgumentNullException

context is null.