Table of Contents

Interface IAuthorizationMetadataService

Namespace
Htmx.Components.Services
Assembly
Htmx.Components.dll

Provides services for extracting and evaluating authorization metadata from controller actions.

public interface IAuthorizationMetadataService
Extension Methods

Remarks

This service caches authorization metadata and authorization results to improve performance when checking user permissions for controller actions repeatedly.

Methods

GetMetadataAsync(ControllerActionDescriptor)

Extracts authorization metadata from a controller action descriptor.

Task<AuthorizationMetadata> GetMetadataAsync(ControllerActionDescriptor descriptor)

Parameters

descriptor ControllerActionDescriptor

The controller action descriptor to analyze.

Returns

Task<AuthorizationMetadata>

A task that represents the asynchronous operation. The task result contains the authorization metadata.

IsAuthorizedAsync(ControllerActionDescriptor, ClaimsPrincipal)

Determines whether the specified user is authorized to access the controller action.

Task<bool> IsAuthorizedAsync(ControllerActionDescriptor descriptor, ClaimsPrincipal user)

Parameters

descriptor ControllerActionDescriptor

The controller action descriptor to check authorization for.

user ClaimsPrincipal

The claims principal representing the user.

Returns

Task<bool>

A task that represents the asynchronous operation. The task result is true if the user is authorized; otherwise, false.