From 39ed7b26015542c5c421427bdb43f8290cf502b5 Mon Sep 17 00:00:00 2001 From: Matthias Gernand Date: Fri, 24 Nov 2023 14:25:47 +0100 Subject: [PATCH] Added support for .NET 6 and .NET 7 (#34) --- ...horization.Permissions.Abstractions.csproj | 8 ++--- ...spNetCore.Authorization.Permissions.csproj | 8 ++--- ...ity.Permissions.EntityFrameworkCore.csproj | 18 ++++++++---- .../Guard.cs | 29 +++++++++++++++++++ .../PermissionStore.cs | 28 +++++++++--------- .../TenantStore.cs | 26 ++++++++--------- ...etCore.Identity.Permissions.MongoDB.csproj | 10 +++---- .../Guard.cs | 29 +++++++++++++++++++ .../PermissionStore.cs | 26 ++++++++--------- .../TenantStore.cs | 26 ++++++++--------- .../AspNetCore.Identity.Permissions.csproj | 8 ++--- ...xtensions.Identity.Permissions.Core.csproj | 8 ++--- ...ensions.Identity.Permissions.Stores.csproj | 8 ++--- ...Authorization.Permissions.UnitTests.csproj | 2 +- ...ntityFrameworkCore.IntegrationTests.csproj | 2 +- ...ermissions.MongoDB.IntegrationTests.csproj | 2 +- 16 files changed, 151 insertions(+), 87 deletions(-) create mode 100644 src/AspNetCore.Identity.Permissions.EntityFrameworkCore/Guard.cs create mode 100644 src/AspNetCore.Identity.Permissions.MongoDB/Guard.cs 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 aa0c650..dc4593e 100644 --- a/src/AspNetCore.Authorization.Permissions.Abstractions/AspNetCore.Authorization.Permissions.Abstractions.csproj +++ b/src/AspNetCore.Authorization.Permissions.Abstractions/AspNetCore.Authorization.Permissions.Abstractions.csproj @@ -1,7 +1,7 @@ - net8.0 + net6.0;net7.0;net8.0 latest disable disable @@ -14,9 +14,9 @@ MadEyeMatt.$(MSBuildProjectName.Replace(" ", "_").Replace(".Abstractions", "")) false Copyright © 2022-2023 Matthias Gernand. All rights reserved. - 8.5.0 - 8.5.0 - 8.5.0 + 8.5.1 + 8.5.1 + 8.5.1 Matthias Gernand A libary that adds permission-based authorization. en diff --git a/src/AspNetCore.Authorization.Permissions/AspNetCore.Authorization.Permissions.csproj b/src/AspNetCore.Authorization.Permissions/AspNetCore.Authorization.Permissions.csproj index 94004cf..4192236 100644 --- a/src/AspNetCore.Authorization.Permissions/AspNetCore.Authorization.Permissions.csproj +++ b/src/AspNetCore.Authorization.Permissions/AspNetCore.Authorization.Permissions.csproj @@ -1,7 +1,7 @@ - net8.0 + net6.0;net7.0;net8.0 latest disable disable @@ -14,9 +14,9 @@ MadEyeMatt.$(MSBuildProjectName.Replace(" ", "_")) false Copyright © 2022-2023 Matthias Gernand. All rights reserved. - 8.5.0 - 8.5.0 - 8.5.0 + 8.5.1 + 8.5.1 + 8.5.1 Matthias Gernand A libary that adds permission-based authorization. en 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 2f3bc98..a30d3c8 100644 --- a/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/AspNetCore.Identity.Permissions.EntityFrameworkCore.csproj +++ b/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/AspNetCore.Identity.Permissions.EntityFrameworkCore.csproj @@ -1,7 +1,7 @@ - net8.0 + net6.0;net7.0;net8.0 latest disable disable @@ -14,9 +14,9 @@ MadEyeMatt.$(MSBuildProjectName.Replace(" ", "_")) false Copyright © 2022-2023 Matthias Gernand. All rights reserved. - 8.5.0 - 8.5.0 - 8.5.0 + 8.5.1 + 8.5.1 + 8.5.1 Matthias Gernand A libary that adds permission-based authorization. en @@ -47,8 +47,14 @@ - - + + + + + + + + diff --git a/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/Guard.cs b/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/Guard.cs new file mode 100644 index 0000000..20c69c7 --- /dev/null +++ b/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/Guard.cs @@ -0,0 +1,29 @@ +namespace MadEyeMatt.AspNetCore.Identity.Permissions.EntityFrameworkCore +{ + using System; + using System.Diagnostics.CodeAnalysis; + using System.Runtime.CompilerServices; + + internal static class Guard + { + internal static void ThrowIfNull([NotNull] object argument, [CallerArgumentExpression("argument")] string parameterName = null) + { + if (argument != null) + { + return; + } + + throw new ArgumentNullException(parameterName); + } + + public static void ThrowIfNullOrWhiteSpace([NotNull] string argument, [CallerArgumentExpression("argument")] string parameterName = null) + { + if (!string.IsNullOrWhiteSpace(argument)) + { + return; + } + + throw new ArgumentException(argument, parameterName); + } + } +} \ No newline at end of file diff --git a/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/PermissionStore.cs b/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/PermissionStore.cs index 5bb2ddd..90862f5 100644 --- a/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/PermissionStore.cs +++ b/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/PermissionStore.cs @@ -105,7 +105,7 @@ public class PermissionStore CreateAsync(TPermission permission, C { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentNullException.ThrowIfNull(permission); + Guard.ThrowIfNull(permission); permission.ConcurrencyStamp = Guid.NewGuid().ToString("N"); this.Context.Add(permission); @@ -146,7 +146,7 @@ public override async Task UpdateAsync(TPermission permission, C { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentNullException.ThrowIfNull(permission); + Guard.ThrowIfNull(permission); this.Context.Attach(permission); permission.ConcurrencyStamp = Guid.NewGuid().ToString("N"); @@ -168,7 +168,7 @@ public override async Task DeleteAsync(TPermission permission, C { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentNullException.ThrowIfNull(permission); + Guard.ThrowIfNull(permission); this.Context.Remove(permission); try @@ -207,7 +207,7 @@ public override Task GetNormalizedPermissionNameAsync(TPermission permis { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentNullException.ThrowIfNull(permission); + Guard.ThrowIfNull(permission); return Task.FromResult(permission.NormalizedName); } @@ -217,8 +217,8 @@ public override async Task AddToRoleAsync(TPermission permission, string normali { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentNullException.ThrowIfNull(permission); - ArgumentException.ThrowIfNullOrEmpty(normalizedRoleName); + Guard.ThrowIfNull(permission); + Guard.ThrowIfNullOrWhiteSpace(normalizedRoleName); TRole role = await this.FindRoleAsync(normalizedRoleName, cancellationToken); if (role == null) @@ -234,8 +234,8 @@ public override async Task RemoveFromRoleAsync(TPermission permission, string no { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentNullException.ThrowIfNull(permission); - ArgumentException.ThrowIfNullOrEmpty(normalizedRoleName); + Guard.ThrowIfNull(permission); + Guard.ThrowIfNullOrWhiteSpace(normalizedRoleName); TRole role = await this.FindRoleAsync(normalizedRoleName, cancellationToken); if (role != null) @@ -253,7 +253,7 @@ public override async Task> GetRolesAsync(TPermission permission, { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentNullException.ThrowIfNull(permission); + Guard.ThrowIfNull(permission); TKey permissionId = permission.Id; IQueryable query = from rolePermission in this.RolePermissions @@ -269,7 +269,7 @@ public override async Task> GetRoleIdsAsync(TPermission permission { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentNullException.ThrowIfNull(permission); + Guard.ThrowIfNull(permission); TKey permissionId = permission.Id; IQueryable query = from rolePermission in this.RolePermissions @@ -286,8 +286,8 @@ public override async Task IsInRoleAsync(TPermission permission, string no { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentNullException.ThrowIfNull(permission); - ArgumentException.ThrowIfNullOrEmpty(normalizedRoleName); + Guard.ThrowIfNull(permission); + Guard.ThrowIfNullOrWhiteSpace(normalizedRoleName); TRole role = await this.FindRoleAsync(normalizedRoleName, cancellationToken); if (role != null) @@ -307,7 +307,7 @@ public override async Task> GetPermissionsInRoleAsync(string { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentException.ThrowIfNullOrEmpty(normalizedRoleName); + Guard.ThrowIfNullOrWhiteSpace(normalizedRoleName); TRole role = await this.FindRoleAsync(normalizedRoleName, cancellationToken); diff --git a/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/TenantStore.cs b/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/TenantStore.cs index 6e5b1c6..5961e91 100644 --- a/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/TenantStore.cs +++ b/src/AspNetCore.Identity.Permissions.EntityFrameworkCore/TenantStore.cs @@ -70,7 +70,7 @@ public class TenantStore : TenantSt public TenantStore(TContext context, IdentityErrorDescriber describer = null) : base(describer) { - ArgumentNullException.ThrowIfNull(context); + Guard.ThrowIfNull(context); this.Context = context; } @@ -98,7 +98,7 @@ public override async Task CreateAsync(TTenant tenant, Cancellat { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentNullException.ThrowIfNull(tenant); + Guard.ThrowIfNull(tenant); tenant.ConcurrencyStamp = Guid.NewGuid().ToString("N"); this.Context.Add(tenant); @@ -111,7 +111,7 @@ public override async Task UpdateAsync(TTenant tenant, Cancellat { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentNullException.ThrowIfNull(tenant); + Guard.ThrowIfNull(tenant); this.Context.Attach(tenant); tenant.ConcurrencyStamp = Guid.NewGuid().ToString("N"); @@ -133,7 +133,7 @@ public override async Task DeleteAsync(TTenant tenant, Cancellat { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentNullException.ThrowIfNull(tenant); + Guard.ThrowIfNull(tenant); this.Context.Remove(tenant); try @@ -175,8 +175,8 @@ public override async Task AddToRoleAsync(TTenant tenant, string normalizedRoleN { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentNullException.ThrowIfNull(tenant); - ArgumentException.ThrowIfNullOrEmpty(normalizedRoleName); + Guard.ThrowIfNull(tenant); + Guard.ThrowIfNullOrWhiteSpace(normalizedRoleName); TRole role = await this.FindRoleAsync(normalizedRoleName, cancellationToken); if(role == null) @@ -192,8 +192,8 @@ public override async Task RemoveFromRoleAsync(TTenant tenant, string normalized { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentNullException.ThrowIfNull(tenant); - ArgumentException.ThrowIfNullOrEmpty(normalizedRoleName); + Guard.ThrowIfNull(tenant); + Guard.ThrowIfNullOrWhiteSpace(normalizedRoleName); TRole role = await this.FindRoleAsync(normalizedRoleName, cancellationToken); if(role != null) @@ -211,7 +211,7 @@ public override async Task> GetRolesAsync(TTenant tenant, Cancella { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentNullException.ThrowIfNull(tenant); + Guard.ThrowIfNull(tenant); TKey userId = tenant.Id; IQueryable query = from tenantRole in this.TenantRoles @@ -227,7 +227,7 @@ public override async Task> GetRoleIdsAsync(TTenant tenant, Cancel { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentNullException.ThrowIfNull(tenant); + Guard.ThrowIfNull(tenant); TKey userId = tenant.Id; IQueryable query = from tenantRole in this.TenantRoles @@ -244,8 +244,8 @@ public override async Task IsInRoleAsync(TTenant tenant, string normalized { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentNullException.ThrowIfNull(tenant); - ArgumentException.ThrowIfNullOrEmpty(normalizedRoleName); + Guard.ThrowIfNull(tenant); + Guard.ThrowIfNullOrWhiteSpace(normalizedRoleName); TRole role = await this.FindRoleAsync(normalizedRoleName, cancellationToken); if(role != null) @@ -262,7 +262,7 @@ public override async Task> GetTenantsInRoleAsync(string normaliz { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentException.ThrowIfNullOrEmpty(normalizedRoleName); + Guard.ThrowIfNullOrWhiteSpace(normalizedRoleName); TRole role = await this.FindRoleAsync(normalizedRoleName, cancellationToken); 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 cd86c50..3a1101d 100644 --- a/src/AspNetCore.Identity.Permissions.MongoDB/AspNetCore.Identity.Permissions.MongoDB.csproj +++ b/src/AspNetCore.Identity.Permissions.MongoDB/AspNetCore.Identity.Permissions.MongoDB.csproj @@ -1,7 +1,7 @@ - net8.0 + net6.0;net7.0;net8.0 latest disable disable @@ -14,9 +14,9 @@ MadEyeMatt.$(MSBuildProjectName.Replace(" ", "_")) false Copyright © 2022-2023 Matthias Gernand. All rights reserved. - 8.5.0 - 8.5.0 - 8.5.0 + 8.5.1 + 8.5.1 + 8.5.1 Matthias Gernand A libary that adds permission-based authorization. en @@ -47,7 +47,7 @@ - + diff --git a/src/AspNetCore.Identity.Permissions.MongoDB/Guard.cs b/src/AspNetCore.Identity.Permissions.MongoDB/Guard.cs new file mode 100644 index 0000000..cae9f7b --- /dev/null +++ b/src/AspNetCore.Identity.Permissions.MongoDB/Guard.cs @@ -0,0 +1,29 @@ +namespace MadEyeMatt.AspNetCore.Identity.Permissions.MongoDB +{ + using System; + using System.Diagnostics.CodeAnalysis; + using System.Runtime.CompilerServices; + + internal static class Guard + { + internal static void ThrowIfNull([NotNull] object argument, [CallerArgumentExpression("argument")] string parameterName = null) + { + if (argument != null) + { + return; + } + + throw new ArgumentNullException(parameterName); + } + + public static void ThrowIfNullOrWhiteSpace([NotNull] string argument, [CallerArgumentExpression("argument")] string parameterName = null) + { + if (!string.IsNullOrWhiteSpace(argument)) + { + return; + } + + throw new ArgumentException(argument, parameterName); + } + } +} \ No newline at end of file diff --git a/src/AspNetCore.Identity.Permissions.MongoDB/PermissionStore.cs b/src/AspNetCore.Identity.Permissions.MongoDB/PermissionStore.cs index 6ce4a3b..3db2c67 100644 --- a/src/AspNetCore.Identity.Permissions.MongoDB/PermissionStore.cs +++ b/src/AspNetCore.Identity.Permissions.MongoDB/PermissionStore.cs @@ -64,7 +64,7 @@ public class PermissionStore : PermissionSto public PermissionStore(TContext context, IdentityErrorDescriber describer = null) : base(describer) { - ArgumentNullException.ThrowIfNull(context); + Guard.ThrowIfNull(context); this.context = context; } @@ -87,7 +87,7 @@ public override async Task CreateAsync(TPermission permission, C { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentNullException.ThrowIfNull(permission); + Guard.ThrowIfNull(permission); permission.ConcurrencyStamp = Guid.NewGuid().ToString("N"); await this.PermissionsCollection.InsertOneAsync(permission, new InsertOneOptions(), cancellationToken); @@ -100,7 +100,7 @@ public override async Task UpdateAsync(TPermission permission, C { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentNullException.ThrowIfNull(permission); + Guard.ThrowIfNull(permission); string oldConcurrencyStamp = permission.ConcurrencyStamp; permission.ConcurrencyStamp = Guid.NewGuid().ToString("N"); @@ -118,7 +118,7 @@ public override async Task DeleteAsync(TPermission permission, C { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentNullException.ThrowIfNull(permission); + Guard.ThrowIfNull(permission); string oldConcurrencyStamp = permission.ConcurrencyStamp; permission.ConcurrencyStamp = Guid.NewGuid().ToString("N"); @@ -156,8 +156,8 @@ public override async Task AddToRoleAsync(TPermission permission, string normali { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentNullException.ThrowIfNull(permission); - ArgumentException.ThrowIfNullOrEmpty(normalizedRoleName); + Guard.ThrowIfNull(permission); + Guard.ThrowIfNullOrWhiteSpace(normalizedRoleName); TRole role = await this.FindRoleAsync(normalizedRoleName, cancellationToken); if (role is null) @@ -173,8 +173,8 @@ public override async Task RemoveFromRoleAsync(TPermission permission, string no { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentNullException.ThrowIfNull(permission); - ArgumentException.ThrowIfNullOrEmpty(normalizedRoleName); + Guard.ThrowIfNull(permission); + Guard.ThrowIfNullOrWhiteSpace(normalizedRoleName); TRole role = await this.FindRoleAsync(normalizedRoleName, cancellationToken); if (role is null) @@ -190,7 +190,7 @@ public override async Task> GetRolesAsync(TPermission permission, { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentNullException.ThrowIfNull(permission); + Guard.ThrowIfNull(permission); if (permission.Roles.Any()) { @@ -208,7 +208,7 @@ public override async Task> GetRoleIdsAsync(TPermission permission { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentNullException.ThrowIfNull(permission); + Guard.ThrowIfNull(permission); if (permission.Roles.Any()) { @@ -228,8 +228,8 @@ public override async Task IsInRoleAsync(TPermission permission, string no { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentNullException.ThrowIfNull(permission); - ArgumentException.ThrowIfNullOrEmpty(normalizedRoleName); + Guard.ThrowIfNull(permission); + Guard.ThrowIfNullOrWhiteSpace(normalizedRoleName); TRole role = await this.RolesCollection.Find(x => x.NormalizedName == normalizedRoleName).FirstOrDefaultAsync(cancellationToken); return role is not null && permission.Roles.Any(x => x.Equals(role.Id)); @@ -240,7 +240,7 @@ public override async Task> GetPermissionsInRoleAsync(string { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentException.ThrowIfNullOrEmpty(normalizedRoleName); + Guard.ThrowIfNullOrWhiteSpace(normalizedRoleName); TRole role = await this.FindRoleAsync(normalizedRoleName, cancellationToken); if (role is not null) diff --git a/src/AspNetCore.Identity.Permissions.MongoDB/TenantStore.cs b/src/AspNetCore.Identity.Permissions.MongoDB/TenantStore.cs index 176121b..45e883a 100644 --- a/src/AspNetCore.Identity.Permissions.MongoDB/TenantStore.cs +++ b/src/AspNetCore.Identity.Permissions.MongoDB/TenantStore.cs @@ -52,7 +52,7 @@ public class TenantStore : TenantStoreBase CreateAsync(TTenant tenant, Cancellat { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentNullException.ThrowIfNull(tenant); + Guard.ThrowIfNull(tenant); tenant.ConcurrencyStamp = Guid.NewGuid().ToString("N"); await this.TenantsCollection.InsertOneAsync(tenant, new InsertOneOptions(), cancellationToken); @@ -88,7 +88,7 @@ public override async Task UpdateAsync(TTenant tenant, Cancellat { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentNullException.ThrowIfNull(tenant); + Guard.ThrowIfNull(tenant); string oldConcurrencyStamp = tenant.ConcurrencyStamp; tenant.ConcurrencyStamp = Guid.NewGuid().ToString("N"); @@ -106,7 +106,7 @@ public override async Task DeleteAsync(TTenant tenant, Cancellat { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentNullException.ThrowIfNull(tenant); + Guard.ThrowIfNull(tenant); string oldConcurrencyStamp = tenant.ConcurrencyStamp; tenant.ConcurrencyStamp = Guid.NewGuid().ToString("N"); @@ -161,8 +161,8 @@ public override async Task AddToRoleAsync(TTenant tenant, string normalizedRoleN { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentNullException.ThrowIfNull(tenant); - ArgumentException.ThrowIfNullOrEmpty(normalizedRoleName); + Guard.ThrowIfNull(tenant); + Guard.ThrowIfNullOrWhiteSpace(normalizedRoleName); TRole role = await this.FindRoleAsync(normalizedRoleName, cancellationToken); if (role is null) @@ -178,8 +178,8 @@ public override async Task RemoveFromRoleAsync(TTenant tenant, string normalized { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentNullException.ThrowIfNull(tenant); - ArgumentException.ThrowIfNullOrEmpty(normalizedRoleName); + Guard.ThrowIfNull(tenant); + Guard.ThrowIfNullOrWhiteSpace(normalizedRoleName); TRole role = await this.FindRoleAsync(normalizedRoleName, cancellationToken); if (role is not null) @@ -193,7 +193,7 @@ public override async Task> GetRolesAsync(TTenant tenant, Cancella { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentNullException.ThrowIfNull(tenant); + Guard.ThrowIfNull(tenant); if (tenant.Roles.Any()) { @@ -211,7 +211,7 @@ public override async Task> GetRoleIdsAsync(TTenant tenant, Cancel { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentNullException.ThrowIfNull(tenant); + Guard.ThrowIfNull(tenant); if (tenant.Roles.Any()) { @@ -231,8 +231,8 @@ public override async Task IsInRoleAsync(TTenant tenant, string normalized { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentNullException.ThrowIfNull(tenant); - ArgumentException.ThrowIfNullOrEmpty(normalizedRoleName); + Guard.ThrowIfNull(tenant); + Guard.ThrowIfNullOrWhiteSpace(normalizedRoleName); TRole role = await this.RolesCollection.Find(x => x.NormalizedName == normalizedRoleName).FirstOrDefaultAsync(cancellationToken); return role is not null && tenant.Roles.Any(x => x.Equals(role.Id)); @@ -243,7 +243,7 @@ public override async Task> GetTenantsInRoleAsync(string normaliz { cancellationToken.ThrowIfCancellationRequested(); this.ThrowIfDisposed(); - ArgumentException.ThrowIfNullOrEmpty(normalizedRoleName); + Guard.ThrowIfNullOrWhiteSpace(normalizedRoleName); TRole role = await this.FindRoleAsync(normalizedRoleName, cancellationToken); if (role is not null) diff --git a/src/AspNetCore.Identity.Permissions/AspNetCore.Identity.Permissions.csproj b/src/AspNetCore.Identity.Permissions/AspNetCore.Identity.Permissions.csproj index 0e72efa..e23e0f1 100644 --- a/src/AspNetCore.Identity.Permissions/AspNetCore.Identity.Permissions.csproj +++ b/src/AspNetCore.Identity.Permissions/AspNetCore.Identity.Permissions.csproj @@ -1,7 +1,7 @@ - net8.0 + net6.0;net7.0;net8.0 latest disable disable @@ -14,9 +14,9 @@ MadEyeMatt.AspNetCore.Identity.Permissions false Copyright © 2022-2023 Matthias Gernand. All rights reserved. - 8.5.0 - 8.5.0 - 8.5.0 + 8.5.1 + 8.5.1 + 8.5.1 Matthias Gernand A libary that adds permission-based authorization. en 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 3eeffb1..4e6733a 100644 --- a/src/Extensions.Identity.Permissions.Core/Extensions.Identity.Permissions.Core.csproj +++ b/src/Extensions.Identity.Permissions.Core/Extensions.Identity.Permissions.Core.csproj @@ -1,7 +1,7 @@ - net8.0 + net6.0;net7.0;net8.0 latest disable disable @@ -14,9 +14,9 @@ MadEyeMatt.AspNetCore.Identity.Permissions false Copyright © 2022-2023 Matthias Gernand. All rights reserved. - 8.5.0 - 8.5.0 - 8.5.0 + 8.5.1 + 8.5.1 + 8.5.1 Matthias Gernand A libary that adds permission-based authorization. en 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 74f9973..5d05947 100644 --- a/src/Extensions.Identity.Permissions.Stores/Extensions.Identity.Permissions.Stores.csproj +++ b/src/Extensions.Identity.Permissions.Stores/Extensions.Identity.Permissions.Stores.csproj @@ -1,7 +1,7 @@ - net8.0 + net6.0;net7.0;net8.0 latest disable disable @@ -14,9 +14,9 @@ MadEyeMatt.AspNetCore.Identity.Permissions false Copyright © 2022-2023 Matthias Gernand. All rights reserved. - 8.5.0 - 8.5.0 - 8.5.0 + 8.5.1 + 8.5.1 + 8.5.1 Matthias Gernand A libary that adds permission-based authorization. en diff --git a/tests/AspNetCore.Authorization.Permissions.UnitTests/AspNetCore.Authorization.Permissions.UnitTests.csproj b/tests/AspNetCore.Authorization.Permissions.UnitTests/AspNetCore.Authorization.Permissions.UnitTests.csproj index 9e59656..9d64324 100644 --- a/tests/AspNetCore.Authorization.Permissions.UnitTests/AspNetCore.Authorization.Permissions.UnitTests.csproj +++ b/tests/AspNetCore.Authorization.Permissions.UnitTests/AspNetCore.Authorization.Permissions.UnitTests.csproj @@ -1,7 +1,7 @@  - net8.0 + net6.0;net7.0;net8.0 latest disable disable diff --git a/tests/AspNetCore.Identity.Permissions.EntityFrameworkCore.IntegrationTests/AspNetCore.Identity.Permissions.EntityFrameworkCore.IntegrationTests.csproj b/tests/AspNetCore.Identity.Permissions.EntityFrameworkCore.IntegrationTests/AspNetCore.Identity.Permissions.EntityFrameworkCore.IntegrationTests.csproj index add606f..015a6da 100644 --- a/tests/AspNetCore.Identity.Permissions.EntityFrameworkCore.IntegrationTests/AspNetCore.Identity.Permissions.EntityFrameworkCore.IntegrationTests.csproj +++ b/tests/AspNetCore.Identity.Permissions.EntityFrameworkCore.IntegrationTests/AspNetCore.Identity.Permissions.EntityFrameworkCore.IntegrationTests.csproj @@ -1,7 +1,7 @@ - net8.0 + net6.0;net7.0;net8.0 latest disable disable diff --git a/tests/AspNetCore.Identity.Permissions.MongoDB.IntegrationTests/AspNetCore.Identity.Permissions.MongoDB.IntegrationTests.csproj b/tests/AspNetCore.Identity.Permissions.MongoDB.IntegrationTests/AspNetCore.Identity.Permissions.MongoDB.IntegrationTests.csproj index 89ba881..382cc40 100644 --- a/tests/AspNetCore.Identity.Permissions.MongoDB.IntegrationTests/AspNetCore.Identity.Permissions.MongoDB.IntegrationTests.csproj +++ b/tests/AspNetCore.Identity.Permissions.MongoDB.IntegrationTests/AspNetCore.Identity.Permissions.MongoDB.IntegrationTests.csproj @@ -1,7 +1,7 @@ - net8.0 + net6.0;net7.0;net8.0 latest disable disable