From 5d3c4f89715b1d269aee69a62df6c784a52e0140 Mon Sep 17 00:00:00 2001 From: thomasduft Date: Wed, 20 Dec 2023 09:14:46 +0000 Subject: [PATCH] updated to latest nuget versions and added support for OpenIddict 5 --- .config/dotnet-tools.json | 6 + .editorconfig | 3 + samples/Api/Api.csproj | 4 +- ...31220090227_OpenIddict5Support.Designer.cs | 269 ++++++++++++++++++ .../UI/20231220090227_OpenIddict5Support.cs | 59 ++++ .../UI/OpenIddictUIContextModelSnapshot.cs | 27 +- samples/Server/Server.csproj | 24 +- samples/Server/Services/MigrationService.cs | 21 +- .../Account/AccountApiService.cs | 5 +- .../Account/UserViewModel.cs | 4 +- .../ClaimType/ClaimTypeApiService.cs | 10 +- .../Role/RoleApiService.cs | 20 +- .../tomware.OpenIddict.UI.Identity.Api.csproj | 16 +- .../DTOs/UserInfo.cs | 4 +- .../Services/ClaimTypeService.cs | 5 +- ...tomware.OpenIddict.UI.Identity.Core.csproj | 4 +- .../Services/AccountService.cs | 5 +- ...enIddict.UI.Identity.Infrastructure.csproj | 14 +- .../Application/ApplicationApiService.cs | 51 ++-- .../Application/ApplicationViewModel.cs | 6 +- .../OpenIddict.UI.Api/Scope/ScopeService.cs | 20 +- .../tomware.OpenIddict.UI.Api.csproj | 14 +- .../DTOs/ApplicationInfo.cs | 6 +- .../DTOs/ApplicationParam.cs | 8 +- .../DTOs/ScopeInfo.cs | 2 +- .../DTOs/ScopeParam.cs | 2 +- .../Services/ApplicationService.cs | 72 ++--- .../Services/ScopeService.cs | 17 +- ...omware.OpenIddict.UI.Infrastructure.csproj | 16 +- .../Extensions/RoutePrefixExtension.cs | 4 +- .../tomware.OpenIddict.UI.Suite.Api.csproj | 14 +- .../Common/SimpleMapper.cs | 4 +- .../Specifications/BaseSpecification.cs | 8 +- .../tomware.OpenIddict.UI.Suite.Core.csproj | 2 +- tests/Helpers/HttpExtensions.cs | 10 +- tests/Helpers/IntegrationContext.cs | 14 +- tests/Integration/ApplicationApiTest.cs | 10 +- tests/OpenIddict.UI.Tests.csproj | 12 +- 38 files changed, 546 insertions(+), 246 deletions(-) create mode 100644 samples/Server/Models/Data/UI/20231220090227_OpenIddict5Support.Designer.cs create mode 100644 samples/Server/Models/Data/UI/20231220090227_OpenIddict5Support.cs diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 29b7cf4..5c9061d 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -13,6 +13,12 @@ "commands": [ "dotnet-outdated" ] + }, + "dotnet-ef": { + "version": "8.0.0", + "commands": [ + "dotnet-ef" + ] } } } \ No newline at end of file diff --git a/.editorconfig b/.editorconfig index dbd293c..5619b8d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -71,6 +71,9 @@ dotnet_diagnostic.CA1848.severity = none # CA1852: Type 'Program' can be sealed because it has no subtypes in its containing assembly and is not externally visible dotnet_diagnostic.CA1852.severity = none +# IDE0290: Use primary constructor (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0290) +dotnet_diagnostic.IDE0290.severity = none + ########################################## # Language Rules # https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/language-rules diff --git a/samples/Api/Api.csproj b/samples/Api/Api.csproj index 1af4960..55f54ed 100644 --- a/samples/Api/Api.csproj +++ b/samples/Api/Api.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/samples/Server/Models/Data/UI/20231220090227_OpenIddict5Support.Designer.cs b/samples/Server/Models/Data/UI/20231220090227_OpenIddict5Support.Designer.cs new file mode 100644 index 0000000..e211f3b --- /dev/null +++ b/samples/Server/Models/Data/UI/20231220090227_OpenIddict5Support.Designer.cs @@ -0,0 +1,269 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using tomware.OpenIddict.UI.Infrastructure; + +#nullable disable + +namespace Server.Models.Data.UI +{ + [DbContext(typeof(OpenIddictUIContext))] + [Migration("20231220090227_OpenIddict5Support")] + partial class OpenIddict5Support + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "8.0.0"); + + modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreApplication", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("ApplicationType") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("ClientId") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("ClientSecret") + .HasColumnType("TEXT"); + + b.Property("ClientType") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("ConsentType") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("DisplayName") + .HasColumnType("TEXT"); + + b.Property("DisplayNames") + .HasColumnType("TEXT"); + + b.Property("JsonWebKeySet") + .HasColumnType("TEXT"); + + b.Property("Permissions") + .HasColumnType("TEXT"); + + b.Property("PostLogoutRedirectUris") + .HasColumnType("TEXT"); + + b.Property("Properties") + .HasColumnType("TEXT"); + + b.Property("RedirectUris") + .HasColumnType("TEXT"); + + b.Property("Requirements") + .HasColumnType("TEXT"); + + b.Property("Settings") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ClientId") + .IsUnique(); + + b.ToTable("OpenIddictApplications", (string)null); + }); + + modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreAuthorization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("ApplicationId") + .HasColumnType("TEXT"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CreationDate") + .HasColumnType("TEXT"); + + b.Property("Properties") + .HasColumnType("TEXT"); + + b.Property("Scopes") + .HasColumnType("TEXT"); + + b.Property("Status") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Subject") + .HasMaxLength(400) + .HasColumnType("TEXT"); + + b.Property("Type") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationId", "Status", "Subject", "Type"); + + b.ToTable("OpenIddictAuthorizations", (string)null); + }); + + modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Description") + .HasColumnType("TEXT"); + + b.Property("Descriptions") + .HasColumnType("TEXT"); + + b.Property("DisplayName") + .HasColumnType("TEXT"); + + b.Property("DisplayNames") + .HasColumnType("TEXT"); + + b.Property("Name") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property("Properties") + .HasColumnType("TEXT"); + + b.Property("Resources") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("OpenIddictScopes", (string)null); + }); + + modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("ApplicationId") + .HasColumnType("TEXT"); + + b.Property("AuthorizationId") + .HasColumnType("TEXT"); + + b.Property("ConcurrencyToken") + .IsConcurrencyToken() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("CreationDate") + .HasColumnType("TEXT"); + + b.Property("ExpirationDate") + .HasColumnType("TEXT"); + + b.Property("Payload") + .HasColumnType("TEXT"); + + b.Property("Properties") + .HasColumnType("TEXT"); + + b.Property("RedemptionDate") + .HasColumnType("TEXT"); + + b.Property("ReferenceId") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("Status") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.Property("Subject") + .HasMaxLength(400) + .HasColumnType("TEXT"); + + b.Property("Type") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("AuthorizationId"); + + b.HasIndex("ReferenceId") + .IsUnique(); + + b.HasIndex("ApplicationId", "Status", "Subject", "Type"); + + b.ToTable("OpenIddictTokens", (string)null); + }); + + modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreAuthorization", b => + { + b.HasOne("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreApplication", "Application") + .WithMany("Authorizations") + .HasForeignKey("ApplicationId"); + + b.Navigation("Application"); + }); + + modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreToken", b => + { + b.HasOne("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreApplication", "Application") + .WithMany("Tokens") + .HasForeignKey("ApplicationId"); + + b.HasOne("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreAuthorization", "Authorization") + .WithMany("Tokens") + .HasForeignKey("AuthorizationId"); + + b.Navigation("Application"); + + b.Navigation("Authorization"); + }); + + modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreApplication", b => + { + b.Navigation("Authorizations"); + + b.Navigation("Tokens"); + }); + + modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreAuthorization", b => + { + b.Navigation("Tokens"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/samples/Server/Models/Data/UI/20231220090227_OpenIddict5Support.cs b/samples/Server/Models/Data/UI/20231220090227_OpenIddict5Support.cs new file mode 100644 index 0000000..f1677f2 --- /dev/null +++ b/samples/Server/Models/Data/UI/20231220090227_OpenIddict5Support.cs @@ -0,0 +1,59 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Server.Models.Data.UI +{ + /// + public partial class OpenIddict5Support : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.RenameColumn( + name: "Type", + table: "OpenIddictApplications", + newName: "ClientType"); + + migrationBuilder.AddColumn( + name: "ApplicationType", + table: "OpenIddictApplications", + type: "TEXT", + maxLength: 50, + nullable: true); + + migrationBuilder.AddColumn( + name: "JsonWebKeySet", + table: "OpenIddictApplications", + type: "TEXT", + nullable: true); + + migrationBuilder.AddColumn( + name: "Settings", + table: "OpenIddictApplications", + type: "TEXT", + nullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ApplicationType", + table: "OpenIddictApplications"); + + migrationBuilder.DropColumn( + name: "JsonWebKeySet", + table: "OpenIddictApplications"); + + migrationBuilder.DropColumn( + name: "Settings", + table: "OpenIddictApplications"); + + migrationBuilder.RenameColumn( + name: "ClientType", + table: "OpenIddictApplications", + newName: "Type"); + } + } +} diff --git a/samples/Server/Models/Data/UI/OpenIddictUIContextModelSnapshot.cs b/samples/Server/Models/Data/UI/OpenIddictUIContextModelSnapshot.cs index 742bc90..1dbb190 100644 --- a/samples/Server/Models/Data/UI/OpenIddictUIContextModelSnapshot.cs +++ b/samples/Server/Models/Data/UI/OpenIddictUIContextModelSnapshot.cs @@ -5,6 +5,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using tomware.OpenIddict.UI.Infrastructure; +#nullable disable + namespace Server.Models.Data.UI { [DbContext(typeof(OpenIddictUIContext))] @@ -13,8 +15,7 @@ partial class OpenIddictUIContextModelSnapshot : ModelSnapshot protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "5.0.9"); + modelBuilder.HasAnnotation("ProductVersion", "8.0.0"); modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreApplication", b => { @@ -22,6 +23,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("TEXT"); + b.Property("ApplicationType") + .HasMaxLength(50) + .HasColumnType("TEXT"); + b.Property("ClientId") .HasMaxLength(100) .HasColumnType("TEXT"); @@ -29,6 +34,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("ClientSecret") .HasColumnType("TEXT"); + b.Property("ClientType") + .HasMaxLength(50) + .HasColumnType("TEXT"); + b.Property("ConcurrencyToken") .IsConcurrencyToken() .HasMaxLength(50) @@ -44,6 +53,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("DisplayNames") .HasColumnType("TEXT"); + b.Property("JsonWebKeySet") + .HasColumnType("TEXT"); + b.Property("Permissions") .HasColumnType("TEXT"); @@ -59,8 +71,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Requirements") .HasColumnType("TEXT"); - b.Property("Type") - .HasMaxLength(50) + b.Property("Settings") .HasColumnType("TEXT"); b.HasKey("Id"); @@ -68,7 +79,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("ClientId") .IsUnique(); - b.ToTable("OpenIddictApplications"); + b.ToTable("OpenIddictApplications", (string)null); }); modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreAuthorization", b => @@ -110,7 +121,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("ApplicationId", "Status", "Subject", "Type"); - b.ToTable("OpenIddictAuthorizations"); + b.ToTable("OpenIddictAuthorizations", (string)null); }); modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreScope", b => @@ -151,7 +162,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("Name") .IsUnique(); - b.ToTable("OpenIddictScopes"); + b.ToTable("OpenIddictScopes", (string)null); }); modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreToken", b => @@ -211,7 +222,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("ApplicationId", "Status", "Subject", "Type"); - b.ToTable("OpenIddictTokens"); + b.ToTable("OpenIddictTokens", (string)null); }); modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreAuthorization", b => diff --git a/samples/Server/Server.csproj b/samples/Server/Server.csproj index 4c2c7fc..73f5274 100644 --- a/samples/Server/Server.csproj +++ b/samples/Server/Server.csproj @@ -10,25 +10,25 @@ - - - + + + - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + - - - + + + - - - + + + diff --git a/samples/Server/Services/MigrationService.cs b/samples/Server/Services/MigrationService.cs index 8084aa7..4d239a5 100644 --- a/samples/Server/Services/MigrationService.cs +++ b/samples/Server/Services/MigrationService.cs @@ -6,6 +6,7 @@ using tomware.OpenIddict.UI.Identity.Infrastructure; using tomware.OpenIddict.UI.Infrastructure; using tomware.OpenIddict.UI.Suite.Core; + using static OpenIddict.Abstractions.OpenIddictConstants; namespace Server.Services; @@ -155,11 +156,11 @@ private static async Task EnsureAdministratorUser(IServiceProvider provider) var manager = provider.GetRequiredService>(); var user = await manager.FindByNameAsync(Constants.AdminMailAddress); - if (user != null) - { - return; - } - + if (user != null) + { + return; + } + var applicationUser = new ApplicationUser { UserName = Constants.AdminMailAddress, @@ -167,11 +168,11 @@ private static async Task EnsureAdministratorUser(IServiceProvider provider) }; var userResult = await manager.CreateAsync(applicationUser, "Pass123$"); - if (!userResult.Succeeded) - { - return; - } - + if (!userResult.Succeeded) + { + return; + } + await manager.SetLockoutEnabledAsync(applicationUser, false); await manager.AddToRoleAsync(applicationUser, Roles.Administrator); } diff --git a/src/identity/OpenIddict.UI.Identity.Api/Account/AccountApiService.cs b/src/identity/OpenIddict.UI.Identity.Api/Account/AccountApiService.cs index 675f522..bea25c6 100644 --- a/src/identity/OpenIddict.UI.Identity.Api/Account/AccountApiService.cs +++ b/src/identity/OpenIddict.UI.Identity.Api/Account/AccountApiService.cs @@ -90,10 +90,7 @@ public async Task GetUserAsync(string id) public async Task UpdateAsync(UserViewModel model) { - if (model == null) - { - throw new ArgumentNullException(nameof(model)); - } + ArgumentNullException.ThrowIfNull(model); if (string.IsNullOrWhiteSpace(model.Id)) { diff --git a/src/identity/OpenIddict.UI.Identity.Api/Account/UserViewModel.cs b/src/identity/OpenIddict.UI.Identity.Api/Account/UserViewModel.cs index 1afc6d1..d033441 100644 --- a/src/identity/OpenIddict.UI.Identity.Api/Account/UserViewModel.cs +++ b/src/identity/OpenIddict.UI.Identity.Api/Account/UserViewModel.cs @@ -24,7 +24,7 @@ public class UserViewModel public bool IsLockedOut { get; set; } - public List Claims { get; set; } = new List(); + public List Claims { get; set; } = []; - public List Roles { get; set; } = new List(); + public List Roles { get; set; } = []; } diff --git a/src/identity/OpenIddict.UI.Identity.Api/ClaimType/ClaimTypeApiService.cs b/src/identity/OpenIddict.UI.Identity.Api/ClaimType/ClaimTypeApiService.cs index 219e350..20ec784 100644 --- a/src/identity/OpenIddict.UI.Identity.Api/ClaimType/ClaimTypeApiService.cs +++ b/src/identity/OpenIddict.UI.Identity.Api/ClaimType/ClaimTypeApiService.cs @@ -51,10 +51,7 @@ public async Task GetAsync(Guid id) public async Task CreateAsync(ClaimTypeViewModel model) { - if (model == null) - { - throw new ArgumentNullException(nameof(model)); - } + ArgumentNullException.ThrowIfNull(model); var param = ToParam(model); @@ -63,10 +60,7 @@ public async Task CreateAsync(ClaimTypeViewModel model) public async Task UpdateAsync(ClaimTypeViewModel model) { - if (model == null) - { - throw new ArgumentNullException(nameof(model)); - } + ArgumentNullException.ThrowIfNull(model); if (!model.Id.HasValue) { diff --git a/src/identity/OpenIddict.UI.Identity.Api/Role/RoleApiService.cs b/src/identity/OpenIddict.UI.Identity.Api/Role/RoleApiService.cs index 3714ce8..c8626c6 100644 --- a/src/identity/OpenIddict.UI.Identity.Api/Role/RoleApiService.cs +++ b/src/identity/OpenIddict.UI.Identity.Api/Role/RoleApiService.cs @@ -43,10 +43,7 @@ public async Task> GetRolesAsync() public async Task GetAsync(string id) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } + ArgumentNullException.ThrowIfNull(id); var role = await _manager.FindByIdAsync(id); @@ -55,10 +52,7 @@ public async Task GetAsync(string id) public async Task CreateAsync(RoleViewModel model) { - if (model == null) - { - throw new ArgumentNullException(nameof(model)); - } + ArgumentNullException.ThrowIfNull(model); var newRole = new TIdentityRole { @@ -77,10 +71,7 @@ public async Task CreateAsync(RoleViewModel model) public async Task UpdateAsync(RoleViewModel model) { - if (model == null) - { - throw new ArgumentNullException(nameof(model)); - } + ArgumentNullException.ThrowIfNull(model); if (string.IsNullOrWhiteSpace(model.Id)) { @@ -95,10 +86,7 @@ public async Task UpdateAsync(RoleViewModel model) public async Task DeleteAsync(string id) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } + ArgumentNullException.ThrowIfNull(id); var role = await _manager.FindByIdAsync(id); diff --git a/src/identity/OpenIddict.UI.Identity.Api/tomware.OpenIddict.UI.Identity.Api.csproj b/src/identity/OpenIddict.UI.Identity.Api/tomware.OpenIddict.UI.Identity.Api.csproj index c3b3fb4..cd327fd 100644 --- a/src/identity/OpenIddict.UI.Identity.Api/tomware.OpenIddict.UI.Identity.Api.csproj +++ b/src/identity/OpenIddict.UI.Identity.Api/tomware.OpenIddict.UI.Identity.Api.csproj @@ -10,14 +10,14 @@ - - - - - - - - + + + + + + + + diff --git a/src/identity/OpenIddict.UI.Identity.Core/DTOs/UserInfo.cs b/src/identity/OpenIddict.UI.Identity.Core/DTOs/UserInfo.cs index 71cca38..6c6a754 100644 --- a/src/identity/OpenIddict.UI.Identity.Core/DTOs/UserInfo.cs +++ b/src/identity/OpenIddict.UI.Identity.Core/DTOs/UserInfo.cs @@ -20,7 +20,7 @@ public class UserInfo public bool IsLockedOut { get; set; } - public List Claims { get; set; } = new List(); + public List Claims { get; set; } = []; - public List Roles { get; set; } = new List(); + public List Roles { get; set; } = []; } diff --git a/src/identity/OpenIddict.UI.Identity.Core/Services/ClaimTypeService.cs b/src/identity/OpenIddict.UI.Identity.Core/Services/ClaimTypeService.cs index 2e6f7ae..1575006 100644 --- a/src/identity/OpenIddict.UI.Identity.Core/Services/ClaimTypeService.cs +++ b/src/identity/OpenIddict.UI.Identity.Core/Services/ClaimTypeService.cs @@ -37,10 +37,7 @@ public async Task GetAsync(Guid id) public async Task CreateAsync(ClaimTypeParam model) { - if (model == null) - { - throw new ArgumentNullException(nameof(model)); - } + ArgumentNullException.ThrowIfNull(model); var items = await _repository.ListAsync(new ClaimTypeByName(model.Name)); var entity = items.Count > 0 ? items[0] : null; diff --git a/src/identity/OpenIddict.UI.Identity.Core/tomware.OpenIddict.UI.Identity.Core.csproj b/src/identity/OpenIddict.UI.Identity.Core/tomware.OpenIddict.UI.Identity.Core.csproj index e3929b2..91ae102 100644 --- a/src/identity/OpenIddict.UI.Identity.Core/tomware.OpenIddict.UI.Identity.Core.csproj +++ b/src/identity/OpenIddict.UI.Identity.Core/tomware.OpenIddict.UI.Identity.Core.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/src/identity/OpenIddict.UI.Identity.Infrastructure/Services/AccountService.cs b/src/identity/OpenIddict.UI.Identity.Infrastructure/Services/AccountService.cs index dbc477e..c72553a 100644 --- a/src/identity/OpenIddict.UI.Identity.Infrastructure/Services/AccountService.cs +++ b/src/identity/OpenIddict.UI.Identity.Infrastructure/Services/AccountService.cs @@ -96,10 +96,7 @@ public async Task GetUserAsync(string id) public async Task UpdateAsync(UserParam model) { - if (model == null) - { - throw new ArgumentNullException(nameof(model)); - } + ArgumentNullException.ThrowIfNull(model); if (string.IsNullOrWhiteSpace(model.Id)) { diff --git a/src/identity/OpenIddict.UI.Identity.Infrastructure/tomware.OpenIddict.UI.Identity.Infrastructure.csproj b/src/identity/OpenIddict.UI.Identity.Infrastructure/tomware.OpenIddict.UI.Identity.Infrastructure.csproj index bc81148..51eddc8 100644 --- a/src/identity/OpenIddict.UI.Identity.Infrastructure/tomware.OpenIddict.UI.Identity.Infrastructure.csproj +++ b/src/identity/OpenIddict.UI.Identity.Infrastructure/tomware.OpenIddict.UI.Identity.Infrastructure.csproj @@ -9,13 +9,13 @@ - - - - - - - + + + + + + + diff --git a/src/openiddict/OpenIddict.UI.Api/Application/ApplicationApiService.cs b/src/openiddict/OpenIddict.UI.Api/Application/ApplicationApiService.cs index a3472b0..090a7c4 100644 --- a/src/openiddict/OpenIddict.UI.Api/Application/ApplicationApiService.cs +++ b/src/openiddict/OpenIddict.UI.Api/Application/ApplicationApiService.cs @@ -48,10 +48,7 @@ public async Task> GetApplicationsAsync() public async Task GetAsync(string clientId) { - if (clientId == null) - { - throw new ArgumentNullException(nameof(clientId)); - } + ArgumentNullException.ThrowIfNull(clientId); var claimType = await _service.GetAsync(clientId); @@ -60,10 +57,7 @@ public async Task GetAsync(string clientId) public async Task CreateAsync(ApplicationViewModel model) { - if (model == null) - { - throw new ArgumentNullException(nameof(model)); - } + ArgumentNullException.ThrowIfNull(model); var param = ToParam(model); @@ -72,10 +66,7 @@ public async Task CreateAsync(ApplicationViewModel model) public async Task UpdateAsync(ApplicationViewModel model) { - if (model == null) - { - throw new ArgumentNullException(nameof(model)); - } + ArgumentNullException.ThrowIfNull(model); if (string.IsNullOrWhiteSpace(model.Id)) { @@ -89,10 +80,7 @@ public async Task UpdateAsync(ApplicationViewModel model) public async Task DeleteAsync(string clientId) { - if (clientId == null) - { - throw new ArgumentNullException(nameof(clientId)); - } + ArgumentNullException.ThrowIfNull(clientId); await _service.DeleteAsync(clientId); } @@ -110,8 +98,35 @@ public async Task GetOptionsAsync() } private static ApplicationParam ToParam(ApplicationViewModel model) - => SimpleMapper.From(model); + { + return new ApplicationParam + { + Id = model.Id, + ClientId = model.ClientId, + DisplayName = model.DisplayName, + ClientSecret = model.ClientSecret, + Type = model.Type, + RequirePkce = model.RequirePkce, + RequireConsent = model.RequireConsent, + Permissions = model.Permissions, + RedirectUris = model.RedirectUris, + PostLogoutRedirectUris = model.PostLogoutRedirectUris + }; + } private static ApplicationViewModel ToModel(ApplicationInfo info) - => SimpleMapper.From(info); + { + return new ApplicationViewModel + { + Id = info.Id, + ClientId = info.ClientId, + DisplayName = info.DisplayName, + Type = info.Type, + RequirePkce = info.RequirePkce, + RequireConsent = info.RequireConsent, + Permissions = info.Permissions, + RedirectUris = info.RedirectUris, + PostLogoutRedirectUris = info.PostLogoutRedirectUris + }; + } } diff --git a/src/openiddict/OpenIddict.UI.Api/Application/ApplicationViewModel.cs b/src/openiddict/OpenIddict.UI.Api/Application/ApplicationViewModel.cs index f49431a..72e8e79 100644 --- a/src/openiddict/OpenIddict.UI.Api/Application/ApplicationViewModel.cs +++ b/src/openiddict/OpenIddict.UI.Api/Application/ApplicationViewModel.cs @@ -22,7 +22,7 @@ public class ApplicationViewModel public bool RequireConsent { get; set; } - public List Permissions { get; set; } = new List(); - public List RedirectUris { get; set; } = new List(); - public List PostLogoutRedirectUris { get; set; } = new List(); + public List Permissions { get; set; } = []; + public List RedirectUris { get; set; } = []; + public List PostLogoutRedirectUris { get; set; } = []; } diff --git a/src/openiddict/OpenIddict.UI.Api/Scope/ScopeService.cs b/src/openiddict/OpenIddict.UI.Api/Scope/ScopeService.cs index 4aadff8..44919f4 100644 --- a/src/openiddict/OpenIddict.UI.Api/Scope/ScopeService.cs +++ b/src/openiddict/OpenIddict.UI.Api/Scope/ScopeService.cs @@ -50,10 +50,7 @@ public async Task> GetScopeNamesAsync() public async Task GetAsync(string id) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } + ArgumentNullException.ThrowIfNull(id); var claimType = await _service.GetAsync(id); @@ -62,10 +59,7 @@ public async Task GetAsync(string id) public async Task CreateAsync(ScopeViewModel model) { - if (model == null) - { - throw new ArgumentNullException(nameof(model)); - } + ArgumentNullException.ThrowIfNull(model); var param = ToParam(model); @@ -74,10 +68,7 @@ public async Task CreateAsync(ScopeViewModel model) public async Task UpdateAsync(ScopeViewModel model) { - if (model == null) - { - throw new ArgumentNullException(nameof(model)); - } + ArgumentNullException.ThrowIfNull(model); if (string.IsNullOrWhiteSpace(model.Id)) { @@ -91,10 +82,7 @@ public async Task UpdateAsync(ScopeViewModel model) public async Task DeleteAsync(string id) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } + ArgumentNullException.ThrowIfNull(id); await _service.DeleteAsync(id); } diff --git a/src/openiddict/OpenIddict.UI.Api/tomware.OpenIddict.UI.Api.csproj b/src/openiddict/OpenIddict.UI.Api/tomware.OpenIddict.UI.Api.csproj index b77374c..7801880 100644 --- a/src/openiddict/OpenIddict.UI.Api/tomware.OpenIddict.UI.Api.csproj +++ b/src/openiddict/OpenIddict.UI.Api/tomware.OpenIddict.UI.Api.csproj @@ -9,13 +9,13 @@ - - - - - - - + + + + + + + diff --git a/src/openiddict/OpenIddict.UI.Infrastructure/DTOs/ApplicationInfo.cs b/src/openiddict/OpenIddict.UI.Infrastructure/DTOs/ApplicationInfo.cs index 5fb9cf0..e6ceec1 100644 --- a/src/openiddict/OpenIddict.UI.Infrastructure/DTOs/ApplicationInfo.cs +++ b/src/openiddict/OpenIddict.UI.Infrastructure/DTOs/ApplicationInfo.cs @@ -14,9 +14,9 @@ public class ApplicationInfo public bool RequireConsent { get; set; } - public List Permissions { get; set; } = new List(); - public List RedirectUris { get; set; } = new List(); - public List PostLogoutRedirectUris { get; set; } = new List(); + public List Permissions { get; set; } = []; + public List RedirectUris { get; set; } = []; + public List PostLogoutRedirectUris { get; set; } = []; public string Type { get; set; } } diff --git a/src/openiddict/OpenIddict.UI.Infrastructure/DTOs/ApplicationParam.cs b/src/openiddict/OpenIddict.UI.Infrastructure/DTOs/ApplicationParam.cs index 495e5aa..2132fbe 100644 --- a/src/openiddict/OpenIddict.UI.Infrastructure/DTOs/ApplicationParam.cs +++ b/src/openiddict/OpenIddict.UI.Infrastructure/DTOs/ApplicationParam.cs @@ -20,9 +20,9 @@ public class ApplicationParam /// public bool RequireConsent { get; set; } - public List Permissions { get; set; } = new List(); - public List RedirectUris { get; set; } = new List(); - public List PostLogoutRedirectUris { get; set; } = new List(); - public List Requirements { get; set; } = new List(); + public List Permissions { get; set; } = []; + public List RedirectUris { get; set; } = []; + public List PostLogoutRedirectUris { get; set; } = []; + public List Requirements { get; set; } = []; public string Type { get; set; } = ClientTypes.Public; } diff --git a/src/openiddict/OpenIddict.UI.Infrastructure/DTOs/ScopeInfo.cs b/src/openiddict/OpenIddict.UI.Infrastructure/DTOs/ScopeInfo.cs index b7e45a5..7f1bda6 100644 --- a/src/openiddict/OpenIddict.UI.Infrastructure/DTOs/ScopeInfo.cs +++ b/src/openiddict/OpenIddict.UI.Infrastructure/DTOs/ScopeInfo.cs @@ -9,5 +9,5 @@ public class ScopeInfo public string DisplayName { get; set; } public string Description { get; set; } public string Properties { get; set; } - public List Resources { get; set; } = new List(); + public List Resources { get; set; } = []; } diff --git a/src/openiddict/OpenIddict.UI.Infrastructure/DTOs/ScopeParam.cs b/src/openiddict/OpenIddict.UI.Infrastructure/DTOs/ScopeParam.cs index 31877ab..8135c9d 100644 --- a/src/openiddict/OpenIddict.UI.Infrastructure/DTOs/ScopeParam.cs +++ b/src/openiddict/OpenIddict.UI.Infrastructure/DTOs/ScopeParam.cs @@ -8,5 +8,5 @@ public class ScopeParam public string Name { get; set; } public string DisplayName { get; set; } public string Description { get; set; } - public List Resources { get; set; } = new List(); + public List Resources { get; set; } = []; } diff --git a/src/openiddict/OpenIddict.UI.Infrastructure/Services/ApplicationService.cs b/src/openiddict/OpenIddict.UI.Infrastructure/Services/ApplicationService.cs index ef5d05d..a06065a 100644 --- a/src/openiddict/OpenIddict.UI.Infrastructure/Services/ApplicationService.cs +++ b/src/openiddict/OpenIddict.UI.Infrastructure/Services/ApplicationService.cs @@ -30,15 +30,12 @@ public async Task> GetApplicationsAsync() { var items = await _repository.ListAsync(new AllApplications()); - return items.Select(ToListInfo); + return items.Select(ToInfo); } public async Task GetAsync(string id) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } + ArgumentNullException.ThrowIfNull(id); var entity = await _manager.FindByIdAsync(id); @@ -47,23 +44,14 @@ public async Task GetAsync(string id) public async Task CreateAsync(ApplicationParam model) { - if (model == null) - { - throw new ArgumentNullException(nameof(model)); - } + ArgumentNullException.ThrowIfNull(model); var entity = await _manager.FindByClientIdAsync(model.ClientId); if (entity == null) { // create new entity - var newEntity = new OpenIddictEntityFrameworkCoreApplication - { - ClientId = model.ClientId, - DisplayName = model.DisplayName, - Type = model.Type - }; - - HandleCustomProperties(model, newEntity); + var newEntity = new OpenIddictEntityFrameworkCoreApplication(); + MapProperties(model, newEntity); await _manager.CreateAsync(newEntity, model.ClientSecret); @@ -85,56 +73,52 @@ public async Task UpdateAsync(ApplicationParam model) } var entity = await _manager.FindByIdAsync(model.Id); - - SimpleMapper.Map(model, entity); - - HandleCustomProperties(model, entity); + MapProperties(model, entity); await _manager.UpdateAsync(entity, model.ClientSecret); } public async Task DeleteAsync(string id) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } + ArgumentNullException.ThrowIfNull(id); var entity = await _manager.FindByIdAsync(id); await _manager.DeleteAsync(entity); } - private static ApplicationInfo ToListInfo(OpenIddictEntityFrameworkCoreApplication entity) - => SimpleMapper.From(entity); - private static ApplicationInfo ToInfo(OpenIddictEntityFrameworkCoreApplication entity) { - var info = SimpleMapper - .From(entity); - - info.RequireConsent = entity.ConsentType == ConsentTypes.Explicit; - info.Permissions = entity.Permissions != null + return new ApplicationInfo + { + Id = entity.Id, + ClientId = entity.ClientId, + DisplayName = entity.DisplayName, + Type = entity.ClientType, + RequirePkce = entity.Requirements != null && JsonSerializer + .Deserialize>(entity.Requirements) + .Contains(Requirements.Features.ProofKeyForCodeExchange), + RequireConsent = entity.ConsentType == ConsentTypes.Explicit, + Permissions = entity.Permissions != null ? JsonSerializer.Deserialize>(entity.Permissions) - : new List(); - info.RedirectUris = entity.RedirectUris != null + : [], + RedirectUris = entity.RedirectUris != null ? JsonSerializer.Deserialize>(entity.RedirectUris) - : new List(); - info.PostLogoutRedirectUris = entity.PostLogoutRedirectUris != null + : [], + PostLogoutRedirectUris = entity.PostLogoutRedirectUris != null ? JsonSerializer.Deserialize>(entity.PostLogoutRedirectUris) - : new List(); - info.RequirePkce = entity.Requirements != null && JsonSerializer - .Deserialize>(entity.Requirements) - .Contains(Requirements.Features.ProofKeyForCodeExchange); - - return info; + : [] + }; } - private static void HandleCustomProperties( + private static void MapProperties( ApplicationParam model, OpenIddictEntityFrameworkCoreApplication entity ) { + entity.ClientId = model.ClientId; + entity.DisplayName = model.DisplayName; + entity.ClientType = model.Type; entity.ConsentType = model.RequireConsent ? ConsentTypes.Explicit : ConsentTypes.Implicit; entity.Permissions = JsonSerializer.Serialize(model.Permissions); entity.RedirectUris = JsonSerializer.Serialize(model.RedirectUris); diff --git a/src/openiddict/OpenIddict.UI.Infrastructure/Services/ScopeService.cs b/src/openiddict/OpenIddict.UI.Infrastructure/Services/ScopeService.cs index e67369d..bd62178 100644 --- a/src/openiddict/OpenIddict.UI.Infrastructure/Services/ScopeService.cs +++ b/src/openiddict/OpenIddict.UI.Infrastructure/Services/ScopeService.cs @@ -34,10 +34,7 @@ public async Task> GetScopesAsync() public async Task GetAsync(string id) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } + ArgumentNullException.ThrowIfNull(id); var entity = await _manager.FindByIdAsync(id); @@ -46,10 +43,7 @@ public async Task GetAsync(string id) public async Task CreateAsync(ScopeParam model) { - if (model == null) - { - throw new ArgumentNullException(nameof(model)); - } + ArgumentNullException.ThrowIfNull(model); var entity = await _manager.FindByNameAsync(model.Name); if (entity == null) @@ -94,10 +88,7 @@ public async Task UpdateAsync(ScopeParam model) public async Task DeleteAsync(string id) { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } + ArgumentNullException.ThrowIfNull(id); var entity = await _manager.FindByIdAsync(id); @@ -111,7 +102,7 @@ private static ScopeInfo ToInfo(OpenIddictEntityFrameworkCoreScope entity) info.Resources = entity.Resources != null ? JsonSerializer.Deserialize>(entity.Resources) - : new List(); + : []; return info; } diff --git a/src/openiddict/OpenIddict.UI.Infrastructure/tomware.OpenIddict.UI.Infrastructure.csproj b/src/openiddict/OpenIddict.UI.Infrastructure/tomware.OpenIddict.UI.Infrastructure.csproj index d87eeae..764be1b 100644 --- a/src/openiddict/OpenIddict.UI.Infrastructure/tomware.OpenIddict.UI.Infrastructure.csproj +++ b/src/openiddict/OpenIddict.UI.Infrastructure/tomware.OpenIddict.UI.Infrastructure.csproj @@ -9,14 +9,14 @@ - - - - - - - - + + + + + + + + diff --git a/src/suite/OpenIddict.UI.Suite.Api/Extensions/RoutePrefixExtension.cs b/src/suite/OpenIddict.UI.Suite.Api/Extensions/RoutePrefixExtension.cs index 6e9c572..5043365 100644 --- a/src/suite/OpenIddict.UI.Suite.Api/Extensions/RoutePrefixExtension.cs +++ b/src/suite/OpenIddict.UI.Suite.Api/Extensions/RoutePrefixExtension.cs @@ -49,7 +49,7 @@ public void Apply(ApplicationModel application) return x.AttributeRouteModel != null; }) .ToList(); - if (matchedSelectors.Any()) + if (matchedSelectors.Count != 0) { foreach (var selectorModel in matchedSelectors) { @@ -64,7 +64,7 @@ public void Apply(ApplicationModel application) return x.AttributeRouteModel == null; }) .ToList(); - if (unmatchedSelectors.Any()) + if (unmatchedSelectors.Count != 0) { foreach (var selectorModel in unmatchedSelectors) { diff --git a/src/suite/OpenIddict.UI.Suite.Api/tomware.OpenIddict.UI.Suite.Api.csproj b/src/suite/OpenIddict.UI.Suite.Api/tomware.OpenIddict.UI.Suite.Api.csproj index e11c774..cae27f5 100644 --- a/src/suite/OpenIddict.UI.Suite.Api/tomware.OpenIddict.UI.Suite.Api.csproj +++ b/src/suite/OpenIddict.UI.Suite.Api/tomware.OpenIddict.UI.Suite.Api.csproj @@ -9,13 +9,13 @@ - - - - - - - + + + + + + + diff --git a/src/suite/OpenIddict.UI.Suite.Core/Common/SimpleMapper.cs b/src/suite/OpenIddict.UI.Suite.Core/Common/SimpleMapper.cs index e000141..2b83602 100644 --- a/src/suite/OpenIddict.UI.Suite.Core/Common/SimpleMapper.cs +++ b/src/suite/OpenIddict.UI.Suite.Core/Common/SimpleMapper.cs @@ -42,7 +42,7 @@ private static void MapTypes(Type source, Type target) } var props = GetMatchingProperties(source, target); - Maps.TryAdd(key, props.ToArray()); + Maps.TryAdd(key, [.. props]); } #pragma warning disable CA1822 @@ -68,7 +68,7 @@ private void Copy(object source, object target) } #pragma warning restore CA1822 - private static IList GetMatchingProperties(Type source, Type target) + private static List GetMatchingProperties(Type source, Type target) { var sourceProperties = source.GetProperties(); var targetProperties = target.GetProperties(); diff --git a/src/suite/OpenIddict.UI.Suite.Core/Specifications/BaseSpecification.cs b/src/suite/OpenIddict.UI.Suite.Core/Specifications/BaseSpecification.cs index 8566c89..e2ebcec 100644 --- a/src/suite/OpenIddict.UI.Suite.Core/Specifications/BaseSpecification.cs +++ b/src/suite/OpenIddict.UI.Suite.Core/Specifications/BaseSpecification.cs @@ -6,11 +6,9 @@ namespace tomware.OpenIddict.UI.Suite.Core; public abstract class BaseSpecification : ISpecification { - public List>> Criteria { get; } - = new List>>(); - public List>> Includes { get; } - = new List>>(); - public List IncludeStrings { get; } = new List(); + public List>> Criteria { get; } = []; + public List>> Includes { get; } = []; + public List IncludeStrings { get; } = []; public Expression> OrderBy { get; private set; } public Expression> OrderByDescending { get; private set; } public Expression> GroupBy { get; private set; } diff --git a/src/suite/OpenIddict.UI.Suite.Core/tomware.OpenIddict.UI.Suite.Core.csproj b/src/suite/OpenIddict.UI.Suite.Core/tomware.OpenIddict.UI.Suite.Core.csproj index 7294044..146476f 100644 --- a/src/suite/OpenIddict.UI.Suite.Core/tomware.OpenIddict.UI.Suite.Core.csproj +++ b/src/suite/OpenIddict.UI.Suite.Core/tomware.OpenIddict.UI.Suite.Core.csproj @@ -9,7 +9,7 @@ - + diff --git a/tests/Helpers/HttpExtensions.cs b/tests/Helpers/HttpExtensions.cs index c526422..b8199fa 100644 --- a/tests/Helpers/HttpExtensions.cs +++ b/tests/Helpers/HttpExtensions.cs @@ -6,13 +6,15 @@ namespace tomware.OpenIddict.UI.Tests; public static class HttpExtensions { + private static readonly JsonSerializerOptions JsonSerializerOptions = new() + { + PropertyNamingPolicy = JsonNamingPolicy.CamelCase + }; + public static async Task ReadAsJsonAsync(this HttpContent httpContent) { var obj = await httpContent.ReadAsStringAsync(); - return JsonSerializer.Deserialize(obj, new JsonSerializerOptions - { - PropertyNamingPolicy = JsonNamingPolicy.CamelCase - }); + return JsonSerializer.Deserialize(obj, JsonSerializerOptions); } } diff --git a/tests/Helpers/IntegrationContext.cs b/tests/Helpers/IntegrationContext.cs index 9dcaad3..30f4d9a 100644 --- a/tests/Helpers/IntegrationContext.cs +++ b/tests/Helpers/IntegrationContext.cs @@ -13,6 +13,11 @@ namespace tomware.OpenIddict.UI.Tests.Helpers; public class IntegrationContext : IClassFixture> { + private static readonly JsonSerializerOptions JsonSerializerOptions = new() + { + PropertyNamingPolicy = JsonNamingPolicy.CamelCase + }; + private readonly IntegrationApplicationFactory _factory; private readonly HttpClient _client; private readonly string _accessToken; @@ -30,13 +35,8 @@ protected IntegrationContext(IntegrationApplicationFactory factory) _accessToken = _factory.AccessToken; } - protected static T Deserialize(string responseBody) - { - return JsonSerializer.Deserialize(responseBody, new JsonSerializerOptions - { - PropertyNamingPolicy = JsonNamingPolicy.CamelCase - }); - } + protected static T Deserialize(string responseBody) + => JsonSerializer.Deserialize(responseBody, JsonSerializerOptions); protected async Task GetAsync( string endpoint, diff --git a/tests/Integration/ApplicationApiTest.cs b/tests/Integration/ApplicationApiTest.cs index 7365e31..daad7e5 100644 --- a/tests/Integration/ApplicationApiTest.cs +++ b/tests/Integration/ApplicationApiTest.cs @@ -211,7 +211,7 @@ public async Task GetOptionsAsyncReturnsAListOfApplicationOptions() var model = await response.Content.ReadAsJsonAsync(); Assert.NotNull(model); - Assert.True(model.Types.Count == 2); + Assert.Equal(2, model.Types.Count); } private static ApplicationViewModel GetPublicApplicationViewModel(string id = null) @@ -224,9 +224,9 @@ private static ApplicationViewModel GetPublicApplicationViewModel(string id = nu // ClientSecret = "clientsecret", // only when Type is confidential RequirePkce = false, RequireConsent = false, - Permissions = new List { "somePermission " }, - RedirectUris = new List { "https://tomware.ch/redirect" }, - PostLogoutRedirectUris = new List { "https://tomware.ch/postLogout" }, + Permissions = ["somePermission "], + RedirectUris = ["https://tomware.ch/redirect"], + PostLogoutRedirectUris = ["https://tomware.ch/postLogout"], Type = ClientTypes.Public }; } @@ -241,7 +241,7 @@ private static ApplicationViewModel GetConfidentialApplicationViewModel(string i ClientSecret = "clientsecret", // only when Type is confidential RequirePkce = false, RequireConsent = false, - Permissions = new List { "somePermission " }, + Permissions = ["somePermission "], Type = ClientTypes.Confidential }; } diff --git a/tests/OpenIddict.UI.Tests.csproj b/tests/OpenIddict.UI.Tests.csproj index 117b118..c653d09 100644 --- a/tests/OpenIddict.UI.Tests.csproj +++ b/tests/OpenIddict.UI.Tests.csproj @@ -8,15 +8,15 @@ - - - - - + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all