using MediatR.Behaviors.Authorization; using MediatR.Behaviors.Authorization.Interfaces; using ExpenseTracker.Application.Common.Exceptions; namespace ExpenseTracker.Application.Common.Authorization; public class CustomUnauthorizedResultHandler : IUnauthorizedResultHandler { public Task Invoke(AuthorizationResult result) { throw new ForbiddenException(result.FailureMessage); } }