Interface IResourceOperationRegistry
- Namespace
- Htmx.Components.Authorization
- Assembly
- Htmx.Components.dll
Ensures that given resource and operation combinations are registered with the authorization system.
public interface IResourceOperationRegistry
- Extension Methods
Examples
public class DatabaseResourceOperationRegistry : IResourceOperationRegistry
{
public async Task Register(string resource, string operation)
{
// Ensure the resource-operation combination exists in database
await _context.ResourceOperations.AddIfNotExistsAsync(resource, operation);
}
}
Remarks
This interface is used during model handler registration to ensure that all required authorization policies or requirements are properly configured before they are needed during runtime authorization checks.
Methods
Register(string, string)
Registers a resource and operation combination with the authorization system.
Task Register(string resource, string operation)
Parameters
resource
stringThe resource being registered (e.g., "users", "orders").
operation
stringThe operation being registered (e.g., "read", "create", "update", "delete").
Returns
- Task
A task that represents the asynchronous registration operation.
Exceptions
- ArgumentNullException
Thrown when
resource
oroperation
is null.