Table of Contents

Class ValidateResourcesRightMiddlewareExtension

Namespace
Arc4u.OAuth2.Middleware
Assembly
Arc4u.OAuth2.AspNetCore.dll
public static class ValidateResourcesRightMiddlewareExtension
Inheritance
ValidateResourcesRightMiddlewareExtension
Inherited Members

Methods

UseResourcesRightValidationFor(IApplicationBuilder, Action<ValidateResourcesRightMiddlewareOptions>)

Adds the ValidateResourcesRightMiddleware to the request pipeline from code. The middleware is not added when no resource is configured.

public static IApplicationBuilder UseResourcesRightValidationFor(this IApplicationBuilder app, Action<ValidateResourcesRightMiddlewareOptions> options)

Parameters

app IApplicationBuilder

The application builder.

options Action<ValidateResourcesRightMiddlewareOptions>

The action that configures the protected resources.

Returns

IApplicationBuilder

The application builder, to chain calls.

Exceptions

ArgumentNullException

An argument is null.

ConfigurationException

A resource has no path or no policy, or the default content is empty.

UseResourcesRightValidationFor(IApplicationBuilder, string)

Adds the ValidateResourcesRightMiddleware to the request pipeline from a configuration section. Nothing is added when the section defines no resource.

public static IApplicationBuilder UseResourcesRightValidationFor(this IApplicationBuilder app, string sectionName = "Authentication:ResourcesRights")

Parameters

app IApplicationBuilder

The application builder.

sectionName string

The section, bound to ValidateResourcesRightMiddlewareOptions. The default is Authentication:ResourcesRights.

Returns

IApplicationBuilder

The application builder, to chain calls.

Examples

app.UseAuthentication();
app.UseResourcesRightValidationFor();

Exceptions

ArgumentNullException

app is null or sectionName is empty.

ConfigurationException

The section does not exist, a resource has no path or no policy, or the default content is empty.