diff --git a/backend/src/Equinor.ProjectExecutionPortal.WebApi/Authorization/Extensions/AuthorizationServiceExtensions.cs b/backend/src/Equinor.ProjectExecutionPortal.WebApi/Authorization/Extensions/AuthorizationServiceExtensions.cs deleted file mode 100644 index 7f62318e..00000000 --- a/backend/src/Equinor.ProjectExecutionPortal.WebApi/Authorization/Extensions/AuthorizationServiceExtensions.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Microsoft.AspNetCore.Authorization; -using System.Security.Claims; - -namespace Equinor.ProjectExecutionPortal.WebApi.Authorization.Extensions -{ - public static class AuthorizationServiceExtensions - { - public static async Task RequireAuthorizationAsync(this IAuthorizationService authorizationService, ClaimsPrincipal user, object? resource, string policy) - { - var result = await authorizationService.AuthorizeAsync(user, resource, policy); - - if (!result.Succeeded) - { - throw new UnauthorizedAccessException("User is not authorized"); - } - } - } -} diff --git a/backend/src/Equinor.ProjectExecutionPortal.WebApi/Authorization/Policies.cs b/backend/src/Equinor.ProjectExecutionPortal.WebApi/Authorization/Policies.cs deleted file mode 100644 index 8cab161b..00000000 --- a/backend/src/Equinor.ProjectExecutionPortal.WebApi/Authorization/Policies.cs +++ /dev/null @@ -1,16 +0,0 @@ -public static class Policies -{ - public static class ProjectPortal - { - public const string Admin = "ProjectPortal.Admin"; - - public static class Portal - { - public const string List = "ProjectPortal.Portal.List"; - public const string Read = "ProjectPortal.Portal.Read"; - public const string Create = "ProjectPortal.Portal.Create"; - public const string Update = "ProjectPortal.Portal.Update"; - public const string Delete = "ProjectPortal.Portal.Delete"; - } - } -}