Class RequiredScopeExtensions
Extensions for building the required scope attribute during application startup.
public static class RequiredScopeExtensions
- Inheritance
-
RequiredScopeExtensions
- Inherited Members
Methods
AddRequiredScopeAuthorization(IServiceCollection)
This method adds support for the required scope attribute. It adds a default policy that adds a scope requirement. This requirement looks for IAuthRequiredScopeMetadata on the current endpoint.
public static IServiceCollection AddRequiredScopeAuthorization(this IServiceCollection services)
Parameters
services
IServiceCollectionThe services being configured.
Returns
- IServiceCollection
Services.
RequireScope<TBuilder>(TBuilder, params string[])
This method adds metadata to route endpoint to describe required scopes. It's the imperative version of the [RequiredScope] attribute.
public static TBuilder RequireScope<TBuilder>(this TBuilder endpointConventionBuilder, params string[] scope) where TBuilder : IEndpointConventionBuilder
Parameters
endpointConventionBuilder
TBuilderTo customize the endpoints.
scope
string[]Scope.
Returns
- TBuilder
Builder.
Type Parameters
TBuilder
Class implementing IEndpointConventionBuilder.