Class ValidateResourcesRightMiddlewareExtension
- Namespace
- Arc4u.OAuth2.Middleware
- Assembly
- Arc4u.OAuth2.AspNetCore.dll
Adds the ValidateResourcesRightMiddleware.
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
appIApplicationBuilderThe application builder.
optionsAction<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
appIApplicationBuilderThe application builder.
sectionNamestringThe section, bound to ValidateResourcesRightMiddlewareOptions. The default is
Authentication:ResourcesRights.
Returns
- IApplicationBuilder
The application builder, to chain calls.
Examples
app.UseAuthentication();
app.UseResourcesRightValidationFor();
Exceptions
- ArgumentNullException
appis null orsectionNameis empty.- ConfigurationException
The section does not exist, a resource has no path or no policy, or the default content is empty.