http-api/src/Application/Authentication/Commands/RevokeRefreshToken/RevokeRefreshTokenCommandAuthorizer.cs
2025-04-29 23:51:19 +03:00

25 lines
802 B
C#

using cuqmbr.TravelGuide.Application.Common.Authorization;
using cuqmbr.TravelGuide.Application.Common.Interfaces.Services;
using MediatR.Behaviors.Authorization;
namespace cuqmbr.TravelGuide.Application.Authenticaion.Commands.RevokeRefreshToken;
public class RevokeRefreshTokenCommandAuthorizer :
AbstractRequestAuthorizer<RevokeRefreshTokenCommand>
{
private readonly SessionUserService _sessionUserService;
public RevokeRefreshTokenCommandAuthorizer(SessionUserService currentUserService)
{
_sessionUserService = currentUserService;
}
public override void BuildPolicy(RevokeRefreshTokenCommand request)
{
UseRequirement(new MustBeAuthenticatedRequirement
{
IsAuthenticated = _sessionUserService.IsAuthenticated
});
}
}