classlib/ExpenseTracker.Application/Common/Authorization/CustomUnAuthorizedResultHandler.cs
2024-08-07 21:12:02 +03:00

14 lines
450 B
C#

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<TResponse> Invoke<TResponse>(AuthorizationResult result)
{
throw new ForbiddenException(result.FailureMessage);
}
}