From 02487b345c8c520b84948049c122189de2007897 Mon Sep 17 00:00:00 2001 From: Matthias Gernand Date: Wed, 14 Feb 2024 14:58:49 +0100 Subject: [PATCH] Added ability to create custom permission attributes. (#39) --- AspNetCore.Authorization.Permissions.sln | 7 ++- .../MongoSamplePermissions/InvoicesContext.cs | 2 +- .../Pages/InvoiceDelete.cshtml.cs | 3 +- samples/MongoSamplePermissions/Program.cs | 1 + ...RequireInvoiceDeletePermissionAttribute.cs | 17 +++++++ samples/MongoSampleTenant/InvoicesContext.cs | 2 +- .../Pages/InvoiceDelete.cshtml.cs | 2 +- samples/MongoSampleTenant/Program.cs | 2 +- ...RequireInvoiceDeletePermissionAttribute.cs | 17 +++++++ samples/SamplePermissions/InvoicesContext.cs | 2 +- .../Pages/InvoiceDelete.cshtml.cs | 3 +- samples/SamplePermissions/Program.cs | 2 + ...RequireInvoiceDeletePermissionAttribute.cs | 17 +++++++ samples/SampleTenant/InvoicesContext.cs | 2 +- .../Pages/InvoiceDelete.cshtml.cs | 2 +- .../Pages/Shared/_LoginPartial.cshtml | 2 +- samples/SampleTenant/Program.cs | 2 + ...RequireInvoiceDeletePermissionAttribute.cs | 17 +++++++ ...horization.Permissions.Abstractions.csproj | 22 --------- ...spNetCore.Authorization.Permissions.csproj | 26 ----------- .../HasPermissionAttribute.cs | 45 ------------------- ...sionEndpointConventionBuilderExtensions.cs | 10 +++-- .../RequirePermissionAttribute.cs | 2 +- ...ity.Permissions.EntityFrameworkCore.csproj | 26 ----------- .../Permissions/PermissionConfiguration.cs | 1 + .../RolePermissionConfiguration.cs | 1 + .../Permissions/TenantConfiguration.cs | 1 + .../Permissions/TenantRoleConfiguration.cs | 1 + .../UserBelongsToTenantConfiguration.cs | 1 + .../IdentityBuilderExtensions.cs | 2 + .../ModelBuilderExtensions.cs | 1 + .../PermissionStore.cs | 2 + .../TenantStore.cs | 2 + ...etCore.Identity.Permissions.MongoDB.csproj | 26 ----------- .../IdentityBuilderExtensions.cs | 1 + .../MongoIdentityPermission.cs | 1 + .../MongoIdentityTenant.cs | 1 + .../MongoIdentityTenantUser.cs | 1 + .../PermissionStore.cs | 2 + .../TenantStore.cs | 2 + .../AspNetCore.Identity.Permissions.csproj | 26 ----------- .../AspNetPermissionManager.cs | 1 + .../AspNetTenantManager.cs | 1 + .../IdentityBuilderExtensions.cs | 1 + .../PermissionClaimsProvider.cs | 1 + .../PermissionClaimsProviderBase.cs | 1 + src/Directory.Build.props | 45 +++++++++++++++++++ ...xtensions.Identity.Permissions.Core.csproj | 24 +--------- .../IPermissionStore.cs | 2 +- .../IPermissionValidator.cs | 2 +- .../IQueryablePermissionStore.cs | 2 +- .../IQueryableTenantStore.cs | 2 +- .../IRolePermissionStore.cs | 2 +- .../ITenantRoleStore.cs | 2 +- .../ITenantStore.cs | 2 +- .../ITenantValidator.cs | 2 +- .../IdentityBuilderExtensions.cs | 2 +- .../LoggerEventIds.cs | 2 +- .../PermissionIdentityBuilder.cs | 2 +- .../PermissionIdentityErrorDescriber.cs | 8 ++-- .../PermissionManager.cs | 2 +- .../PermissionUserClaimsPrincipalFactory.cs | 2 +- .../PermissionValidator.cs | 2 +- .../Properties/Resources.Designer.cs | 4 +- .../ServiceCollectionExtensions.cs | 2 +- .../TenantManager.cs | 2 +- .../TenantValidator.cs | 2 +- .../UserManagerExtensions.cs | 8 ++-- .../UserStoreExtensions.cs | 2 +- ...ensions.Identity.Permissions.Stores.csproj | 26 ----------- .../ITenantUser.cs | 2 +- .../IdentityPermission.cs | 2 +- .../IdentityRolePermission.cs | 2 +- .../IdentityTenant.cs | 2 +- .../IdentityTenantRole.cs | 2 +- .../IdentityTenantUser.cs | 2 +- .../PermissionStoreBase.cs | 3 +- .../TenantStoreBase.cs | 3 +- 78 files changed, 205 insertions(+), 274 deletions(-) create mode 100644 samples/MongoSamplePermissions/RequireInvoiceDeletePermissionAttribute.cs create mode 100644 samples/MongoSampleTenant/RequireInvoiceDeletePermissionAttribute.cs create mode 100644 samples/SamplePermissions/RequireInvoiceDeletePermissionAttribute.cs create mode 100644 samples/SampleTenant/RequireInvoiceDeletePermissionAttribute.cs delete mode 100644 src/AspNetCore.Authorization.Permissions/HasPermissionAttribute.cs create mode 100644 src/Directory.Build.props diff --git a/AspNetCore.Authorization.Permissions.sln b/AspNetCore.Authorization.Permissions.sln index 8678a2b..4853032 100644 --- a/AspNetCore.Authorization.Permissions.sln +++ b/AspNetCore.Authorization.Permissions.sln @@ -11,6 +11,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".items", ".items", "{241433 EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{EDEC7D8F-4C6F-4DE3-8022-17A2A23AB18B}" + ProjectSection(SolutionItems) = preProject + src\Directory.Build.props = src\Directory.Build.props + EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{24F9EFE8-010B-48D9-B5D2-EF194BDEAC31}" EndProject @@ -44,9 +47,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MongoSamplePermissions", "s EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MongoSampleTenant", "samples\MongoSampleTenant\MongoSampleTenant.csproj", "{B7172410-2A68-4DB9-9538-036C8FFC7DE4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AspNetCore.Identity.Permissions.MongoDB.IntegrationTests", "tests\AspNetCore.Identity.Permissions.MongoDB.IntegrationTests\AspNetCore.Identity.Permissions.MongoDB.IntegrationTests.csproj", "{61ADF77F-B1DB-4489-AD46-DD6956605D41}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspNetCore.Identity.Permissions.MongoDB.IntegrationTests", "tests\AspNetCore.Identity.Permissions.MongoDB.IntegrationTests\AspNetCore.Identity.Permissions.MongoDB.IntegrationTests.csproj", "{61ADF77F-B1DB-4489-AD46-DD6956605D41}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AspNetCore.Identity.Permissions.EntityFrameworkCore.IntegrationTests", "tests\AspNetCore.Identity.Permissions.EntityFrameworkCore.IntegrationTests\AspNetCore.Identity.Permissions.EntityFrameworkCore.IntegrationTests.csproj", "{637FE076-7CDE-49B1-BB14-1A6CE85382A8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspNetCore.Identity.Permissions.EntityFrameworkCore.IntegrationTests", "tests\AspNetCore.Identity.Permissions.EntityFrameworkCore.IntegrationTests\AspNetCore.Identity.Permissions.EntityFrameworkCore.IntegrationTests.csproj", "{637FE076-7CDE-49B1-BB14-1A6CE85382A8}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/samples/MongoSamplePermissions/InvoicesContext.cs b/samples/MongoSamplePermissions/InvoicesContext.cs index 15f7c95..2624c8c 100644 --- a/samples/MongoSamplePermissions/InvoicesContext.cs +++ b/samples/MongoSamplePermissions/InvoicesContext.cs @@ -1,7 +1,7 @@ namespace MongoSamplePermissions { using System; - using MadEyeMatt.AspNetCore.Identity.Permissions; + using MadEyeMatt.Extensions.Identity.Permissions.Stores; using MadEyeMatt.MongoDB.DbContext; using Microsoft.AspNetCore.Identity; using MongoSamplePermissions.Model; diff --git a/samples/MongoSamplePermissions/Pages/InvoiceDelete.cshtml.cs b/samples/MongoSamplePermissions/Pages/InvoiceDelete.cshtml.cs index 1d8ae89..485d4f3 100644 --- a/samples/MongoSamplePermissions/Pages/InvoiceDelete.cshtml.cs +++ b/samples/MongoSamplePermissions/Pages/InvoiceDelete.cshtml.cs @@ -1,14 +1,13 @@ namespace MongoSamplePermissions.Pages { using System; - using MadEyeMatt.AspNetCore.Authorization.Permissions; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.Extensions.Logging; using MongoDB.Driver; using MongoSamplePermissions; using MongoSamplePermissions.Model; - [RequirePermission("Invoice.Delete")] + [RequireInvoiceDeletePermission] public class InvoiceDeleteModel : PageModel { private readonly ILogger logger; diff --git a/samples/MongoSamplePermissions/Program.cs b/samples/MongoSamplePermissions/Program.cs index 3d76bbe..569ee9c 100644 --- a/samples/MongoSamplePermissions/Program.cs +++ b/samples/MongoSamplePermissions/Program.cs @@ -5,6 +5,7 @@ using MadEyeMatt.AspNetCore.Identity.MongoDB; using MadEyeMatt.AspNetCore.Identity.Permissions; using MadEyeMatt.AspNetCore.Identity.Permissions.MongoDB; +using MadEyeMatt.Extensions.Identity.Permissions; using MadEyeMatt.MongoDB.DbContext; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Identity; diff --git a/samples/MongoSamplePermissions/RequireInvoiceDeletePermissionAttribute.cs b/samples/MongoSamplePermissions/RequireInvoiceDeletePermissionAttribute.cs new file mode 100644 index 0000000..e374c5d --- /dev/null +++ b/samples/MongoSamplePermissions/RequireInvoiceDeletePermissionAttribute.cs @@ -0,0 +1,17 @@ +namespace MongoSamplePermissions +{ + using System; + using JetBrains.Annotations; + using MadEyeMatt.AspNetCore.Authorization.Permissions; + + [PublicAPI] + [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true)] + public class RequireInvoiceDeletePermissionAttribute : RequirePermissionAttribute + { + /// + public RequireInvoiceDeletePermissionAttribute() + : base("Invoice.Delete") + { + } + } +} \ No newline at end of file diff --git a/samples/MongoSampleTenant/InvoicesContext.cs b/samples/MongoSampleTenant/InvoicesContext.cs index 8ff5165..432b77a 100644 --- a/samples/MongoSampleTenant/InvoicesContext.cs +++ b/samples/MongoSampleTenant/InvoicesContext.cs @@ -2,7 +2,7 @@ { using System; using MongoSampleTenant.Model; - using MadEyeMatt.AspNetCore.Identity.Permissions; + using MadEyeMatt.Extensions.Identity.Permissions.Stores; using MadEyeMatt.MongoDB.DbContext; using Microsoft.AspNetCore.Identity; diff --git a/samples/MongoSampleTenant/Pages/InvoiceDelete.cshtml.cs b/samples/MongoSampleTenant/Pages/InvoiceDelete.cshtml.cs index 53e3e40..9e32d76 100644 --- a/samples/MongoSampleTenant/Pages/InvoiceDelete.cshtml.cs +++ b/samples/MongoSampleTenant/Pages/InvoiceDelete.cshtml.cs @@ -7,7 +7,7 @@ using MongoSampleTenant; using MongoSampleTenant.Model; - [RequirePermission("Invoice.Delete")] + [RequireInvoiceDeletePermission] public class InvoiceDeleteModel : PageModel { private readonly ILogger logger; diff --git a/samples/MongoSampleTenant/Program.cs b/samples/MongoSampleTenant/Program.cs index e6bf22e..615726e 100644 --- a/samples/MongoSampleTenant/Program.cs +++ b/samples/MongoSampleTenant/Program.cs @@ -9,8 +9,8 @@ using System.Threading; using System; using System.Collections.Generic; +using MadEyeMatt.Extensions.Identity.Permissions; using MadEyeMatt.MongoDB.DbContext; -using MadEyeMatt.MongoDB.DbContext.Initialization; using MongoDB.Driver; using MongoSampleTenant; using MongoSampleTenant.Model; diff --git a/samples/MongoSampleTenant/RequireInvoiceDeletePermissionAttribute.cs b/samples/MongoSampleTenant/RequireInvoiceDeletePermissionAttribute.cs new file mode 100644 index 0000000..8d24a26 --- /dev/null +++ b/samples/MongoSampleTenant/RequireInvoiceDeletePermissionAttribute.cs @@ -0,0 +1,17 @@ +namespace MongoSampleTenant +{ + using System; + using JetBrains.Annotations; + using MadEyeMatt.AspNetCore.Authorization.Permissions; + + [PublicAPI] + [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true)] + public class RequireInvoiceDeletePermissionAttribute : RequirePermissionAttribute + { + /// + public RequireInvoiceDeletePermissionAttribute() + : base("Invoice.Delete") + { + } + } +} \ No newline at end of file diff --git a/samples/SamplePermissions/InvoicesContext.cs b/samples/SamplePermissions/InvoicesContext.cs index 6b9689b..ccd44c1 100644 --- a/samples/SamplePermissions/InvoicesContext.cs +++ b/samples/SamplePermissions/InvoicesContext.cs @@ -1,7 +1,7 @@ namespace SamplePermissions { - using MadEyeMatt.AspNetCore.Identity.Permissions; using MadEyeMatt.AspNetCore.Identity.Permissions.EntityFrameworkCore; + using MadEyeMatt.Extensions.Identity.Permissions.Stores; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; diff --git a/samples/SamplePermissions/Pages/InvoiceDelete.cshtml.cs b/samples/SamplePermissions/Pages/InvoiceDelete.cshtml.cs index 0f56e67..1324ffe 100644 --- a/samples/SamplePermissions/Pages/InvoiceDelete.cshtml.cs +++ b/samples/SamplePermissions/Pages/InvoiceDelete.cshtml.cs @@ -2,12 +2,11 @@ { using System; using System.Linq; - using MadEyeMatt.AspNetCore.Authorization.Permissions; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.Extensions.Logging; using SamplePermissions.Model; - [RequirePermission("Invoice.Delete")] + [RequireInvoiceDeletePermission] public class InvoiceDeleteModel : PageModel { private readonly ILogger logger; diff --git a/samples/SamplePermissions/Program.cs b/samples/SamplePermissions/Program.cs index 5a36db6..5af9e9c 100644 --- a/samples/SamplePermissions/Program.cs +++ b/samples/SamplePermissions/Program.cs @@ -1,6 +1,8 @@ using MadEyeMatt.AspNetCore.Authorization.Permissions; using MadEyeMatt.AspNetCore.Identity.Permissions; using MadEyeMatt.AspNetCore.Identity.Permissions.EntityFrameworkCore; +using MadEyeMatt.Extensions.Identity.Permissions; +using MadEyeMatt.Extensions.Identity.Permissions.Stores; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; diff --git a/samples/SamplePermissions/RequireInvoiceDeletePermissionAttribute.cs b/samples/SamplePermissions/RequireInvoiceDeletePermissionAttribute.cs new file mode 100644 index 0000000..5e42ca9 --- /dev/null +++ b/samples/SamplePermissions/RequireInvoiceDeletePermissionAttribute.cs @@ -0,0 +1,17 @@ +namespace SamplePermissions +{ + using System; + using JetBrains.Annotations; + using MadEyeMatt.AspNetCore.Authorization.Permissions; + + [PublicAPI] + [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true)] + public class RequireInvoiceDeletePermissionAttribute : RequirePermissionAttribute + { + /// + public RequireInvoiceDeletePermissionAttribute() + : base("Invoice.Delete") + { + } + } +} \ No newline at end of file diff --git a/samples/SampleTenant/InvoicesContext.cs b/samples/SampleTenant/InvoicesContext.cs index f55c802..ddda141 100644 --- a/samples/SampleTenant/InvoicesContext.cs +++ b/samples/SampleTenant/InvoicesContext.cs @@ -3,8 +3,8 @@ using System.Threading; using System.Threading.Tasks; using MadEyeMatt.AspNetCore.Authorization.Permissions; - using MadEyeMatt.AspNetCore.Identity.Permissions; using MadEyeMatt.AspNetCore.Identity.Permissions.EntityFrameworkCore; + using MadEyeMatt.Extensions.Identity.Permissions.Stores; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; diff --git a/samples/SampleTenant/Pages/InvoiceDelete.cshtml.cs b/samples/SampleTenant/Pages/InvoiceDelete.cshtml.cs index a791c9a..1b58f4f 100644 --- a/samples/SampleTenant/Pages/InvoiceDelete.cshtml.cs +++ b/samples/SampleTenant/Pages/InvoiceDelete.cshtml.cs @@ -7,7 +7,7 @@ using Microsoft.Extensions.Logging; using SampleTenant.Model; - [RequirePermission("Invoice.Delete")] + [RequireInvoiceDeletePermission] public class InvoiceDeleteModel : PageModel { private readonly ILogger logger; diff --git a/samples/SampleTenant/Pages/Shared/_LoginPartial.cshtml b/samples/SampleTenant/Pages/Shared/_LoginPartial.cshtml index 9e1bf40..1a71cde 100644 --- a/samples/SampleTenant/Pages/Shared/_LoginPartial.cshtml +++ b/samples/SampleTenant/Pages/Shared/_LoginPartial.cshtml @@ -1,4 +1,4 @@ -@using MadEyeMatt.AspNetCore.Identity.Permissions +@using MadEyeMatt.Extensions.Identity.Permissions.Stores @using Microsoft.AspNetCore.Identity @using Microsoft.AspNetCore.Mvc.TagHelpers @inject SignInManager signInManager diff --git a/samples/SampleTenant/Program.cs b/samples/SampleTenant/Program.cs index 6bc50e5..230e976 100644 --- a/samples/SampleTenant/Program.cs +++ b/samples/SampleTenant/Program.cs @@ -1,6 +1,8 @@ using MadEyeMatt.AspNetCore.Authorization.Permissions; using MadEyeMatt.AspNetCore.Identity.Permissions; using MadEyeMatt.AspNetCore.Identity.Permissions.EntityFrameworkCore; +using MadEyeMatt.Extensions.Identity.Permissions; +using MadEyeMatt.Extensions.Identity.Permissions.Stores; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; diff --git a/samples/SampleTenant/RequireInvoiceDeletePermissionAttribute.cs b/samples/SampleTenant/RequireInvoiceDeletePermissionAttribute.cs new file mode 100644 index 0000000..914ba6a --- /dev/null +++ b/samples/SampleTenant/RequireInvoiceDeletePermissionAttribute.cs @@ -0,0 +1,17 @@ +namespace SampleTenant +{ + using System; + using JetBrains.Annotations; + using MadEyeMatt.AspNetCore.Authorization.Permissions; + + [PublicAPI] + [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true)] + public class RequireInvoiceDeletePermissionAttribute : RequirePermissionAttribute + { + /// + public RequireInvoiceDeletePermissionAttribute() + : base("Invoice.Delete") + { + } + } +} \ No newline at end of file diff --git a/src/AspNetCore.Authorization.Permissions.Abstractions/AspNetCore.Authorization.Permissions.Abstractions.csproj b/src/AspNetCore.Authorization.Permissions.Abstractions/AspNetCore.Authorization.Permissions.Abstractions.csproj index 150bb47..e27afcf 100644 --- a/src/AspNetCore.Authorization.Permissions.Abstractions/AspNetCore.Authorization.Permissions.Abstractions.csproj +++ b/src/AspNetCore.Authorization.Permissions.Abstractions/AspNetCore.Authorization.Permissions.Abstractions.csproj @@ -2,32 +2,10 @@ net6.0;net7.0;net8.0 - latest - disable - disable - true - MadEyeMatt.$(AssemblyName) - MadEyeMatt.$(MSBuildProjectName) MadEyeMatt.$(MSBuildProjectName.Replace(" ", "_").Replace(".Abstractions", "")) - false - Copyright © 2022-2024 Matthias Gernand. All rights reserved. - 8.6.0 - 8.6.0 - 8.6.0 - Matthias Gernand - A libary that adds permission-based authorization. - en - True - https://github.com/mgernand/AspNetCore.Authorization.Permissions - https://github.com/mgernand/AspNetCore.Authorization.Permissions - git - aspnetcore;authorization;permissions - README.md - MIT - icon.png diff --git a/src/AspNetCore.Authorization.Permissions/AspNetCore.Authorization.Permissions.csproj b/src/AspNetCore.Authorization.Permissions/AspNetCore.Authorization.Permissions.csproj index c11f0f3..fb07b57 100644 --- a/src/AspNetCore.Authorization.Permissions/AspNetCore.Authorization.Permissions.csproj +++ b/src/AspNetCore.Authorization.Permissions/AspNetCore.Authorization.Permissions.csproj @@ -2,32 +2,6 @@ net6.0;net7.0;net8.0 - latest - disable - disable - true - - - - MadEyeMatt.$(AssemblyName) - MadEyeMatt.$(MSBuildProjectName) - MadEyeMatt.$(MSBuildProjectName.Replace(" ", "_")) - false - Copyright © 2022-2024 Matthias Gernand. All rights reserved. - 8.6.0 - 8.6.0 - 8.6.0 - Matthias Gernand - A libary that adds permission-based authorization. - en - True - https://github.com/mgernand/AspNetCore.Authorization.Permissions - https://github.com/mgernand/AspNetCore.Authorization.Permissions - git - aspnetcore;authorization;permissions - README.md - MIT - icon.png diff --git a/src/AspNetCore.Authorization.Permissions/HasPermissionAttribute.cs b/src/AspNetCore.Authorization.Permissions/HasPermissionAttribute.cs deleted file mode 100644 index dbf87ea..0000000 --- a/src/AspNetCore.Authorization.Permissions/HasPermissionAttribute.cs +++ /dev/null @@ -1,45 +0,0 @@ -namespace MadEyeMatt.AspNetCore.Authorization.Permissions -{ - using System; - using JetBrains.Annotations; - using Microsoft.AspNetCore.Authorization; - - /// - /// This attribute can be applied just like the [Authorize]. - /// This will only allow users which have a role containing the given permission. - /// - [Obsolete("Use [RequirePermission]. This weill be remove in v9.0")] - [PublicAPI] - [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true)] - public sealed class HasPermissionAttribute : Attribute, IAuthorizeData - { - private string policy; - - /// - /// Initializes a new instance of the type. - /// - /// - public HasPermissionAttribute(string permission) - { - if (string.IsNullOrWhiteSpace(permission)) - { - throw new ArgumentNullException(nameof(permission)); - } - - this.policy = permission; - } - - /// - string IAuthorizeData.Policy - { - get => this.policy; - set => this.policy = value; - } - - /// - string IAuthorizeData.Roles { get; set; } - - /// - public string AuthenticationSchemes { get; set; } - } -} diff --git a/src/AspNetCore.Authorization.Permissions/PermissionEndpointConventionBuilderExtensions.cs b/src/AspNetCore.Authorization.Permissions/PermissionEndpointConventionBuilderExtensions.cs index 85e3b9f..4c2399b 100644 --- a/src/AspNetCore.Authorization.Permissions/PermissionEndpointConventionBuilderExtensions.cs +++ b/src/AspNetCore.Authorization.Permissions/PermissionEndpointConventionBuilderExtensions.cs @@ -2,14 +2,15 @@ namespace MadEyeMatt.AspNetCore.Authorization.Permissions { using System; + using JetBrains.Annotations; using Microsoft.AspNetCore.Builder; /// /// Authorization extension methods for . /// + [PublicAPI] public static class PermissionEndpointConventionBuilderExtensions { - /// /// Adds a permission policy with the specified name to the endpoint(s). /// @@ -19,12 +20,15 @@ public static class PermissionEndpointConventionBuilderExtensions public static TBuilder RequirePermission(this TBuilder builder, string permissionName) where TBuilder : IEndpointConventionBuilder { - if (builder == null) + if (builder is null) { throw new ArgumentNullException(nameof(builder)); } - ArgumentNullException.ThrowIfNull(permissionName); + if (string.IsNullOrWhiteSpace(permissionName)) + { + throw new ArgumentNullException(nameof(permissionName)); + } return builder.RequireAuthorization(permissionName); } diff --git a/src/AspNetCore.Authorization.Permissions/RequirePermissionAttribute.cs b/src/AspNetCore.Authorization.Permissions/RequirePermissionAttribute.cs index 8e0e7eb..1e45ec3 100644 --- a/src/AspNetCore.Authorization.Permissions/RequirePermissionAttribute.cs +++ b/src/AspNetCore.Authorization.Permissions/RequirePermissionAttribute.cs @@ -10,7 +10,7 @@ /// [PublicAPI] [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true)] - public sealed class RequirePermissionAttribute : Attribute, IAuthorizeData + public class RequirePermissionAttribute : Attribute, IAuthorizeData { private string policy; diff --git a/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/AspNetCore.Identity.Permissions.EntityFrameworkCore.csproj b/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/AspNetCore.Identity.Permissions.EntityFrameworkCore.csproj index 22710a5..b8b8793 100644 --- a/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/AspNetCore.Identity.Permissions.EntityFrameworkCore.csproj +++ b/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/AspNetCore.Identity.Permissions.EntityFrameworkCore.csproj @@ -2,32 +2,6 @@ net6.0;net7.0;net8.0 - latest - disable - disable - true - - - - MadEyeMatt.$(AssemblyName) - MadEyeMatt.$(MSBuildProjectName) - MadEyeMatt.$(MSBuildProjectName.Replace(" ", "_")) - false - Copyright © 2022-2024 Matthias Gernand. All rights reserved. - 8.6.0 - 8.6.0 - 8.6.0 - Matthias Gernand - A libary that adds permission-based authorization. - en - True - https://github.com/mgernand/AspNetCore.Authorization.Permissions - https://github.com/mgernand/AspNetCore.Authorization.Permissions - git - aspnetcore;authorization;permissions;identity - README.md - MIT - icon.png diff --git a/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/Configuration/Permissions/PermissionConfiguration.cs b/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/Configuration/Permissions/PermissionConfiguration.cs index 2e6af58..46f5453 100644 --- a/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/Configuration/Permissions/PermissionConfiguration.cs +++ b/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/Configuration/Permissions/PermissionConfiguration.cs @@ -2,6 +2,7 @@ { using System; using JetBrains.Annotations; + using MadEyeMatt.Extensions.Identity.Permissions.Stores; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; diff --git a/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/Configuration/Permissions/RolePermissionConfiguration.cs b/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/Configuration/Permissions/RolePermissionConfiguration.cs index 55cfacd..961ef7b 100644 --- a/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/Configuration/Permissions/RolePermissionConfiguration.cs +++ b/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/Configuration/Permissions/RolePermissionConfiguration.cs @@ -2,6 +2,7 @@ { using System; using JetBrains.Annotations; + using MadEyeMatt.Extensions.Identity.Permissions.Stores; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; diff --git a/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/Configuration/Permissions/TenantConfiguration.cs b/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/Configuration/Permissions/TenantConfiguration.cs index 9f393f0..f5ee590 100644 --- a/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/Configuration/Permissions/TenantConfiguration.cs +++ b/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/Configuration/Permissions/TenantConfiguration.cs @@ -2,6 +2,7 @@ { using System; using JetBrains.Annotations; + using MadEyeMatt.Extensions.Identity.Permissions.Stores; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; diff --git a/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/Configuration/Permissions/TenantRoleConfiguration.cs b/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/Configuration/Permissions/TenantRoleConfiguration.cs index a6925fa..8f4581e 100644 --- a/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/Configuration/Permissions/TenantRoleConfiguration.cs +++ b/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/Configuration/Permissions/TenantRoleConfiguration.cs @@ -2,6 +2,7 @@ { using System; using JetBrains.Annotations; + using MadEyeMatt.Extensions.Identity.Permissions.Stores; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; diff --git a/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/Configuration/Permissions/UserBelongsToTenantConfiguration.cs b/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/Configuration/Permissions/UserBelongsToTenantConfiguration.cs index b278152..1a8b4f0 100644 --- a/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/Configuration/Permissions/UserBelongsToTenantConfiguration.cs +++ b/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/Configuration/Permissions/UserBelongsToTenantConfiguration.cs @@ -2,6 +2,7 @@ { using System; using JetBrains.Annotations; + using MadEyeMatt.Extensions.Identity.Permissions.Stores; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; diff --git a/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/IdentityBuilderExtensions.cs b/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/IdentityBuilderExtensions.cs index 895e9b4..e0e01be 100644 --- a/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/IdentityBuilderExtensions.cs +++ b/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/IdentityBuilderExtensions.cs @@ -2,6 +2,8 @@ { using System; using JetBrains.Annotations; + using MadEyeMatt.Extensions.Identity.Permissions; + using MadEyeMatt.Extensions.Identity.Permissions.Stores; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; diff --git a/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/ModelBuilderExtensions.cs b/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/ModelBuilderExtensions.cs index 1ced5bb..fec5a96 100644 --- a/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/ModelBuilderExtensions.cs +++ b/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/ModelBuilderExtensions.cs @@ -8,6 +8,7 @@ using MadEyeMatt.AspNetCore.Identity.Permissions.EntityFrameworkCore.Configuration.Identity; using MadEyeMatt.AspNetCore.Identity.Permissions.EntityFrameworkCore.Configuration.Permissions; using MadEyeMatt.AspNetCore.Identity.Permissions.EntityFrameworkCore.Properties; + using MadEyeMatt.Extensions.Identity.Permissions.Stores; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; diff --git a/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/PermissionStore.cs b/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/PermissionStore.cs index 90862f5..ebb2a15 100644 --- a/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/PermissionStore.cs +++ b/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/PermissionStore.cs @@ -6,6 +6,8 @@ using System.Threading; using System.Threading.Tasks; using JetBrains.Annotations; + using MadEyeMatt.Extensions.Identity.Permissions; + using MadEyeMatt.Extensions.Identity.Permissions.Stores; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; diff --git a/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/TenantStore.cs b/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/TenantStore.cs index 5961e91..cd075a0 100644 --- a/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/TenantStore.cs +++ b/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/TenantStore.cs @@ -6,6 +6,8 @@ using System.Threading; using System.Threading.Tasks; using JetBrains.Annotations; + using MadEyeMatt.Extensions.Identity.Permissions; + using MadEyeMatt.Extensions.Identity.Permissions.Stores; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; diff --git a/src/AspNetCore.Identity.Permissions.MongoDB/AspNetCore.Identity.Permissions.MongoDB.csproj b/src/AspNetCore.Identity.Permissions.MongoDB/AspNetCore.Identity.Permissions.MongoDB.csproj index a7e364f..bf0029f 100644 --- a/src/AspNetCore.Identity.Permissions.MongoDB/AspNetCore.Identity.Permissions.MongoDB.csproj +++ b/src/AspNetCore.Identity.Permissions.MongoDB/AspNetCore.Identity.Permissions.MongoDB.csproj @@ -2,32 +2,6 @@ net6.0;net7.0;net8.0 - latest - disable - disable - true - - - - MadEyeMatt.$(AssemblyName) - MadEyeMatt.$(MSBuildProjectName) - MadEyeMatt.$(MSBuildProjectName.Replace(" ", "_")) - false - Copyright © 2022-2024 Matthias Gernand. All rights reserved. - 8.6.0 - 8.6.0 - 8.6.0 - Matthias Gernand - A libary that adds permission-based authorization. - en - True - https://github.com/mgernand/AspNetCore.Authorization.Permissions - https://github.com/mgernand/AspNetCore.Authorization.Permissions - git - aspnetcore;authorization;permissions;identity - README.md - MIT - icon.png diff --git a/src/AspNetCore.Identity.Permissions.MongoDB/IdentityBuilderExtensions.cs b/src/AspNetCore.Identity.Permissions.MongoDB/IdentityBuilderExtensions.cs index 60121c0..6633d09 100644 --- a/src/AspNetCore.Identity.Permissions.MongoDB/IdentityBuilderExtensions.cs +++ b/src/AspNetCore.Identity.Permissions.MongoDB/IdentityBuilderExtensions.cs @@ -3,6 +3,7 @@ using System; using JetBrains.Annotations; using MadEyeMatt.AspNetCore.Identity.MongoDB; + using MadEyeMatt.Extensions.Identity.Permissions; using MadEyeMatt.MongoDB.DbContext; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.DependencyInjection; diff --git a/src/AspNetCore.Identity.Permissions.MongoDB/MongoIdentityPermission.cs b/src/AspNetCore.Identity.Permissions.MongoDB/MongoIdentityPermission.cs index 3e5563d..fde81e5 100644 --- a/src/AspNetCore.Identity.Permissions.MongoDB/MongoIdentityPermission.cs +++ b/src/AspNetCore.Identity.Permissions.MongoDB/MongoIdentityPermission.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; + using MadEyeMatt.Extensions.Identity.Permissions.Stores; /// /// A default permission implementation that used a string as type for the ID. diff --git a/src/AspNetCore.Identity.Permissions.MongoDB/MongoIdentityTenant.cs b/src/AspNetCore.Identity.Permissions.MongoDB/MongoIdentityTenant.cs index 2e2c6c6..c0cf666 100644 --- a/src/AspNetCore.Identity.Permissions.MongoDB/MongoIdentityTenant.cs +++ b/src/AspNetCore.Identity.Permissions.MongoDB/MongoIdentityTenant.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; + using MadEyeMatt.Extensions.Identity.Permissions.Stores; /// /// Represents a tenant in the identity system. diff --git a/src/AspNetCore.Identity.Permissions.MongoDB/MongoIdentityTenantUser.cs b/src/AspNetCore.Identity.Permissions.MongoDB/MongoIdentityTenantUser.cs index 44d7151..b8240b1 100644 --- a/src/AspNetCore.Identity.Permissions.MongoDB/MongoIdentityTenantUser.cs +++ b/src/AspNetCore.Identity.Permissions.MongoDB/MongoIdentityTenantUser.cs @@ -3,6 +3,7 @@ using System; using JetBrains.Annotations; using MadEyeMatt.AspNetCore.Identity.MongoDB; + using MadEyeMatt.Extensions.Identity.Permissions.Stores; /// /// Represents a tenant user in the identity system. diff --git a/src/AspNetCore.Identity.Permissions.MongoDB/PermissionStore.cs b/src/AspNetCore.Identity.Permissions.MongoDB/PermissionStore.cs index 3db2c67..e76db1d 100644 --- a/src/AspNetCore.Identity.Permissions.MongoDB/PermissionStore.cs +++ b/src/AspNetCore.Identity.Permissions.MongoDB/PermissionStore.cs @@ -11,6 +11,8 @@ using JetBrains.Annotations; using MadEyeMatt.AspNetCore.Identity.MongoDB; using MadEyeMatt.AspNetCore.Identity.Permissions.MongoDB.Properties; + using MadEyeMatt.Extensions.Identity.Permissions; + using MadEyeMatt.Extensions.Identity.Permissions.Stores; using MadEyeMatt.MongoDB.DbContext; using Microsoft.AspNetCore.Identity; diff --git a/src/AspNetCore.Identity.Permissions.MongoDB/TenantStore.cs b/src/AspNetCore.Identity.Permissions.MongoDB/TenantStore.cs index 45e883a..197e720 100644 --- a/src/AspNetCore.Identity.Permissions.MongoDB/TenantStore.cs +++ b/src/AspNetCore.Identity.Permissions.MongoDB/TenantStore.cs @@ -9,6 +9,8 @@ using global::MongoDB.Driver; using JetBrains.Annotations; using MadEyeMatt.AspNetCore.Identity.MongoDB; + using MadEyeMatt.Extensions.Identity.Permissions; + using MadEyeMatt.Extensions.Identity.Permissions.Stores; using MadEyeMatt.MongoDB.DbContext; using Microsoft.AspNetCore.Identity; diff --git a/src/AspNetCore.Identity.Permissions/AspNetCore.Identity.Permissions.csproj b/src/AspNetCore.Identity.Permissions/AspNetCore.Identity.Permissions.csproj index 9dc3aa2..d2df8ee 100644 --- a/src/AspNetCore.Identity.Permissions/AspNetCore.Identity.Permissions.csproj +++ b/src/AspNetCore.Identity.Permissions/AspNetCore.Identity.Permissions.csproj @@ -2,32 +2,6 @@ net6.0;net7.0;net8.0 - latest - disable - disable - true - - - - MadEyeMatt.$(AssemblyName) - MadEyeMatt.$(MSBuildProjectName) - MadEyeMatt.AspNetCore.Identity.Permissions - false - Copyright © 2022-2024 Matthias Gernand. All rights reserved. - 8.6.0 - 8.6.0 - 8.6.0 - Matthias Gernand - A libary that adds permission-based authorization. - en - True - https://github.com/mgernand/AspNetCore.Authorization.Permissions - https://github.com/mgernand/AspNetCore.Authorization.Permissions - git - aspnetcore;authorization;permissions;tenant;multi-tenacy;identity - README.md - MIT - icon.png diff --git a/src/AspNetCore.Identity.Permissions/AspNetPermissionManager.cs b/src/AspNetCore.Identity.Permissions/AspNetPermissionManager.cs index e0db164..c8cbe29 100644 --- a/src/AspNetCore.Identity.Permissions/AspNetPermissionManager.cs +++ b/src/AspNetCore.Identity.Permissions/AspNetPermissionManager.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Threading; using JetBrains.Annotations; + using MadEyeMatt.Extensions.Identity.Permissions; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.Logging; diff --git a/src/AspNetCore.Identity.Permissions/AspNetTenantManager.cs b/src/AspNetCore.Identity.Permissions/AspNetTenantManager.cs index 5c82e62..68fc22c 100644 --- a/src/AspNetCore.Identity.Permissions/AspNetTenantManager.cs +++ b/src/AspNetCore.Identity.Permissions/AspNetTenantManager.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Threading; using JetBrains.Annotations; + using MadEyeMatt.Extensions.Identity.Permissions; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.Logging; diff --git a/src/AspNetCore.Identity.Permissions/IdentityBuilderExtensions.cs b/src/AspNetCore.Identity.Permissions/IdentityBuilderExtensions.cs index 1987c3e..c8e1a71 100644 --- a/src/AspNetCore.Identity.Permissions/IdentityBuilderExtensions.cs +++ b/src/AspNetCore.Identity.Permissions/IdentityBuilderExtensions.cs @@ -3,6 +3,7 @@ using System; using JetBrains.Annotations; using MadEyeMatt.AspNetCore.Authorization.Permissions; + using MadEyeMatt.Extensions.Identity.Permissions; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.DependencyInjection.Extensions; diff --git a/src/AspNetCore.Identity.Permissions/PermissionClaimsProvider.cs b/src/AspNetCore.Identity.Permissions/PermissionClaimsProvider.cs index 06130a1..792f52e 100644 --- a/src/AspNetCore.Identity.Permissions/PermissionClaimsProvider.cs +++ b/src/AspNetCore.Identity.Permissions/PermissionClaimsProvider.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using JetBrains.Annotations; using MadEyeMatt.AspNetCore.Authorization.Permissions; + using MadEyeMatt.Extensions.Identity.Permissions; using Microsoft.AspNetCore.Identity; [UsedImplicitly] diff --git a/src/AspNetCore.Identity.Permissions/PermissionClaimsProviderBase.cs b/src/AspNetCore.Identity.Permissions/PermissionClaimsProviderBase.cs index c6b8b15..ded3543 100644 --- a/src/AspNetCore.Identity.Permissions/PermissionClaimsProviderBase.cs +++ b/src/AspNetCore.Identity.Permissions/PermissionClaimsProviderBase.cs @@ -4,6 +4,7 @@ using System.Security.Claims; using System.Threading.Tasks; using MadEyeMatt.AspNetCore.Authorization.Permissions; + using MadEyeMatt.Extensions.Identity.Permissions; internal abstract class PermissionClaimsProviderBase : IClaimsProvider where TPermission : class diff --git a/src/Directory.Build.props b/src/Directory.Build.props new file mode 100644 index 0000000..13a8d0e --- /dev/null +++ b/src/Directory.Build.props @@ -0,0 +1,45 @@ + + + + latest + disable + disable + true + true + true + false + + + + MadEyeMatt.$(MSBuildProjectName) + MadEyeMatt.$(MSBuildProjectName.Replace(" ", "_")) + MadEyeMatt.$(AssemblyName) + ..\..\package-output + false + Matthias Gernand + A libary that adds permission-based authorization. + en + https://github.com/mgernand/AspNetCore.Authorization.Permissions + https://github.com/mgernand/AspNetCore.Authorization.Permissions + git + aspnetcore;authorization;permissions;multi-tenancy;mongodb;ef-core + README.md + MIT + icon.png + + + + 8.7.0 + + $(VersionPrefix) + $(VersionPrefix) + $(Version) + + + + Identity Permission Extension + ASP.NET Core Identity Permission Extension + Copyright © 2022-2024 Matthias Gernand. All rights reserved. + + + \ No newline at end of file diff --git a/src/Extensions.Identity.Permissions.Core/Extensions.Identity.Permissions.Core.csproj b/src/Extensions.Identity.Permissions.Core/Extensions.Identity.Permissions.Core.csproj index da9d44b..e5ad14c 100644 --- a/src/Extensions.Identity.Permissions.Core/Extensions.Identity.Permissions.Core.csproj +++ b/src/Extensions.Identity.Permissions.Core/Extensions.Identity.Permissions.Core.csproj @@ -2,32 +2,10 @@ net6.0;net7.0;net8.0 - latest - disable - disable - true - MadEyeMatt.$(AssemblyName) - MadEyeMatt.$(MSBuildProjectName) - MadEyeMatt.AspNetCore.Identity.Permissions - false - Copyright © 2022-2024 Matthias Gernand. All rights reserved. - 8.6.0 - 8.6.0 - 8.6.0 - Matthias Gernand - A libary that adds permission-based authorization. - en - True - https://github.com/mgernand/AspNetCore.Authorization.Permissions - https://github.com/mgernand/AspNetCore.Authorization.Permissions - git - aspnetcore;authorization;permissions;tenant;multi-tenacy;identity - README.md - MIT - icon.png + MadEyeMatt.$(MSBuildProjectName.Replace(" ", "_").Replace(".Core", "")) diff --git a/src/Extensions.Identity.Permissions.Core/IPermissionStore.cs b/src/Extensions.Identity.Permissions.Core/IPermissionStore.cs index db5c2cf..8cade29 100644 --- a/src/Extensions.Identity.Permissions.Core/IPermissionStore.cs +++ b/src/Extensions.Identity.Permissions.Core/IPermissionStore.cs @@ -1,4 +1,4 @@ -namespace MadEyeMatt.AspNetCore.Identity.Permissions +namespace MadEyeMatt.Extensions.Identity.Permissions { using System; using System.Threading; diff --git a/src/Extensions.Identity.Permissions.Core/IPermissionValidator.cs b/src/Extensions.Identity.Permissions.Core/IPermissionValidator.cs index c0bb59c..e0645e5 100644 --- a/src/Extensions.Identity.Permissions.Core/IPermissionValidator.cs +++ b/src/Extensions.Identity.Permissions.Core/IPermissionValidator.cs @@ -1,4 +1,4 @@ -namespace MadEyeMatt.AspNetCore.Identity.Permissions +namespace MadEyeMatt.Extensions.Identity.Permissions { using System.Threading.Tasks; using JetBrains.Annotations; diff --git a/src/Extensions.Identity.Permissions.Core/IQueryablePermissionStore.cs b/src/Extensions.Identity.Permissions.Core/IQueryablePermissionStore.cs index 1b68a0a..702a06c 100644 --- a/src/Extensions.Identity.Permissions.Core/IQueryablePermissionStore.cs +++ b/src/Extensions.Identity.Permissions.Core/IQueryablePermissionStore.cs @@ -1,4 +1,4 @@ -namespace MadEyeMatt.AspNetCore.Identity.Permissions +namespace MadEyeMatt.Extensions.Identity.Permissions { using System.Linq; using JetBrains.Annotations; diff --git a/src/Extensions.Identity.Permissions.Core/IQueryableTenantStore.cs b/src/Extensions.Identity.Permissions.Core/IQueryableTenantStore.cs index dcf6698..b98f541 100644 --- a/src/Extensions.Identity.Permissions.Core/IQueryableTenantStore.cs +++ b/src/Extensions.Identity.Permissions.Core/IQueryableTenantStore.cs @@ -1,4 +1,4 @@ -namespace MadEyeMatt.AspNetCore.Identity.Permissions +namespace MadEyeMatt.Extensions.Identity.Permissions { using System.Linq; using JetBrains.Annotations; diff --git a/src/Extensions.Identity.Permissions.Core/IRolePermissionStore.cs b/src/Extensions.Identity.Permissions.Core/IRolePermissionStore.cs index b6d0e81..f409de6 100644 --- a/src/Extensions.Identity.Permissions.Core/IRolePermissionStore.cs +++ b/src/Extensions.Identity.Permissions.Core/IRolePermissionStore.cs @@ -1,4 +1,4 @@ -namespace MadEyeMatt.AspNetCore.Identity.Permissions +namespace MadEyeMatt.Extensions.Identity.Permissions { using System.Collections.Generic; using System.Threading; diff --git a/src/Extensions.Identity.Permissions.Core/ITenantRoleStore.cs b/src/Extensions.Identity.Permissions.Core/ITenantRoleStore.cs index 51adb34..061cacf 100644 --- a/src/Extensions.Identity.Permissions.Core/ITenantRoleStore.cs +++ b/src/Extensions.Identity.Permissions.Core/ITenantRoleStore.cs @@ -1,4 +1,4 @@ -namespace MadEyeMatt.AspNetCore.Identity.Permissions +namespace MadEyeMatt.Extensions.Identity.Permissions { using System.Collections.Generic; using System.Threading; diff --git a/src/Extensions.Identity.Permissions.Core/ITenantStore.cs b/src/Extensions.Identity.Permissions.Core/ITenantStore.cs index 2eb542d..0f97dd0 100644 --- a/src/Extensions.Identity.Permissions.Core/ITenantStore.cs +++ b/src/Extensions.Identity.Permissions.Core/ITenantStore.cs @@ -1,4 +1,4 @@ -namespace MadEyeMatt.AspNetCore.Identity.Permissions +namespace MadEyeMatt.Extensions.Identity.Permissions { using System; using System.Threading; diff --git a/src/Extensions.Identity.Permissions.Core/ITenantValidator.cs b/src/Extensions.Identity.Permissions.Core/ITenantValidator.cs index 07b8e6e..d6837ac 100644 --- a/src/Extensions.Identity.Permissions.Core/ITenantValidator.cs +++ b/src/Extensions.Identity.Permissions.Core/ITenantValidator.cs @@ -1,4 +1,4 @@ -namespace MadEyeMatt.AspNetCore.Identity.Permissions +namespace MadEyeMatt.Extensions.Identity.Permissions { using System.Threading.Tasks; using JetBrains.Annotations; diff --git a/src/Extensions.Identity.Permissions.Core/IdentityBuilderExtensions.cs b/src/Extensions.Identity.Permissions.Core/IdentityBuilderExtensions.cs index a5e4f47..7473e0c 100644 --- a/src/Extensions.Identity.Permissions.Core/IdentityBuilderExtensions.cs +++ b/src/Extensions.Identity.Permissions.Core/IdentityBuilderExtensions.cs @@ -1,4 +1,4 @@ -namespace MadEyeMatt.AspNetCore.Identity.Permissions +namespace MadEyeMatt.Extensions.Identity.Permissions { using System; using JetBrains.Annotations; diff --git a/src/Extensions.Identity.Permissions.Core/LoggerEventIds.cs b/src/Extensions.Identity.Permissions.Core/LoggerEventIds.cs index 7f7c62b..b4a8112 100644 --- a/src/Extensions.Identity.Permissions.Core/LoggerEventIds.cs +++ b/src/Extensions.Identity.Permissions.Core/LoggerEventIds.cs @@ -1,4 +1,4 @@ -namespace MadEyeMatt.AspNetCore.Identity.Permissions +namespace MadEyeMatt.Extensions.Identity.Permissions { using Microsoft.Extensions.Logging; diff --git a/src/Extensions.Identity.Permissions.Core/PermissionIdentityBuilder.cs b/src/Extensions.Identity.Permissions.Core/PermissionIdentityBuilder.cs index cca61e0..40f2cf0 100644 --- a/src/Extensions.Identity.Permissions.Core/PermissionIdentityBuilder.cs +++ b/src/Extensions.Identity.Permissions.Core/PermissionIdentityBuilder.cs @@ -1,4 +1,4 @@ -namespace MadEyeMatt.AspNetCore.Identity.Permissions +namespace MadEyeMatt.Extensions.Identity.Permissions { using System; using JetBrains.Annotations; diff --git a/src/Extensions.Identity.Permissions.Core/PermissionIdentityErrorDescriber.cs b/src/Extensions.Identity.Permissions.Core/PermissionIdentityErrorDescriber.cs index fc671ee..8336a8c 100644 --- a/src/Extensions.Identity.Permissions.Core/PermissionIdentityErrorDescriber.cs +++ b/src/Extensions.Identity.Permissions.Core/PermissionIdentityErrorDescriber.cs @@ -1,7 +1,7 @@ -namespace MadEyeMatt.AspNetCore.Identity.Permissions +namespace MadEyeMatt.Extensions.Identity.Permissions { using JetBrains.Annotations; - using MadEyeMatt.AspNetCore.Identity.Permissions.Properties; + using MadEyeMatt.Extensions.Identity.Permissions.Properties; using Microsoft.AspNetCore.Identity; /// @@ -93,7 +93,7 @@ public virtual IdentityError TenantAlreadyInRole(string roleName) { return new IdentityError { - Code = nameof(TenantAlreadyInRole), + Code = nameof(this.TenantAlreadyInRole), Description = string.Format(Resources.TenantAlreadyInRole, roleName) }; @@ -108,7 +108,7 @@ public virtual IdentityError TenantNotInRole(string roleName) { return new IdentityError { - Code = nameof(TenantNotInRole), + Code = nameof(this.TenantNotInRole), Description = string.Format(Resources.TenantNotInRole, roleName) }; diff --git a/src/Extensions.Identity.Permissions.Core/PermissionManager.cs b/src/Extensions.Identity.Permissions.Core/PermissionManager.cs index 864d52c..a4f4f1b 100644 --- a/src/Extensions.Identity.Permissions.Core/PermissionManager.cs +++ b/src/Extensions.Identity.Permissions.Core/PermissionManager.cs @@ -1,4 +1,4 @@ -namespace MadEyeMatt.AspNetCore.Identity.Permissions +namespace MadEyeMatt.Extensions.Identity.Permissions { using System; using System.Collections.Generic; diff --git a/src/Extensions.Identity.Permissions.Core/PermissionUserClaimsPrincipalFactory.cs b/src/Extensions.Identity.Permissions.Core/PermissionUserClaimsPrincipalFactory.cs index d933bdb..55f0fa0 100644 --- a/src/Extensions.Identity.Permissions.Core/PermissionUserClaimsPrincipalFactory.cs +++ b/src/Extensions.Identity.Permissions.Core/PermissionUserClaimsPrincipalFactory.cs @@ -1,4 +1,4 @@ -namespace MadEyeMatt.AspNetCore.Identity.Permissions +namespace MadEyeMatt.Extensions.Identity.Permissions { using System.Collections.Generic; using System.Security.Claims; diff --git a/src/Extensions.Identity.Permissions.Core/PermissionValidator.cs b/src/Extensions.Identity.Permissions.Core/PermissionValidator.cs index b1d695b..e188322 100644 --- a/src/Extensions.Identity.Permissions.Core/PermissionValidator.cs +++ b/src/Extensions.Identity.Permissions.Core/PermissionValidator.cs @@ -1,4 +1,4 @@ -namespace MadEyeMatt.AspNetCore.Identity.Permissions +namespace MadEyeMatt.Extensions.Identity.Permissions { using System; using System.Collections.Generic; diff --git a/src/Extensions.Identity.Permissions.Core/Properties/Resources.Designer.cs b/src/Extensions.Identity.Permissions.Core/Properties/Resources.Designer.cs index d39d200..d0ff6f6 100644 --- a/src/Extensions.Identity.Permissions.Core/Properties/Resources.Designer.cs +++ b/src/Extensions.Identity.Permissions.Core/Properties/Resources.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace MadEyeMatt.AspNetCore.Identity.Permissions.Properties { +namespace MadEyeMatt.Extensions.Identity.Permissions.Properties { using System; @@ -39,7 +39,7 @@ internal Resources() { internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MadEyeMatt.AspNetCore.Identity.Permissions.Properties.Resources", typeof(Resources).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MadEyeMatt.Extensions.Identity.Permissions.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; diff --git a/src/Extensions.Identity.Permissions.Core/ServiceCollectionExtensions.cs b/src/Extensions.Identity.Permissions.Core/ServiceCollectionExtensions.cs index c65d9ce..d5649a9 100644 --- a/src/Extensions.Identity.Permissions.Core/ServiceCollectionExtensions.cs +++ b/src/Extensions.Identity.Permissions.Core/ServiceCollectionExtensions.cs @@ -1,4 +1,4 @@ -namespace MadEyeMatt.AspNetCore.Identity.Permissions +namespace MadEyeMatt.Extensions.Identity.Permissions { using System; using JetBrains.Annotations; diff --git a/src/Extensions.Identity.Permissions.Core/TenantManager.cs b/src/Extensions.Identity.Permissions.Core/TenantManager.cs index 60134d8..45b7f61 100644 --- a/src/Extensions.Identity.Permissions.Core/TenantManager.cs +++ b/src/Extensions.Identity.Permissions.Core/TenantManager.cs @@ -1,4 +1,4 @@ -namespace MadEyeMatt.AspNetCore.Identity.Permissions +namespace MadEyeMatt.Extensions.Identity.Permissions { using System; using System.Collections.Generic; diff --git a/src/Extensions.Identity.Permissions.Core/TenantValidator.cs b/src/Extensions.Identity.Permissions.Core/TenantValidator.cs index 7d51053..12b60bb 100644 --- a/src/Extensions.Identity.Permissions.Core/TenantValidator.cs +++ b/src/Extensions.Identity.Permissions.Core/TenantValidator.cs @@ -1,4 +1,4 @@ -namespace MadEyeMatt.AspNetCore.Identity.Permissions +namespace MadEyeMatt.Extensions.Identity.Permissions { using System; using System.Collections.Generic; diff --git a/src/Extensions.Identity.Permissions.Core/UserManagerExtensions.cs b/src/Extensions.Identity.Permissions.Core/UserManagerExtensions.cs index 547d6cb..ac2d4c7 100644 --- a/src/Extensions.Identity.Permissions.Core/UserManagerExtensions.cs +++ b/src/Extensions.Identity.Permissions.Core/UserManagerExtensions.cs @@ -1,11 +1,11 @@ -namespace MadEyeMatt.AspNetCore.Identity.Permissions +namespace MadEyeMatt.Extensions.Identity.Permissions { using System; using System.Reflection; - using System.Security.Claims; - using System.Threading; + using System.Security.Claims; + using System.Threading; using System.Threading.Tasks; - using JetBrains.Annotations; + using JetBrains.Annotations; using MadEyeMatt.AspNetCore.Authorization.Permissions; using Microsoft.AspNetCore.Identity; diff --git a/src/Extensions.Identity.Permissions.Core/UserStoreExtensions.cs b/src/Extensions.Identity.Permissions.Core/UserStoreExtensions.cs index 738efd2..b8aba3e 100644 --- a/src/Extensions.Identity.Permissions.Core/UserStoreExtensions.cs +++ b/src/Extensions.Identity.Permissions.Core/UserStoreExtensions.cs @@ -1,4 +1,4 @@ -namespace MadEyeMatt.AspNetCore.Identity.Permissions +namespace MadEyeMatt.Extensions.Identity.Permissions { using System; using System.Reflection; diff --git a/src/Extensions.Identity.Permissions.Stores/Extensions.Identity.Permissions.Stores.csproj b/src/Extensions.Identity.Permissions.Stores/Extensions.Identity.Permissions.Stores.csproj index 9c76c80..af224ef 100644 --- a/src/Extensions.Identity.Permissions.Stores/Extensions.Identity.Permissions.Stores.csproj +++ b/src/Extensions.Identity.Permissions.Stores/Extensions.Identity.Permissions.Stores.csproj @@ -2,32 +2,6 @@ net6.0;net7.0;net8.0 - latest - disable - disable - true - - - - MadEyeMatt.$(AssemblyName) - MadEyeMatt.$(MSBuildProjectName) - MadEyeMatt.AspNetCore.Identity.Permissions - false - Copyright © 2022-2024 Matthias Gernand. All rights reserved. - 8.6.0 - 8.6.0 - 8.6.0 - Matthias Gernand - A libary that adds permission-based authorization. - en - True - https://github.com/mgernand/AspNetCore.Authorization.Permissions - https://github.com/mgernand/AspNetCore.Authorization.Permissions - git - aspnetcore;authorization;permissions;tenant;multi-tenacy;identity - README.md - MIT - icon.png diff --git a/src/Extensions.Identity.Permissions.Stores/ITenantUser.cs b/src/Extensions.Identity.Permissions.Stores/ITenantUser.cs index ad7a16b..35fbffa 100644 --- a/src/Extensions.Identity.Permissions.Stores/ITenantUser.cs +++ b/src/Extensions.Identity.Permissions.Stores/ITenantUser.cs @@ -1,4 +1,4 @@ -namespace MadEyeMatt.AspNetCore.Identity.Permissions +namespace MadEyeMatt.Extensions.Identity.Permissions.Stores { using System; using JetBrains.Annotations; diff --git a/src/Extensions.Identity.Permissions.Stores/IdentityPermission.cs b/src/Extensions.Identity.Permissions.Stores/IdentityPermission.cs index ddf54ca..0fe51df 100644 --- a/src/Extensions.Identity.Permissions.Stores/IdentityPermission.cs +++ b/src/Extensions.Identity.Permissions.Stores/IdentityPermission.cs @@ -1,4 +1,4 @@ -namespace MadEyeMatt.AspNetCore.Identity.Permissions +namespace MadEyeMatt.Extensions.Identity.Permissions.Stores { using System; using JetBrains.Annotations; diff --git a/src/Extensions.Identity.Permissions.Stores/IdentityRolePermission.cs b/src/Extensions.Identity.Permissions.Stores/IdentityRolePermission.cs index 4faeaec..cc7a12f 100644 --- a/src/Extensions.Identity.Permissions.Stores/IdentityRolePermission.cs +++ b/src/Extensions.Identity.Permissions.Stores/IdentityRolePermission.cs @@ -1,4 +1,4 @@ -namespace MadEyeMatt.AspNetCore.Identity.Permissions +namespace MadEyeMatt.Extensions.Identity.Permissions.Stores { using System; using JetBrains.Annotations; diff --git a/src/Extensions.Identity.Permissions.Stores/IdentityTenant.cs b/src/Extensions.Identity.Permissions.Stores/IdentityTenant.cs index 16e9cc7..bbc565e 100644 --- a/src/Extensions.Identity.Permissions.Stores/IdentityTenant.cs +++ b/src/Extensions.Identity.Permissions.Stores/IdentityTenant.cs @@ -1,4 +1,4 @@ -namespace MadEyeMatt.AspNetCore.Identity.Permissions +namespace MadEyeMatt.Extensions.Identity.Permissions.Stores { using System; using JetBrains.Annotations; diff --git a/src/Extensions.Identity.Permissions.Stores/IdentityTenantRole.cs b/src/Extensions.Identity.Permissions.Stores/IdentityTenantRole.cs index ee47323..26b145e 100644 --- a/src/Extensions.Identity.Permissions.Stores/IdentityTenantRole.cs +++ b/src/Extensions.Identity.Permissions.Stores/IdentityTenantRole.cs @@ -1,4 +1,4 @@ -namespace MadEyeMatt.AspNetCore.Identity.Permissions +namespace MadEyeMatt.Extensions.Identity.Permissions.Stores { using System; using JetBrains.Annotations; diff --git a/src/Extensions.Identity.Permissions.Stores/IdentityTenantUser.cs b/src/Extensions.Identity.Permissions.Stores/IdentityTenantUser.cs index f281187..43b64f7 100644 --- a/src/Extensions.Identity.Permissions.Stores/IdentityTenantUser.cs +++ b/src/Extensions.Identity.Permissions.Stores/IdentityTenantUser.cs @@ -1,4 +1,4 @@ -namespace MadEyeMatt.AspNetCore.Identity.Permissions +namespace MadEyeMatt.Extensions.Identity.Permissions.Stores { using System; using JetBrains.Annotations; diff --git a/src/Extensions.Identity.Permissions.Stores/PermissionStoreBase.cs b/src/Extensions.Identity.Permissions.Stores/PermissionStoreBase.cs index 5e93ca5..94a2c5c 100644 --- a/src/Extensions.Identity.Permissions.Stores/PermissionStoreBase.cs +++ b/src/Extensions.Identity.Permissions.Stores/PermissionStoreBase.cs @@ -1,4 +1,4 @@ -namespace MadEyeMatt.AspNetCore.Identity.Permissions +namespace MadEyeMatt.Extensions.Identity.Permissions.Stores { using System; using System.Collections.Generic; @@ -6,6 +6,7 @@ using System.Threading; using System.Threading.Tasks; using JetBrains.Annotations; + using MadEyeMatt.Extensions.Identity.Permissions; using Microsoft.AspNetCore.Identity; /// diff --git a/src/Extensions.Identity.Permissions.Stores/TenantStoreBase.cs b/src/Extensions.Identity.Permissions.Stores/TenantStoreBase.cs index 208e446..061bd53 100644 --- a/src/Extensions.Identity.Permissions.Stores/TenantStoreBase.cs +++ b/src/Extensions.Identity.Permissions.Stores/TenantStoreBase.cs @@ -1,4 +1,4 @@ -namespace MadEyeMatt.AspNetCore.Identity.Permissions +namespace MadEyeMatt.Extensions.Identity.Permissions.Stores { using System; using System.Collections.Generic; @@ -6,6 +6,7 @@ using System.Threading; using System.Threading.Tasks; using JetBrains.Annotations; + using MadEyeMatt.Extensions.Identity.Permissions; using Microsoft.AspNetCore.Identity; ///