From 2d21ee1837f096d288805260a725db1e622febea Mon Sep 17 00:00:00 2001 From: janskoruba Date: Sun, 19 Dec 2021 20:53:28 +0100 Subject: [PATCH 01/23] Update packages --- ...uba.Duende.IdentityServer.Admin.Api.csproj | 66 +++++----- ...Server.Admin.BusinessLogic.Identity.csproj | 5 +- ...tyServer.Admin.BusinessLogic.Shared.csproj | 2 +- ....IdentityServer.Admin.BusinessLogic.csproj | 2 +- ...Admin.EntityFramework.Configuration.csproj | 11 +- ...er.Admin.EntityFramework.Extensions.csproj | 2 +- ...rver.Admin.EntityFramework.Identity.csproj | 4 +- ...yServer.Admin.EntityFramework.MySql.csproj | 7 +- ...er.Admin.EntityFramework.PostgreSQL.csproj | 9 +- ...Server.Admin.EntityFramework.Shared.csproj | 6 +- ...ver.Admin.EntityFramework.SqlServer.csproj | 7 +- ...dentityServer.Admin.EntityFramework.csproj | 3 +- ...ruba.Duende.IdentityServer.Admin.UI.csproj | 19 ++- ...Skoruba.Duende.IdentityServer.Admin.csproj | 114 ++++++++---------- ....Duende.IdentityServer.STS.Identity.csproj | 65 +++++----- ...IdentityServer.Shared.Configuration.csproj | 16 +-- ...koruba.Duende.IdentityServer.Shared.csproj | 6 +- ...uende.IdentityServerAdmin.Admin.Api.csproj | 2 +- ...erAdmin.Admin.EntityFramework.MySql.csproj | 2 +- ...in.Admin.EntityFramework.PostgreSQL.csproj | 2 +- ...rAdmin.Admin.EntityFramework.Shared.csproj | 2 +- ...min.Admin.EntityFramework.SqlServer.csproj | 2 +- ...ubaDuende.IdentityServerAdmin.Admin.csproj | 2 +- ...de.IdentityServerAdmin.STS.Identity.csproj | 2 +- ...baDuende.IdentityServerAdmin.Shared.csproj | 2 +- ...tyServer.Admin.Api.IntegrationTests.csproj | 2 +- ....IdentityServer.Admin.Api.UnitTests.csproj | 2 +- ...entityServer.Admin.IntegrationTests.csproj | 2 +- ...ende.IdentityServer.Admin.UnitTests.csproj | 2 +- ...erver.STS.Identity.IntegrationTests.csproj | 2 +- 30 files changed, 170 insertions(+), 200 deletions(-) diff --git a/src/Skoruba.Duende.IdentityServer.Admin.Api/Skoruba.Duende.IdentityServer.Admin.Api.csproj b/src/Skoruba.Duende.IdentityServer.Admin.Api/Skoruba.Duende.IdentityServer.Admin.Api.csproj index 42e9018c8..e9a58fc3b 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.Api/Skoruba.Duende.IdentityServer.Admin.Api.csproj +++ b/src/Skoruba.Duende.IdentityServer.Admin.Api/Skoruba.Duende.IdentityServer.Admin.Api.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 InProcess 1cc472a2-4e4b-48ce-846b-5219f71fc643 ..\..\docker-compose.dcproj @@ -10,47 +10,43 @@ - - - - - - - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - - - - - + + + + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + + + - - diff --git a/src/Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Identity/Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Identity.csproj b/src/Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Identity/Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Identity.csproj index aa49989c4..af3be9ef4 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Identity/Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Identity.csproj +++ b/src/Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Identity/Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Identity.csproj @@ -1,19 +1,18 @@  - net5.0 + net6.0 Business Logic layer for the administration of the Asp.Net Core Identity and Duende IdentityServer - + - diff --git a/src/Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Shared/Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Shared.csproj b/src/Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Shared/Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Shared.csproj index db55ae2d0..ddc63ab8c 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Shared/Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Shared.csproj +++ b/src/Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Shared/Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Shared.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 Shared Business Logic layer for the administration of the Duende IdentityServer and Asp.Net Core Identity diff --git a/src/Skoruba.Duende.IdentityServer.Admin.BusinessLogic/Skoruba.Duende.IdentityServer.Admin.BusinessLogic.csproj b/src/Skoruba.Duende.IdentityServer.Admin.BusinessLogic/Skoruba.Duende.IdentityServer.Admin.BusinessLogic.csproj index d8d618954..763b8fe7e 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.BusinessLogic/Skoruba.Duende.IdentityServer.Admin.BusinessLogic.csproj +++ b/src/Skoruba.Duende.IdentityServer.Admin.BusinessLogic/Skoruba.Duende.IdentityServer.Admin.BusinessLogic.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 Business Logic layer for the administration of the Duende IdentityServer diff --git a/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Configuration/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Configuration.csproj b/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Configuration/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Configuration.csproj index 2ab0731c6..871e95db1 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Configuration/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Configuration.csproj +++ b/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Configuration/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Configuration.csproj @@ -1,22 +1,21 @@  - net5.0 + net6.0 Entity Framework configuration for the administration of the Duende IdentityServer and Asp.Net Core Identity - + + + - + - - - diff --git a/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Extensions/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Extensions.csproj b/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Extensions/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Extensions.csproj index 4bfaf391d..44555ddb7 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Extensions/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Extensions.csproj +++ b/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Extensions/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Extensions.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 EntityFramework extensions for the administration of the Duende IdentityServer and Asp.Net Core Identity diff --git a/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Identity/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Identity.csproj b/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Identity/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Identity.csproj index 3ce447a6c..8b000286c 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Identity/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Identity.csproj +++ b/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Identity/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Identity.csproj @@ -1,13 +1,13 @@  - net5.0 + net6.0 Entity Framework layer for the administration of the Asp.Net Core Identity and Duende IdentityServer - + diff --git a/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.MySql/Skoruba.Duende.IdentityServer.Admin.EntityFramework.MySql.csproj b/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.MySql/Skoruba.Duende.IdentityServer.Admin.EntityFramework.MySql.csproj index f812fd83c..a25e6435d 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.MySql/Skoruba.Duende.IdentityServer.Admin.EntityFramework.MySql.csproj +++ b/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.MySql/Skoruba.Duende.IdentityServer.Admin.EntityFramework.MySql.csproj @@ -1,20 +1,17 @@  - net5.0 + net6.0 Entity Framework layer for the administration of the Duende IdentityServer and Asp.Net Core Identity with MySql support - - + - - diff --git a/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL.csproj b/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL.csproj index ef181c49c..1bbcd99c6 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL.csproj +++ b/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL.csproj @@ -1,19 +1,16 @@  - net5.0 + net6.0 Entity Framework layer for the administration of the Duende IdentityServer and Asp.Net Core Identity with PostrgreSQL support - - + - - - + diff --git a/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared.csproj b/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared.csproj index ddb58c72d..08623cfbe 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared.csproj +++ b/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared.csproj @@ -1,19 +1,17 @@  - net5.0 + net6.0 DbContexts and Identity entities for the administration of the Duende IdentityServer and Asp.Net Core Identity - + - - diff --git a/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.SqlServer/Skoruba.Duende.IdentityServer.Admin.EntityFramework.SqlServer.csproj b/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.SqlServer/Skoruba.Duende.IdentityServer.Admin.EntityFramework.SqlServer.csproj index c57fb7f39..7854e261d 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.SqlServer/Skoruba.Duende.IdentityServer.Admin.EntityFramework.SqlServer.csproj +++ b/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.SqlServer/Skoruba.Duende.IdentityServer.Admin.EntityFramework.SqlServer.csproj @@ -1,19 +1,16 @@  - net5.0 + net6.0 Entity Framework layer for the administration of the Duende IdentityServer and Asp.Net Core Identity with SqlServer support - - + - - diff --git a/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework/Skoruba.Duende.IdentityServer.Admin.EntityFramework.csproj b/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework/Skoruba.Duende.IdentityServer.Admin.EntityFramework.csproj index 3d6c59dde..9b7f7f592 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework/Skoruba.Duende.IdentityServer.Admin.EntityFramework.csproj +++ b/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework/Skoruba.Duende.IdentityServer.Admin.EntityFramework.csproj @@ -1,12 +1,13 @@  - net5.0 + net6.0 Entity Framework layer for the administration of the Duende IdentityServer + diff --git a/src/Skoruba.Duende.IdentityServer.Admin.UI/Skoruba.Duende.IdentityServer.Admin.UI.csproj b/src/Skoruba.Duende.IdentityServer.Admin.UI/Skoruba.Duende.IdentityServer.Admin.UI.csproj index 1d3183f0a..7cc4fb356 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.UI/Skoruba.Duende.IdentityServer.Admin.UI.csproj +++ b/src/Skoruba.Duende.IdentityServer.Admin.UI/Skoruba.Duende.IdentityServer.Admin.UI.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 The package with UI for the administration of the Duende IdentityServer true / @@ -92,16 +92,15 @@ - - - - - - - - + + + + + + + + - diff --git a/src/Skoruba.Duende.IdentityServer.Admin/Skoruba.Duende.IdentityServer.Admin.csproj b/src/Skoruba.Duende.IdentityServer.Admin/Skoruba.Duende.IdentityServer.Admin.csproj index db9d6e1df..32e25991c 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin/Skoruba.Duende.IdentityServer.Admin.csproj +++ b/src/Skoruba.Duende.IdentityServer.Admin/Skoruba.Duende.IdentityServer.Admin.csproj @@ -1,69 +1,57 @@  - - net5.0 + + net6.0 8fe260ca-ef4c-4fa3-9364-029146f8d339 - ..\..\docker-compose.dcproj - Linux - ..\.. - - - - - - - - - - - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ..\..\docker-compose.dcproj + Linux + ..\.. + + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Skoruba.Duende.IdentityServer.STS.Identity/Skoruba.Duende.IdentityServer.STS.Identity.csproj b/src/Skoruba.Duende.IdentityServer.STS.Identity/Skoruba.Duende.IdentityServer.STS.Identity.csproj index 12aedf7ef..61ad63d8b 100644 --- a/src/Skoruba.Duende.IdentityServer.STS.Identity/Skoruba.Duende.IdentityServer.STS.Identity.csproj +++ b/src/Skoruba.Duende.IdentityServer.STS.Identity/Skoruba.Duende.IdentityServer.STS.Identity.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 9c91d295-54c5-4d09-9bd6-fa56fb74011b ..\..\docker-compose.dcproj Linux @@ -9,40 +9,39 @@ - - - - - - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - + + + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + - - - - - - - - - - - + + + + + + + + + + + diff --git a/src/Skoruba.Duende.IdentityServer.Shared.Configuration/Skoruba.Duende.IdentityServer.Shared.Configuration.csproj b/src/Skoruba.Duende.IdentityServer.Shared.Configuration/Skoruba.Duende.IdentityServer.Shared.Configuration.csproj index ffd772d39..827e53f21 100644 --- a/src/Skoruba.Duende.IdentityServer.Shared.Configuration/Skoruba.Duende.IdentityServer.Shared.Configuration.csproj +++ b/src/Skoruba.Duende.IdentityServer.Shared.Configuration/Skoruba.Duende.IdentityServer.Shared.Configuration.csproj @@ -1,18 +1,18 @@  - net5.0 + net6.0 Shared common layer for the administration of the Duende IdentityServer and Asp.Net Core Identity - - - - - - - + + + + + + + diff --git a/src/Skoruba.Duende.IdentityServer.Shared/Skoruba.Duende.IdentityServer.Shared.csproj b/src/Skoruba.Duende.IdentityServer.Shared/Skoruba.Duende.IdentityServer.Shared.csproj index f17937909..774add364 100644 --- a/src/Skoruba.Duende.IdentityServer.Shared/Skoruba.Duende.IdentityServer.Shared.csproj +++ b/src/Skoruba.Duende.IdentityServer.Shared/Skoruba.Duende.IdentityServer.Shared.csproj @@ -1,16 +1,16 @@  - net5.0 + net6.0 Shared common layer for the administration of the Duende IdentityServer and Asp.Net Core Identity - - + + diff --git a/templates/template-publish/content/src/SkorubaDuende.IdentityServerAdmin.Admin.Api/SkorubaDuende.IdentityServerAdmin.Admin.Api.csproj b/templates/template-publish/content/src/SkorubaDuende.IdentityServerAdmin.Admin.Api/SkorubaDuende.IdentityServerAdmin.Admin.Api.csproj index d636e71c6..09056f98a 100644 --- a/templates/template-publish/content/src/SkorubaDuende.IdentityServerAdmin.Admin.Api/SkorubaDuende.IdentityServerAdmin.Admin.Api.csproj +++ b/templates/template-publish/content/src/SkorubaDuende.IdentityServerAdmin.Admin.Api/SkorubaDuende.IdentityServerAdmin.Admin.Api.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 InProcess 1cc472a2-4e4b-48ce-846b-5219f71fc643 ..\..\docker-compose.dcproj diff --git a/templates/template-publish/content/src/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.MySql/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.MySql.csproj b/templates/template-publish/content/src/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.MySql/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.MySql.csproj index 0bb8841c7..eab84704a 100644 --- a/templates/template-publish/content/src/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.MySql/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.MySql.csproj +++ b/templates/template-publish/content/src/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.MySql/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.MySql.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 Entity Framework layer for the administration of the Duende IdentityServer and Asp.Net Core Identity with MySql support diff --git a/templates/template-publish/content/src/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.PostgreSQL/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.PostgreSQL.csproj b/templates/template-publish/content/src/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.PostgreSQL/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.PostgreSQL.csproj index 035e1340a..6c67832a8 100644 --- a/templates/template-publish/content/src/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.PostgreSQL/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.PostgreSQL.csproj +++ b/templates/template-publish/content/src/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.PostgreSQL/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.PostgreSQL.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 Entity Framework layer for the administration of the Duende IdentityServer and Asp.Net Core Identity with PostrgreSQL support diff --git a/templates/template-publish/content/src/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.Shared/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.Shared.csproj b/templates/template-publish/content/src/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.Shared/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.Shared.csproj index 74a1ef311..b08515429 100644 --- a/templates/template-publish/content/src/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.Shared/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.Shared.csproj +++ b/templates/template-publish/content/src/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.Shared/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.Shared.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 DbContexts and Identity entities for the administration of the Duende IdentityServer and Asp.Net Core Identity diff --git a/templates/template-publish/content/src/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.SqlServer/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.SqlServer.csproj b/templates/template-publish/content/src/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.SqlServer/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.SqlServer.csproj index bd017fc8a..e09c31713 100644 --- a/templates/template-publish/content/src/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.SqlServer/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.SqlServer.csproj +++ b/templates/template-publish/content/src/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.SqlServer/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.SqlServer.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 Entity Framework layer for the administration of the Duende IdentityServer and Asp.Net Core Identity with SqlServer support diff --git a/templates/template-publish/content/src/SkorubaDuende.IdentityServerAdmin.Admin/SkorubaDuende.IdentityServerAdmin.Admin.csproj b/templates/template-publish/content/src/SkorubaDuende.IdentityServerAdmin.Admin/SkorubaDuende.IdentityServerAdmin.Admin.csproj index b37e9adf6..22f470cdd 100644 --- a/templates/template-publish/content/src/SkorubaDuende.IdentityServerAdmin.Admin/SkorubaDuende.IdentityServerAdmin.Admin.csproj +++ b/templates/template-publish/content/src/SkorubaDuende.IdentityServerAdmin.Admin/SkorubaDuende.IdentityServerAdmin.Admin.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 8fe260ca-ef4c-4fa3-9364-029146f8d339 ..\..\docker-compose.dcproj Linux diff --git a/templates/template-publish/content/src/SkorubaDuende.IdentityServerAdmin.STS.Identity/SkorubaDuende.IdentityServerAdmin.STS.Identity.csproj b/templates/template-publish/content/src/SkorubaDuende.IdentityServerAdmin.STS.Identity/SkorubaDuende.IdentityServerAdmin.STS.Identity.csproj index 5cc17ba53..35f67870b 100644 --- a/templates/template-publish/content/src/SkorubaDuende.IdentityServerAdmin.STS.Identity/SkorubaDuende.IdentityServerAdmin.STS.Identity.csproj +++ b/templates/template-publish/content/src/SkorubaDuende.IdentityServerAdmin.STS.Identity/SkorubaDuende.IdentityServerAdmin.STS.Identity.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 9c91d295-54c5-4d09-9bd6-fa56fb74011b ..\..\docker-compose.dcproj Linux diff --git a/templates/template-publish/content/src/SkorubaDuende.IdentityServerAdmin.Shared/SkorubaDuende.IdentityServerAdmin.Shared.csproj b/templates/template-publish/content/src/SkorubaDuende.IdentityServerAdmin.Shared/SkorubaDuende.IdentityServerAdmin.Shared.csproj index d447d5a78..897013fba 100644 --- a/templates/template-publish/content/src/SkorubaDuende.IdentityServerAdmin.Shared/SkorubaDuende.IdentityServerAdmin.Shared.csproj +++ b/templates/template-publish/content/src/SkorubaDuende.IdentityServerAdmin.Shared/SkorubaDuende.IdentityServerAdmin.Shared.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 Shared common layer for the administration of the Duende IdentityServer and Asp.Net Core Identity diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.Api.IntegrationTests/Skoruba.Duende.IdentityServer.Admin.Api.IntegrationTests.csproj b/tests/Skoruba.Duende.IdentityServer.Admin.Api.IntegrationTests/Skoruba.Duende.IdentityServer.Admin.Api.IntegrationTests.csproj index c8728ec22..10dec7df3 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.Api.IntegrationTests/Skoruba.Duende.IdentityServer.Admin.Api.IntegrationTests.csproj +++ b/tests/Skoruba.Duende.IdentityServer.Admin.Api.IntegrationTests/Skoruba.Duende.IdentityServer.Admin.Api.IntegrationTests.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 true false Full diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests.csproj b/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests.csproj index ab83fb545..162740e2b 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests.csproj +++ b/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests.csproj @@ -1,7 +1,7 @@ - net5.0 + net6.0 Full false diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.IntegrationTests/Skoruba.Duende.IdentityServer.Admin.IntegrationTests.csproj b/tests/Skoruba.Duende.IdentityServer.Admin.IntegrationTests/Skoruba.Duende.IdentityServer.Admin.IntegrationTests.csproj index c8aa3d2ac..d85d1045c 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.IntegrationTests/Skoruba.Duende.IdentityServer.Admin.IntegrationTests.csproj +++ b/tests/Skoruba.Duende.IdentityServer.Admin.IntegrationTests/Skoruba.Duende.IdentityServer.Admin.IntegrationTests.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 true false Full diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Skoruba.Duende.IdentityServer.Admin.UnitTests.csproj b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Skoruba.Duende.IdentityServer.Admin.UnitTests.csproj index 1033233d9..daf5a482b 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Skoruba.Duende.IdentityServer.Admin.UnitTests.csproj +++ b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Skoruba.Duende.IdentityServer.Admin.UnitTests.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 Full false diff --git a/tests/Skoruba.Duende.IdentityServer.STS.Identity.IntegrationTests/Skoruba.Duende.IdentityServer.STS.Identity.IntegrationTests.csproj b/tests/Skoruba.Duende.IdentityServer.STS.Identity.IntegrationTests/Skoruba.Duende.IdentityServer.STS.Identity.IntegrationTests.csproj index f41f49949..9892ccbe9 100644 --- a/tests/Skoruba.Duende.IdentityServer.STS.Identity.IntegrationTests/Skoruba.Duende.IdentityServer.STS.Identity.IntegrationTests.csproj +++ b/tests/Skoruba.Duende.IdentityServer.STS.Identity.IntegrationTests/Skoruba.Duende.IdentityServer.STS.Identity.IntegrationTests.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 true false Full From 935b6e70091bfeffa84b0fb655837f35c191e683 Mon Sep 17 00:00:00 2001 From: janskoruba Date: Mon, 20 Dec 2021 11:35:10 +0100 Subject: [PATCH 02/23] Fix Api test to the latest FluentAssertions --- .../Mappers/ApiResourceMappers.cs | 12 ++++++------ .../Mappers/ApiScopeMappers.cs | 8 ++++---- .../Mappers/ClientMappers.cs | 18 +++++++++--------- .../Mappers/IdentityResourceMappers.cs | 8 ++++---- .../Mappers/KeyMappers.cs | 4 ++-- .../Mappers/PersistedGrantMappers.cs | 6 +++--- ...e.IdentityServer.Admin.Api.UnitTests.csproj | 2 +- 7 files changed, 29 insertions(+), 29 deletions(-) diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Mappers/ApiResourceMappers.cs b/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Mappers/ApiResourceMappers.cs index f194b306e..14f652c56 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Mappers/ApiResourceMappers.cs +++ b/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Mappers/ApiResourceMappers.cs @@ -19,7 +19,7 @@ public void CanMapApiResourceApiDtoToApiResourceDto() apiResourceDto.Should().NotBeNull(); - apiResourceApiDto.ShouldBeEquivalentTo(apiResourceDto); + apiResourceDto.Should().BeEquivalentTo(apiResourceApiDto); } [Fact] @@ -29,7 +29,7 @@ public void CanMapApiResourceDtoToApiResourceApiDto() var apiResourceApiDto = apiResourceDto.ToApiResourceApiModel(); - apiResourceDto.ShouldBeEquivalentTo(apiResourceApiDto, options => options + apiResourceApiDto.Should().BeEquivalentTo(apiResourceDto, options => options .Excluding(x => x.AllowedAccessTokenSigningAlgorithmsItems) .Excluding(x=> x.ScopesItems) .Excluding(x=> x.UserClaimsItems)); @@ -44,7 +44,7 @@ public void CanMapApiResourceSecretApiDtoToApiResourceSecretDto() apiSecretApiDto.Id.Should().Be(apiSecretsDto.ApiSecretId); - apiSecretApiDto.ShouldBeEquivalentTo(apiSecretsDto, options => options.Excluding(x=> x.Id)); + apiSecretsDto.Should().BeEquivalentTo(apiSecretApiDto, options => options.Excluding(x=> x.Id)); } [Fact] @@ -56,7 +56,7 @@ public void CanMapApiResourceSecretDtoToApiResourceSecretApiDto() apiResourceSecret.ApiResourceId.Should().Be(apiResourceApiDto.Id); - apiResourceSecret.ShouldBeEquivalentTo(apiResourceApiDto, options => + apiResourceApiDto.Should().BeEquivalentTo(apiResourceSecret, options => options.Excluding(x => x.ApiResourceId) .Excluding(x => x.ApiSecrets) .Excluding(x => x.ApiResourceName) @@ -77,7 +77,7 @@ public void CanMapApiResourcePropertyApiDtoToApiResourcePropertyDto() apiResourcePropertyApiDto.Id.Should().Be(apiResourcePropertiesDto.ApiResourcePropertyId); - apiResourcePropertyApiDto.ShouldBeEquivalentTo(apiResourcePropertiesDto, options => options.Excluding(x=> x.Id)); + apiResourcePropertiesDto.Should().BeEquivalentTo(apiResourcePropertyApiDto, options => options.Excluding(x=> x.Id)); } [Fact] @@ -89,7 +89,7 @@ public void CanMapApiResourcePropertyDtoToApiResourcePropertyApiDto() apiResourcePropertyDto.ApiResourcePropertyId.Should().Be(apiResourcePropertyApiDto.Id); - apiResourcePropertyDto.ShouldBeEquivalentTo(apiResourcePropertyApiDto, options => + apiResourcePropertyApiDto.Should().BeEquivalentTo(apiResourcePropertyDto, options => options.Excluding(x => x.ApiResourceId) .Excluding(x => x.ApiResourceName) .Excluding(x => x.PageSize) diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Mappers/ApiScopeMappers.cs b/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Mappers/ApiScopeMappers.cs index 340c81e75..c3c805f74 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Mappers/ApiScopeMappers.cs +++ b/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Mappers/ApiScopeMappers.cs @@ -17,7 +17,7 @@ public void CanMapApiScopeApiDtoToApiScopeDto() var apiScopeDto = apiScopeApiDto.ToApiScopeApiModel(); - apiScopeApiDto.ShouldBeEquivalentTo(apiScopeDto, options => options.Excluding(x=> x.ApiScopeProperties)); + apiScopeDto.Should().BeEquivalentTo(apiScopeApiDto, options => options.Excluding(x=> x.ApiScopeProperties)); } [Fact] @@ -27,7 +27,7 @@ public void CanMapApiScopeDtoToApiScopeApiDto() var apiScopeApiDto = apiScopeDto.ToApiScopeApiModel(); - apiScopeDto.ShouldBeEquivalentTo(apiScopeApiDto, options => options + apiScopeApiDto.Should().BeEquivalentTo(apiScopeDto, options => options .Excluding(x => x.ApiScopeProperties) .Excluding(x=> x.UserClaimsItems)); } @@ -39,7 +39,7 @@ public void CanMapApiScopePropertyApiDtoToApiScopePropertyDto() var apiScopePropertyDto = apiScopePropertyApiDto.ToApiScopeApiModel(); - apiScopePropertyApiDto.ShouldBeEquivalentTo(apiScopePropertyDto); + apiScopePropertyDto.Should().BeEquivalentTo(apiScopePropertyApiDto); } [Fact] @@ -49,7 +49,7 @@ public void CanMapApiScopePropertyDtoToApiScopePropertyDto() var apiScopePropertyApiDto = apiScopePropertyDto.ToApiScopeApiModel(); - apiScopePropertyDto.ShouldBeEquivalentTo(apiScopePropertyApiDto, options => + apiScopePropertyApiDto.Should().BeEquivalentTo(apiScopePropertyDto, options => options.Excluding(x => x.ApiScopeId) .Excluding(x => x.ApiScopeName) .Excluding(x => x.PageSize) diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Mappers/ClientMappers.cs b/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Mappers/ClientMappers.cs index d674389d5..08d72e7cb 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Mappers/ClientMappers.cs +++ b/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Mappers/ClientMappers.cs @@ -20,7 +20,7 @@ public void CanMapClientApiDtoToClientDto() clientDto.Should().NotBeNull(); - clientApiDto.ShouldBeEquivalentTo(clientDto); + clientDto.Should().BeEquivalentTo(clientApiDto); } [Fact] @@ -33,7 +33,7 @@ public void CanMapClientDtoToClientApiDto() clientDto.Should().NotBeNull(); - clientDto.ShouldBeEquivalentTo(clientApiDto, options => + clientApiDto.Should().BeEquivalentTo(clientDto, options => options.Excluding(o => o.AllowedCorsOriginsItems) .Excluding(o => o.AllowedGrantTypesItems) .Excluding(o => o.AllowedIdentityTokenSigningAlgorithmsItems) @@ -59,7 +59,7 @@ public void CanMapClientApiSecretToClientSecretDto() clientSecretApi.Id.Should().Be(clientSecretsDto.ClientSecretId); - clientSecretApi.ShouldBeEquivalentTo(clientSecretsDto, options => options.Excluding(x => x.Id)); + clientSecretsDto.Should().BeEquivalentTo(clientSecretApi, options => options.Excluding(x => x.Id)); } [Fact] @@ -71,7 +71,7 @@ public void CanMapClientSecretDtoToClientSecretApiDto() clientSecretDto.ClientSecretId.Should().Be(clientSecretApiDto.Id); - clientSecretDto.ShouldBeEquivalentTo(clientSecretApiDto, options => + clientSecretApiDto.Should().BeEquivalentTo(clientSecretDto, options => options.Excluding(x => x.ClientId) .Excluding(x => x.ClientSecrets) .Excluding(x => x.ClientName) @@ -92,7 +92,7 @@ public void CanMapClientClaimApiDtoToClientClaimDto() clientClaimApiDto.Id.Should().Be(clientClaimsDto.ClientClaimId); - clientClaimApiDto.ShouldBeEquivalentTo(clientClaimsDto, options => options.Excluding(x => x.Id)); + clientClaimsDto.Should().BeEquivalentTo(clientClaimApiDto, options => options.Excluding(x => x.Id)); } [Fact] @@ -104,7 +104,7 @@ public void CanMapClientClaimDtoToClientClaimApiDto() clientClaimDto.ClientClaimId.Should().Be(clientClaimApiDto.Id); - clientClaimDto.ShouldBeEquivalentTo(clientClaimApiDto, options => + clientClaimApiDto.Should().BeEquivalentTo(clientClaimDto, options => options.Excluding(x => x.ClientClaims) .Excluding(x => x.PageSize) .Excluding(x => x.TotalCount) @@ -121,8 +121,8 @@ public void CanMapClientPropertyApiDtoToClientPropertyDto() var clientPropertiesDto = clientPropertyApiDto.ToClientApiModel(); clientPropertyApiDto.Id.Should().Be(clientPropertiesDto.ClientPropertyId); - - clientPropertyApiDto.ShouldBeEquivalentTo(clientPropertiesDto, options => options.Excluding(x => x.Id)); + + clientPropertiesDto.Should().BeEquivalentTo(clientPropertyApiDto, options => options.Excluding(x => x.Id)); } [Fact] @@ -134,7 +134,7 @@ public void CanMapClientPropertyDtoToClientPropertyApiDto() clientPropertyDto.ClientPropertyId.Should().Be(clientPropertyApiDto.Id); - clientPropertyDto.ShouldBeEquivalentTo(clientPropertyApiDto, options => + clientPropertyApiDto.Should().BeEquivalentTo(clientPropertyDto, options => options.Excluding(x=> x.ClientId) .Excluding(x=> x.ClientName) .Excluding(x=> x.PageSize) diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Mappers/IdentityResourceMappers.cs b/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Mappers/IdentityResourceMappers.cs index 7b55e0757..03ce58595 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Mappers/IdentityResourceMappers.cs +++ b/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Mappers/IdentityResourceMappers.cs @@ -20,7 +20,7 @@ public void CanMapIdentityResourceApiDtoToIdentityResourceDto() identityResourceDto.Should().NotBeNull(); - identityResourceApiDto.ShouldBeEquivalentTo(identityResourceDto); + identityResourceDto.Should().BeEquivalentTo(identityResourceApiDto); } [Fact] @@ -30,7 +30,7 @@ public void CanMapIdentityResourceDtoToIdentityResourceApiDto() var identityResourceApiDto = identityResourceDto.ToIdentityResourceApiModel(); - identityResourceDto.ShouldBeEquivalentTo(identityResourceApiDto, options => options + identityResourceApiDto.Should().BeEquivalentTo(identityResourceDto, options => options .Excluding(x => x.UserClaimsItems)); } @@ -43,7 +43,7 @@ public void CanMapIdentityResourcePropertyApiDtoToIdentityResourcePropertyDto() identityResourcePropertyApiDto.Id.Should().Be(identityResourcePropertiesDto.IdentityResourcePropertyId); - identityResourcePropertyApiDto.ShouldBeEquivalentTo(identityResourcePropertiesDto, options => options.Excluding(x => x.Id)); + identityResourcePropertiesDto.Should().BeEquivalentTo(identityResourcePropertyApiDto, options => options.Excluding(x => x.Id)); } [Fact] @@ -55,7 +55,7 @@ public void CanMapIdentityResourcePropertyDtoToIdentityResourcePropertyApiDto() identityResourcePropertyDto.IdentityResourcePropertyId.Should().Be(identityResourcePropertyApiDto.Id); - identityResourcePropertyDto.ShouldBeEquivalentTo(identityResourcePropertyApiDto, options => + identityResourcePropertyApiDto.Should().BeEquivalentTo(identityResourcePropertyDto, options => options.Excluding(x => x.IdentityResourceId) .Excluding(x => x.IdentityResourceName) .Excluding(x => x.PageSize) diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Mappers/KeyMappers.cs b/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Mappers/KeyMappers.cs index 24c16f489..475b29d4a 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Mappers/KeyMappers.cs +++ b/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Mappers/KeyMappers.cs @@ -18,7 +18,7 @@ public void CanMapKeyDtoToKayApiDto() var keyApi = keyDto.ToKeyApiModel(); - keyDto.ShouldBeEquivalentTo(keyApi); + keyApi.Should().BeEquivalentTo(keyDto); } [Fact] @@ -28,7 +28,7 @@ public void CanMapKeyApiDtoToKeyDto() var keyDto = keyApiDto.ToKeyApiModel(); - keyApiDto.ShouldBeEquivalentTo(keyDto); + keyDto.Should().BeEquivalentTo(keyApiDto); } } } \ No newline at end of file diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Mappers/PersistedGrantMappers.cs b/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Mappers/PersistedGrantMappers.cs index df8befb0e..f90ee4e2f 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Mappers/PersistedGrantMappers.cs +++ b/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Mappers/PersistedGrantMappers.cs @@ -21,7 +21,7 @@ public void CanMapPersistedGrantDtoToPersistedGrantSubjectsApiDto() var persistedGrantSubjectsApiDto = persistedGrantsDto.ToPersistedGrantApiModel(); - persistedGrantsDto.ShouldBeEquivalentTo(persistedGrantSubjectsApiDto, options => options.Excluding(x=> x.SubjectId)); + persistedGrantSubjectsApiDto.Should().BeEquivalentTo(persistedGrantsDto, options => options.Excluding(x=> x.SubjectId)); } [Fact] @@ -35,7 +35,7 @@ public void CanMapPersistedGrantDtoToPersistedGrantsApiDto() var persistedGrantsApiDto = persistedGrantsDto.ToPersistedGrantApiModel(); - persistedGrantsDto.ShouldBeEquivalentTo(persistedGrantsApiDto, options => options.Excluding(x => x.SubjectId)); + persistedGrantsApiDto.Should().BeEquivalentTo(persistedGrantsDto, options => options.Excluding(x => x.SubjectId)); } [Fact] @@ -45,7 +45,7 @@ public void CanMapPersistedGrantDtoToPersistedGrantApiDto() var persistedGrantApiDto = persistedGrantDto.ToPersistedGrantApiModel(); - persistedGrantDto.ShouldBeEquivalentTo(persistedGrantApiDto, options => options.Excluding(x => x.SubjectId)); + persistedGrantApiDto.Should().BeEquivalentTo(persistedGrantDto, options => options.Excluding(x => x.SubjectId)); } } } \ No newline at end of file diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests.csproj b/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests.csproj index 162740e2b..6ba1e743b 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests.csproj +++ b/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests.csproj @@ -14,7 +14,7 @@ - + From 60bf5a3f86f05f359b1028c88c7ff0d1536c1e82 Mon Sep 17 00:00:00 2001 From: janskoruba Date: Mon, 20 Dec 2021 12:54:17 +0100 Subject: [PATCH 03/23] Fix Admin tests to latest version of FluentAssertions --- .../ConfigurationControllerTests.cs | 26 ++-- .../Controllers/IdentityControllerTests.cs | 18 +-- .../Mappers/ApiResourceMappers.cs | 24 ++-- .../Mappers/ClientMappers.cs | 44 +++--- .../Mappers/IdentityResourceMappers.cs | 8 +- .../Mappers/KeyMappers.cs | 2 +- .../Mappers/LogMappers.cs | 4 +- .../Mappers/PersistedGrantMappers.cs | 2 +- .../Mocks/ClientDtoMock.cs | 2 + .../ApiResourceRepositoryTests.cs | 52 +++---- .../Repositories/ApiScopeRepositoryTests.cs | 14 +- .../Repositories/ClientRepositoryTests.cs | 136 +++++++++--------- .../IdentityResourceRepositoryTests.cs | 54 +++---- .../PersistedGrantRepositoryTests.cs | 2 +- .../Services/ApiResourceServiceTests.cs | 30 ++-- .../Services/ApiScopeServiceTests.cs | 10 +- .../Services/ClientServiceTests.cs | 102 ++++++------- .../Services/IdentityResourceServiceTests.cs | 22 +-- .../Services/IdentityServiceTests.cs | 42 +++--- .../Services/PersistedGrantServiceTests.cs | 2 +- ...ende.IdentityServer.Admin.UnitTests.csproj | 4 +- 21 files changed, 301 insertions(+), 299 deletions(-) diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Controllers/ConfigurationControllerTests.cs b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Controllers/ConfigurationControllerTests.cs index d1812c8f5..526718566 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Controllers/ConfigurationControllerTests.cs +++ b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Controllers/ConfigurationControllerTests.cs @@ -86,7 +86,7 @@ public async Task AddClient() var client = await dbContext.Clients.Where(x => x.ClientId == clientDto.ClientId).SingleOrDefaultAsync(); var adddedClient = await clientService.GetClientAsync(client.Id); - clientDto.ShouldBeEquivalentTo(adddedClient, opts => opts.Excluding(x => x.Id) + adddedClient.Should().BeEquivalentTo(clientDto, opts => opts.Excluding(x => x.Id) .Excluding(x => x.AccessTokenTypes) .Excluding(x => x.ProtocolTypes) .Excluding(x => x.RefreshTokenExpirations) @@ -119,7 +119,7 @@ public async Task UpdateClient() var client = await dbContext.Clients.Where(x => x.ClientId == clientDto.ClientId).SingleOrDefaultAsync(); var adddedClient = await clientService.GetClientAsync(client.Id); - clientDto.ShouldBeEquivalentTo(adddedClient, opts => opts.Excluding(x => x.Id) + adddedClient.Should().BeEquivalentTo(clientDto, opts => opts.Excluding(x => x.Id) .Excluding(x => x.AccessTokenTypes) .Excluding(x => x.ProtocolTypes) .Excluding(x => x.RefreshTokenExpirations) @@ -174,7 +174,7 @@ public async Task AddClientClaim() var clientClaimAdded = await dbContext.ClientClaims.Where(x => x.Client.Id == clientId).SingleOrDefaultAsync(); var adddedClientClaim = await clientService.GetClientClaimAsync(clientClaimAdded.Id); - clientClaim.ShouldBeEquivalentTo(adddedClientClaim, opts => opts.Excluding(x => x.ClientClaimId) + adddedClientClaim.Should().BeEquivalentTo(clientClaim, opts => opts.Excluding(x => x.ClientClaimId) .Excluding(x => x.ClientClaims) .Excluding(x => x.ClientName)); } @@ -205,7 +205,7 @@ public async Task GetClientClaim() var viewModel = Assert.IsType(viewResult.ViewData.Model); viewModel.ClientClaims.Count.Should().Be(1); - viewModel.ClientClaims[0].ShouldBeEquivalentTo(clientClaimAdded); + clientClaimAdded.Should().BeEquivalentTo(viewModel.ClientClaims[0]); } [Fact] @@ -261,7 +261,7 @@ public async Task AddClientSecret() clientSecret.Value.Should().Be(clientSecretAdded.Value); - clientSecret.ShouldBeEquivalentTo(newClientSecret, opts => opts.Excluding(x => x.ClientSecretId) + newClientSecret.Should().BeEquivalentTo(clientSecret, opts => opts.Excluding(x => x.ClientSecretId) .Excluding(x => x.ClientSecrets) .Excluding(x => x.ClientName) .Excluding(x => x.Value)); @@ -295,7 +295,7 @@ public async Task GetClientSecret() var viewModel = Assert.IsType(viewResult.ViewData.Model); viewModel.ClientSecrets.Count.Should().Be(1); - viewModel.ClientSecrets[0].ShouldBeEquivalentTo(clientSecretAdded, opts => opts.Excluding(x => x.Value)); + clientSecretAdded.Should().BeEquivalentTo(viewModel.ClientSecrets[0], opts => opts.Excluding(x => x.Value)); } [Fact] @@ -349,7 +349,7 @@ public async Task AddClientProperty() var clientPropertyAdded = await dbContext.ClientProperties.Where(x => x.Client.Id == clientId).SingleOrDefaultAsync(); var newClientProperty = await clientService.GetClientPropertyAsync(clientPropertyAdded.Id); - clientProperty.ShouldBeEquivalentTo(newClientProperty, opts => opts.Excluding(x => x.ClientPropertyId) + newClientProperty.Should().BeEquivalentTo(clientProperty, opts => opts.Excluding(x => x.ClientPropertyId) .Excluding(x => x.ClientProperties) .Excluding(x => x.ClientName)); } @@ -380,7 +380,7 @@ public async Task GetClientProperty() var viewModel = Assert.IsType(viewResult.ViewData.Model); viewModel.ClientProperties.Count.Should().Be(1); - viewModel.ClientProperties[0].ShouldBeEquivalentTo(clientPropertyAdded); + clientPropertyAdded.Should().BeEquivalentTo(viewModel.ClientProperties[0]); } [Fact] @@ -454,7 +454,7 @@ public async Task AddIdentityResource() var identityResource = await dbContext.IdentityResources.Where(x => x.Name == identityResourceDto.Name).SingleOrDefaultAsync(); var addedIdentityResource = await identityResourceService.GetIdentityResourceAsync(identityResource.Id); - identityResourceDto.ShouldBeEquivalentTo(addedIdentityResource, opts => opts.Excluding(x => x.Id)); + addedIdentityResource.Should().BeEquivalentTo(identityResourceDto, opts => opts.Excluding(x => x.Id)); } [Fact] @@ -506,7 +506,7 @@ public async Task AddApiResource() var apiResource = await dbContext.ApiResources.Where(x => x.Name == apiResourceDto.Name).SingleOrDefaultAsync(); var addedApiResource = await apiResourceService.GetApiResourceAsync(apiResource.Id); - apiResourceDto.ShouldBeEquivalentTo(addedApiResource, opts => opts.Excluding(x => x.Id)); + addedApiResource.Should().BeEquivalentTo(apiResourceDto, opts => opts.Excluding(x => x.Id)); } [Fact] @@ -557,7 +557,7 @@ public async Task AddApiScope() var apiScope = await dbContext.ApiScopes.Where(x => x.Name == apiScopeDto.Name).SingleOrDefaultAsync(); var addedApiScope = await apiScopeService.GetApiScopeAsync(apiScope.Id); - apiScopeDto.ShouldBeEquivalentTo(addedApiScope, opts => opts.Excluding(x => x.Id)); + addedApiScope.Should().BeEquivalentTo(apiScopeDto, opts => opts.Excluding(x => x.Id)); } [Fact] @@ -619,7 +619,7 @@ public async Task UpdateApiScope() var apiScope = await dbContext.ApiScopes.Where(x => x.Id == apiScopeAdded.Id).SingleOrDefaultAsync(); var addedApiScope = await apiScopeService.GetApiScopeAsync(apiScope.Id); - updatedApiScopeDto.ShouldBeEquivalentTo(addedApiScope, opts => opts.Excluding(x => x.Id)); + addedApiScope.Should().BeEquivalentTo(updatedApiScopeDto, opts => opts.Excluding(x => x.Id)); } [Fact] @@ -710,7 +710,7 @@ public async Task AddApiSecret() apiSecretsDto.Value.Should().Be(apiSecret.Value); - apiSecretsDto.ShouldBeEquivalentTo(addedApiScope, opts => opts.Excluding(x => x.ApiResourceId).Excluding(x => x.ApiResourceName).Excluding(x => x.ApiSecretId).Excluding(x => x.Value)); + addedApiScope.Should().BeEquivalentTo(apiSecretsDto, opts => opts.Excluding(x => x.ApiResourceId).Excluding(x => x.ApiResourceName).Excluding(x => x.ApiSecretId).Excluding(x => x.Value)); } [Fact] diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Controllers/IdentityControllerTests.cs b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Controllers/IdentityControllerTests.cs index 383b7d09a..4c3a8adc2 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Controllers/IdentityControllerTests.cs +++ b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Controllers/IdentityControllerTests.cs @@ -78,7 +78,7 @@ public async Task AddUser() var addedUser = await identityService.GetUserAsync(userDto.Id); - userDto.ShouldBeEquivalentTo(addedUser, opts => opts.Excluding(x => x.Id)); + addedUser.Should().BeEquivalentTo(userDto, opts => opts.Excluding(x => x.Id)); } [Fact] @@ -149,7 +149,7 @@ public async Task UpdateUser() var updatedUser = await identityService.GetUserAsync(updatedUserDto.Id.ToString()); - updatedUserDto.ShouldBeEquivalentTo(updatedUser, opts => opts.Excluding(x => x.Id)); + updatedUser.Should().BeEquivalentTo(updatedUserDto, opts => opts.Excluding(x => x.Id)); } [Fact] @@ -182,7 +182,7 @@ public async Task GetUser() userDto.Id = userId; var addedUser = await identityService.GetUserAsync(userDto.Id.ToString()); - viewModel.ShouldBeEquivalentTo(addedUser); + addedUser.Should().BeEquivalentTo(viewModel); } [Fact] @@ -207,7 +207,7 @@ public async Task AddRole() var addedRole = await identityService.GetRoleAsync(roleDto.Id.ToString()); - roleDto.ShouldBeEquivalentTo(addedRole, opts => opts.Excluding(x => x.Id)); + addedRole.Should().BeEquivalentTo(roleDto, opts => opts.Excluding(x => x.Id)); } [Fact] @@ -235,7 +235,7 @@ public async Task GetRole() roleDto.Id = roleId; var addedRole = await identityService.GetRoleAsync(roleDto.Id.ToString()); - viewModel.ShouldBeEquivalentTo(addedRole); + addedRole.Should().BeEquivalentTo(viewModel); } [Fact] @@ -290,7 +290,7 @@ public async Task UpdateRole() var updatedRole = await identityService.GetRoleAsync(updatedRoleDto.Id.ToString()); - updatedRoleDto.ShouldBeEquivalentTo(updatedRole, opts => opts.Excluding(x => x.Id)); + updatedRole.Should().BeEquivalentTo(updatedRoleDto, opts => opts.Excluding(x => x.Id)); } [Fact] @@ -320,7 +320,7 @@ public async Task AddUserClaim() var addedUserClaim = await identityService.GetUserClaimAsync(user.Id.ToString(), userClaim.Id); - userClaimsDto.ShouldBeEquivalentTo(addedUserClaim, opts => opts.Excluding(x => x.ClaimId)); + addedUserClaim.Should().BeEquivalentTo(userClaimsDto, opts => opts.Excluding(x => x.ClaimId)); } [Fact] @@ -354,7 +354,7 @@ public async Task AddUserRole() var userRole = await dbContext.UserRoles.Where(x => x.RoleId == roleDto.Id && x.UserId == userDto.Id).SingleOrDefaultAsync(); - userRoleDto.ShouldBeEquivalentTo(userRole, opts => opts.Excluding(x => x.Roles) + userRole.Should().BeEquivalentTo(userRoleDto, opts => opts.Excluding(x => x.Roles) .Excluding(x => x.RolesList) .Excluding(x => x.PageSize) .Excluding(x => x.TotalCount) @@ -457,7 +457,7 @@ public async Task AddRoleClaim() var addedRoleClaim = await identityService.GetRoleClaimAsync(role.Id.ToString(), roleClaim.Id); - roleClaimsDto.ShouldBeEquivalentTo(addedRoleClaim, opts => opts.Excluding(x => x.ClaimId) + addedRoleClaim.Should().BeEquivalentTo(roleClaimsDto, opts => opts.Excluding(x => x.ClaimId) .Excluding(x => x.RoleName)); } diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mappers/ApiResourceMappers.cs b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mappers/ApiResourceMappers.cs index 4d63e6463..6051d03eb 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mappers/ApiResourceMappers.cs +++ b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mappers/ApiResourceMappers.cs @@ -24,7 +24,7 @@ public void CanMapApiResourceToModel() //Assert apiResourceDto.Should().NotBeNull(); - apiResource.ShouldBeEquivalentTo(apiResourceDto, options => + apiResourceDto.Should().BeEquivalentTo(apiResource, options => options.Excluding(o => o.Secrets) .Excluding(o => o.Scopes) .Excluding(o => o.Properties) @@ -36,10 +36,10 @@ public void CanMapApiResourceToModel() .Excluding(o => o.UserClaims)); //Assert collection - apiResource.UserClaims.Select(x => x.Type).ShouldBeEquivalentTo(apiResourceDto.UserClaims); + apiResourceDto.UserClaims.Should().BeEquivalentTo(apiResource.UserClaims.Select(x => x.Type)); var allowedAlgList = AllowedSigningAlgorithmsConverter.Converter.Convert(apiResource.AllowedAccessTokenSigningAlgorithms, null); - allowedAlgList.ShouldBeEquivalentTo(apiResourceDto.AllowedAccessTokenSigningAlgorithms); + apiResourceDto.AllowedAccessTokenSigningAlgorithms.Should().BeEquivalentTo(allowedAlgList); } [Fact] @@ -53,7 +53,7 @@ public void CanMapApiResourceDtoToEntity() apiResource.Should().NotBeNull(); - apiResource.ShouldBeEquivalentTo(apiResourceDto, options => + apiResourceDto.Should().BeEquivalentTo(apiResource, options => options.Excluding(o => o.Secrets) .Excluding(o => o.Scopes) .Excluding(o => o.Properties) @@ -65,9 +65,9 @@ public void CanMapApiResourceDtoToEntity() .Excluding(o => o.UserClaims)); //Assert collection - apiResource.UserClaims.Select(x => x.Type).ShouldBeEquivalentTo(apiResourceDto.UserClaims); + apiResourceDto.UserClaims.Should().BeEquivalentTo(apiResource.UserClaims.Select(x => x.Type)); var allowedAlgList = AllowedSigningAlgorithmsConverter.Converter.Convert(apiResource.AllowedAccessTokenSigningAlgorithms, null); - allowedAlgList.ShouldBeEquivalentTo(apiResourceDto.AllowedAccessTokenSigningAlgorithms); + apiResourceDto.AllowedAccessTokenSigningAlgorithms.Should().BeEquivalentTo(allowedAlgList); } [Fact] @@ -81,13 +81,13 @@ public void CanMapApiScopeToModel() apiScope.Should().NotBeNull(); - apiScope.ShouldBeEquivalentTo(apiScopeDto, options => + apiScopeDto.Should().BeEquivalentTo(apiScope, options => options.Excluding(o => o.UserClaims) .Excluding(o => o.ApiScopeProperties) .Excluding(o => o.UserClaimsItems)); //Assert collection - apiScopeDto.UserClaims.Select(x => x.Type).ShouldBeEquivalentTo(apiScope.UserClaims); + apiScope.UserClaims.Should().BeEquivalentTo(apiScopeDto.UserClaims.Select(x => x.Type)); apiScope.Id.Should().Be(apiScopeDto.Id); } @@ -102,13 +102,13 @@ public void CanMapApiScopeDtoToEntity() apiScope.Should().NotBeNull(); - apiScope.ShouldBeEquivalentTo(apiScopeDto, options => + apiScopeDto.Should().BeEquivalentTo(apiScope, options => options.Excluding(o => o.UserClaims) .Excluding(o => o.Properties) .Excluding(o => o.Id)); //Assert collection - apiScope.UserClaims.Select(x => x.Type).ShouldBeEquivalentTo(apiScopeDto.UserClaims); + apiScopeDto.UserClaims.Should().BeEquivalentTo(apiScope.UserClaims.Select(x => x.Type)); apiScope.Id.Should().Be(apiScopeDto.Id); } @@ -124,7 +124,7 @@ public void CanMapApiSecretToModel() //Assert apiSecretsDto.Should().NotBeNull(); - apiSecret.ShouldBeEquivalentTo(apiSecretsDto, options => + apiSecretsDto.Should().BeEquivalentTo(apiSecret, options => options.Excluding(o => o.ApiResource) .Excluding(o => o.Created) .Excluding(o => o.Id)); @@ -143,7 +143,7 @@ public void CanMapApiSecretDtoToEntity() apiSecret.Should().NotBeNull(); - apiSecret.ShouldBeEquivalentTo(apiSecretsDto, options => + apiSecretsDto.Should().BeEquivalentTo(apiSecret, options => options.Excluding(o => o.ApiResource) .Excluding(o => o.Created) .Excluding(o => o.Id)); diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mappers/ClientMappers.cs b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mappers/ClientMappers.cs index ba5e514ae..56e3cb178 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mappers/ClientMappers.cs +++ b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mappers/ClientMappers.cs @@ -24,7 +24,7 @@ public void CanMapClientToModel() //Asert clientDto.Should().NotBeNull(); - client.ShouldBeEquivalentTo(clientDto, options => + clientDto.Should().BeEquivalentTo(client, options => options.Excluding(o => o.AllowedCorsOrigins) .Excluding(o => o.RedirectUris) .Excluding(o => o.PostLogoutRedirectUris) @@ -35,14 +35,14 @@ public void CanMapClientToModel() .Excluding(o => o.IdentityProviderRestrictions)); //Assert collection - client.AllowedCorsOrigins.Select(x => x.Origin).ShouldBeEquivalentTo(clientDto.AllowedCorsOrigins); - client.RedirectUris.Select(x => x.RedirectUri).ShouldBeEquivalentTo(clientDto.RedirectUris); - client.PostLogoutRedirectUris.Select(x => x.PostLogoutRedirectUri).ShouldBeEquivalentTo(clientDto.PostLogoutRedirectUris); - client.AllowedGrantTypes.Select(x => x.GrantType).ShouldBeEquivalentTo(clientDto.AllowedGrantTypes); - client.AllowedScopes.Select(x => x.Scope).ShouldBeEquivalentTo(clientDto.AllowedScopes); - client.IdentityProviderRestrictions.Select(x => x.Provider).ShouldBeEquivalentTo(clientDto.IdentityProviderRestrictions); + clientDto.AllowedCorsOrigins.Should().BeEquivalentTo(client.AllowedCorsOrigins.Select(x => x.Origin)); + clientDto.RedirectUris.Should().BeEquivalentTo(client.RedirectUris.Select(x => x.RedirectUri)); + clientDto.PostLogoutRedirectUris.Should().BeEquivalentTo(client.PostLogoutRedirectUris.Select(x => x.PostLogoutRedirectUri)); + clientDto.AllowedGrantTypes.Should().BeEquivalentTo(client.AllowedGrantTypes.Select(x => x.GrantType)); + clientDto.AllowedScopes.Should().BeEquivalentTo(client.AllowedScopes.Select(x => x.Scope)); + clientDto.IdentityProviderRestrictions.Should().BeEquivalentTo(client.IdentityProviderRestrictions.Select(x => x.Provider)); var allowedAlgList = AllowedSigningAlgorithmsConverter.Converter.Convert(client.AllowedIdentityTokenSigningAlgorithms, null); - allowedAlgList.ShouldBeEquivalentTo(clientDto.AllowedIdentityTokenSigningAlgorithms); + clientDto.AllowedIdentityTokenSigningAlgorithms.Should().BeEquivalentTo(allowedAlgList); } [Fact] @@ -56,7 +56,7 @@ public void CanMapClientDtoToEntity() client.Should().NotBeNull(); - client.ShouldBeEquivalentTo(clientDto, options => + clientDto.Should().BeEquivalentTo(client, options => options.Excluding(o => o.AllowedCorsOrigins) .Excluding(o => o.RedirectUris) .Excluding(o => o.PostLogoutRedirectUris) @@ -67,14 +67,14 @@ public void CanMapClientDtoToEntity() .Excluding(o => o.IdentityProviderRestrictions)); //Assert collection - client.AllowedCorsOrigins.Select(x => x.Origin).ShouldBeEquivalentTo(clientDto.AllowedCorsOrigins); - client.RedirectUris.Select(x => x.RedirectUri).ShouldBeEquivalentTo(clientDto.RedirectUris); - client.PostLogoutRedirectUris.Select(x => x.PostLogoutRedirectUri).ShouldBeEquivalentTo(clientDto.PostLogoutRedirectUris); - client.AllowedGrantTypes.Select(x => x.GrantType).ShouldBeEquivalentTo(clientDto.AllowedGrantTypes); - client.AllowedScopes.Select(x => x.Scope).ShouldBeEquivalentTo(clientDto.AllowedScopes); - client.IdentityProviderRestrictions.Select(x => x.Provider).ShouldBeEquivalentTo(clientDto.IdentityProviderRestrictions); + clientDto.AllowedCorsOrigins.Should().BeEquivalentTo(client.AllowedCorsOrigins.Select(x => x.Origin)); + clientDto.RedirectUris.Should().BeEquivalentTo(client.RedirectUris.Select(x => x.RedirectUri)); + clientDto.PostLogoutRedirectUris.Should().BeEquivalentTo(client.PostLogoutRedirectUris.Select(x => x.PostLogoutRedirectUri)); + clientDto.AllowedGrantTypes.Should().BeEquivalentTo(client.AllowedGrantTypes.Select(x => x.GrantType)); + clientDto.AllowedScopes.Should().BeEquivalentTo(client.AllowedScopes.Select(x => x.Scope)); + clientDto.IdentityProviderRestrictions.Should().BeEquivalentTo(client.IdentityProviderRestrictions.Select(x => x.Provider)); var allowedAlgList = AllowedSigningAlgorithmsConverter.Converter.Convert(client.AllowedIdentityTokenSigningAlgorithms, null); - allowedAlgList.ShouldBeEquivalentTo(clientDto.AllowedIdentityTokenSigningAlgorithms); + clientDto.AllowedIdentityTokenSigningAlgorithms.Should().BeEquivalentTo(allowedAlgList); } [Fact] @@ -87,7 +87,7 @@ public void CanMapClientClaimToModel() //Assert clientClaimsDto.Should().NotBeNull(); - clientClaim.ShouldBeEquivalentTo(clientClaimsDto, options => + clientClaimsDto.Should().BeEquivalentTo(clientClaim, options => options.Excluding(o => o.Id) .Excluding(o => o.Client)); } @@ -102,7 +102,7 @@ public void CanMapClientClaimToEntity() //Assert clientClaim.Should().NotBeNull(); - clientClaim.ShouldBeEquivalentTo(clientClaimDto, options => + clientClaimDto.Should().BeEquivalentTo(clientClaim, options => options.Excluding(o => o.Id) .Excluding(o => o.Client)); } @@ -117,7 +117,7 @@ public void CanMapClientSecretToModel() //Assert clientSecretsDto.Should().NotBeNull(); - clientSecret.ShouldBeEquivalentTo(clientSecretsDto, options => + clientSecretsDto.Should().BeEquivalentTo(clientSecret, options => options.Excluding(o => o.Id) .Excluding(o => o.Created) .Excluding(o => o.Client)); @@ -133,7 +133,7 @@ public void CanMapClientSecretToEntity() //Assert clientSecret.Should().NotBeNull(); - clientSecret.ShouldBeEquivalentTo(clientSecretsDto, options => + clientSecretsDto.Should().BeEquivalentTo(clientSecret, options => options.Excluding(o => o.Id) .Excluding(o => o.Created) .Excluding(o => o.Client)); @@ -149,7 +149,7 @@ public void CanMapClientPropertyToModel() //Assert clientPropertiesDto.Should().NotBeNull(); - clientProperty.ShouldBeEquivalentTo(clientPropertiesDto, options => + clientPropertiesDto.Should().BeEquivalentTo(clientProperty, options => options.Excluding(o => o.Id) .Excluding(o => o.Client)); } @@ -164,7 +164,7 @@ public void CanMapClientPropertyToEntity() //Assert clientProperty.Should().NotBeNull(); - clientProperty.ShouldBeEquivalentTo(clientPropertiesDto, options => + clientPropertiesDto.Should().BeEquivalentTo(clientProperty, options => options.Excluding(o => o.Id) .Excluding(o => o.Client)); } diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mappers/IdentityResourceMappers.cs b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mappers/IdentityResourceMappers.cs index 4a3c12a23..c06fc3a11 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mappers/IdentityResourceMappers.cs +++ b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mappers/IdentityResourceMappers.cs @@ -23,7 +23,7 @@ public void CanMapIdentityResourceToModel() //Assert identityResourceDto.Should().NotBeNull(); - identityResource.ShouldBeEquivalentTo(identityResourceDto, options => + identityResourceDto.Should().BeEquivalentTo(identityResource, options => options.Excluding(o => o.UserClaims) .Excluding(o => o.Properties) .Excluding(o => o.Created) @@ -31,7 +31,7 @@ public void CanMapIdentityResourceToModel() .Excluding(o => o.NonEditable)); //Assert collection - identityResource.UserClaims.Select(x => x.Type).ShouldBeEquivalentTo(identityResourceDto.UserClaims); + identityResourceDto.UserClaims.Should().BeEquivalentTo(identityResource.UserClaims.Select(x => x.Type)); } [Fact] @@ -45,7 +45,7 @@ public void CanMapIdentityResourceDtoToEntity() identityResource.Should().NotBeNull(); - identityResource.ShouldBeEquivalentTo(identityResourceDto, options => + identityResourceDto.Should().BeEquivalentTo(identityResource, options => options.Excluding(o => o.UserClaims) .Excluding(o => o.Properties) .Excluding(o => o.Created) @@ -53,7 +53,7 @@ public void CanMapIdentityResourceDtoToEntity() .Excluding(o => o.NonEditable)); //Assert collection - identityResource.UserClaims.Select(x => x.Type).ShouldBeEquivalentTo(identityResourceDto.UserClaims); + identityResourceDto.UserClaims.Should().BeEquivalentTo(identityResource.UserClaims.Select(x => x.Type)); } } } diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mappers/KeyMappers.cs b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mappers/KeyMappers.cs index 4e172b573..a7581f7ae 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mappers/KeyMappers.cs +++ b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mappers/KeyMappers.cs @@ -15,7 +15,7 @@ public void CanMapKeyToKeyDto() var keyDto = key.ToModel(); - key.ShouldBeEquivalentTo(keyDto); + keyDto.Should().BeEquivalentTo(key); } } } \ No newline at end of file diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mappers/LogMappers.cs b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mappers/LogMappers.cs index 67f4220c6..fb5ef28d7 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mappers/LogMappers.cs +++ b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mappers/LogMappers.cs @@ -22,7 +22,7 @@ public void CanMapIdentityResourceToModel() //Asert logDto.Should().NotBeNull(); - log.ShouldBeEquivalentTo(logDto, options => + logDto.Should().BeEquivalentTo(log, options => options.Excluding(o => o.PropertiesXml)); } @@ -37,7 +37,7 @@ public void CanMapIdentityResourceDtoToEntity() log.Should().NotBeNull(); - log.ShouldBeEquivalentTo(logDto, options => + logDto.Should().BeEquivalentTo(log, options => options.Excluding(o => o.PropertiesXml)); } } diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mappers/PersistedGrantMappers.cs b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mappers/PersistedGrantMappers.cs index 6ec48133f..9ae2332af 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mappers/PersistedGrantMappers.cs +++ b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mappers/PersistedGrantMappers.cs @@ -25,7 +25,7 @@ public void CanMapPersistedGrantToModel() //Asert persistedGrantDto.Should().NotBeNull(); - persistedGrant.ShouldBeEquivalentTo(persistedGrantDto); + persistedGrantDto.Should().BeEquivalentTo(persistedGrant); } } } \ No newline at end of file diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mocks/ClientDtoMock.cs b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mocks/ClientDtoMock.cs index 2ab9b5ae4..1a7dc2f05 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mocks/ClientDtoMock.cs +++ b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mocks/ClientDtoMock.cs @@ -166,6 +166,8 @@ public static Faker ClientCloneFaker(int id, bool cloneClientCla var clientCloneDto = new Faker() .StrictMode(false) .RuleFor(o => o.Id, id) + .RuleFor(o => o.ClientId, Guid.NewGuid().ToString()) + .RuleFor(o => o.ClientName, Guid.NewGuid().ToString()) .RuleFor(o => o.CloneClientClaims, cloneClientClaims) .RuleFor(o => o.CloneClientCorsOrigins, cloneClientCorsOrigins) .RuleFor(o => o.CloneClientGrantTypes, cloneClientGrantTypes) diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Repositories/ApiResourceRepositoryTests.cs b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Repositories/ApiResourceRepositoryTests.cs index 09b54b7a6..9859105e9 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Repositories/ApiResourceRepositoryTests.cs +++ b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Repositories/ApiResourceRepositoryTests.cs @@ -58,7 +58,7 @@ public async Task AddApiResourceAsync() var newApiResource = await context.ApiResources.Where(x => x.Id == apiResource.Id).SingleAsync(); //Assert new api resource - newApiResource.ShouldBeEquivalentTo(apiResource, options => options.Excluding(o => o.Id)); + apiResource.Should().BeEquivalentTo(newApiResource, options => options.Excluding(o => o.Id)); } } @@ -79,13 +79,13 @@ public async Task GetApiResourceAsync() var newApiResource = await apiResourceRepository.GetApiResourceAsync(apiResource.Id); //Assert new api resource - newApiResource.ShouldBeEquivalentTo(apiResource, options => options.Excluding(o => o.Id).Excluding(o => o.Secrets) + apiResource.Should().BeEquivalentTo(newApiResource, options => options.Excluding(o => o.Id).Excluding(o => o.Secrets) .Excluding(o => o.Scopes) .Excluding(o => o.UserClaims)); - newApiResource.UserClaims.ShouldBeEquivalentTo(apiResource.UserClaims, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("ApiResource"))); + apiResource.UserClaims.Should().BeEquivalentTo(newApiResource.UserClaims, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("ApiResource"))); } } @@ -106,7 +106,7 @@ public async Task DeleteApiResourceAsync() var newApiResource = await context.ApiResources.Where(x => x.Id == apiResource.Id).SingleAsync(); //Assert new api resource - newApiResource.ShouldBeEquivalentTo(apiResource, options => options.Excluding(o => o.Id)); + apiResource.Should().BeEquivalentTo(newApiResource, options => options.Excluding(o => o.Id)); //Delete api resource await apiResourceRepository.DeleteApiResourceAsync(newApiResource); @@ -136,7 +136,7 @@ public async Task UpdateApiResourceAsync() var newApiResource = await context.ApiResources.Where(x => x.Id == apiResource.Id).SingleOrDefaultAsync(); //Assert new api resource - newApiResource.ShouldBeEquivalentTo(apiResource, options => options.Excluding(o => o.Id)); + apiResource.Should().BeEquivalentTo(newApiResource, options => options.Excluding(o => o.Id)); //Detached the added item context.Entry(newApiResource).State = EntityState.Detached; @@ -151,7 +151,7 @@ public async Task UpdateApiResourceAsync() var updatedApiResourceEntity = await context.ApiResources.Where(x => x.Id == updatedApiResource.Id).SingleAsync(); //Assert updated api resource - updatedApiResource.ShouldBeEquivalentTo(updatedApiResourceEntity); + updatedApiResourceEntity.Should().BeEquivalentTo(updatedApiResource); } } @@ -178,7 +178,7 @@ public async Task AddApiSecretAsync() var newApiSecret = await context.ApiSecrets.Where(x => x.Id == apiSecret.Id).SingleAsync(); //Assert new api secret - newApiSecret.ShouldBeEquivalentTo(apiSecret, options => options.Excluding(o => o.Id)); + apiSecret.Should().BeEquivalentTo(newApiSecret, options => options.Excluding(o => o.Id)); } } @@ -205,7 +205,7 @@ public async Task DeleteApiSecretAsync() var newApiSecret = await context.ApiSecrets.Where(x => x.Id == apiSecret.Id).SingleOrDefaultAsync(); //Assert new api resource - newApiSecret.ShouldBeEquivalentTo(apiSecret, options => options.Excluding(o => o.Id)); + apiSecret.Should().BeEquivalentTo(newApiSecret, options => options.Excluding(o => o.Id)); //Try delete it await apiResourceRepository.DeleteApiSecretAsync(newApiSecret); @@ -241,7 +241,7 @@ public async Task GetApiSecretAsync() var newApiSecret = await apiResourceRepository.GetApiSecretAsync(apiSecret.Id); //Assert new api secret - newApiSecret.ShouldBeEquivalentTo(apiSecret, options => options.Excluding(o => o.Id) + apiSecret.Should().BeEquivalentTo(newApiSecret, options => options.Excluding(o => o.Id) .Excluding(o => o.ApiResource.Secrets) .Excluding(o => o.ApiResource.UserClaims) .Excluding(o => o.ApiResource.Scopes)); @@ -265,14 +265,14 @@ public async Task AddApiResourcePropertyAsync() var resource = await apiResourceRepository.GetApiResourceAsync(apiResource.Id); //Assert new api resource - resource.ShouldBeEquivalentTo(apiResource, options => options.Excluding(o => o.Id) + apiResource.Should().BeEquivalentTo(resource, options => options.Excluding(o => o.Id) .Excluding(o => o.Secrets) .Excluding(o => o.Scopes) .Excluding(o => o.UserClaims)); - resource.UserClaims.ShouldBeEquivalentTo(apiResource.UserClaims, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("ApiResource"))); + apiResource.UserClaims.Should().BeEquivalentTo(resource.UserClaims, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("ApiResource"))); //Generate random new api resource property var apiResourceProperty = ApiResourceMock.GenerateRandomApiResourceProperty(0); @@ -284,7 +284,7 @@ public async Task AddApiResourcePropertyAsync() var resourceProperty = await context.ApiResourceProperties.Where(x => x.Id == apiResourceProperty.Id) .SingleOrDefaultAsync(); - resourceProperty.ShouldBeEquivalentTo(apiResourceProperty, + apiResourceProperty.Should().BeEquivalentTo(resourceProperty, options => options.Excluding(o => o.Id).Excluding(x => x.ApiResource)); } } @@ -306,14 +306,14 @@ public async Task DeleteApiResourcePropertyAsync() var resource = await apiResourceRepository.GetApiResourceAsync(apiResource.Id); //Assert new api resource - resource.ShouldBeEquivalentTo(apiResource, options => options.Excluding(o => o.Id) + apiResource.Should().BeEquivalentTo(resource, options => options.Excluding(o => o.Id) .Excluding(o => o.Secrets) .Excluding(o => o.Scopes) .Excluding(o => o.UserClaims)); - resource.UserClaims.ShouldBeEquivalentTo(apiResource.UserClaims, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("ApiResource"))); + apiResource.UserClaims.Should().BeEquivalentTo(resource.UserClaims, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("ApiResource"))); //Generate random new api resource property var apiResourceProperty = ApiResourceMock.GenerateRandomApiResourceProperty(0); @@ -326,7 +326,7 @@ public async Task DeleteApiResourcePropertyAsync() .SingleOrDefaultAsync(); //Assert - property.ShouldBeEquivalentTo(apiResourceProperty, + apiResourceProperty.Should().BeEquivalentTo(property, options => options.Excluding(o => o.Id).Excluding(x => x.ApiResource)); //Try delete it @@ -358,14 +358,14 @@ public async Task GetApiResourcePropertyAsync() var resource = await apiResourceRepository.GetApiResourceAsync(apiResource.Id); //Assert new api resource - resource.ShouldBeEquivalentTo(apiResource, options => options.Excluding(o => o.Id) + apiResource.Should().BeEquivalentTo(resource, options => options.Excluding(o => o.Id) .Excluding(o => o.Secrets) .Excluding(o => o.Scopes) .Excluding(o => o.UserClaims)); - resource.UserClaims.ShouldBeEquivalentTo(apiResource.UserClaims, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("ApiResource"))); + apiResource.UserClaims.Should().BeEquivalentTo(resource.UserClaims, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("ApiResource"))); //Generate random new api resource property var apiResourceProperty = ApiResourceMock.GenerateRandomApiResourceProperty(0); @@ -376,7 +376,7 @@ public async Task GetApiResourcePropertyAsync() //Get new api resource property var resourceProperty = await apiResourceRepository.GetApiResourcePropertyAsync(apiResourceProperty.Id); - resourceProperty.ShouldBeEquivalentTo(apiResourceProperty, + apiResourceProperty.Should().BeEquivalentTo(resourceProperty, options => options.Excluding(o => o.Id).Excluding(x => x.ApiResource)); } } diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Repositories/ApiScopeRepositoryTests.cs b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Repositories/ApiScopeRepositoryTests.cs index ca0154734..01903a7fd 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Repositories/ApiScopeRepositoryTests.cs +++ b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Repositories/ApiScopeRepositoryTests.cs @@ -55,7 +55,7 @@ public async Task AddApiScopeAsync() var newApiScopes = await context.ApiScopes.Where(x => x.Id == apiScope.Id).SingleAsync(); //Assert new api scope - newApiScopes.ShouldBeEquivalentTo(apiScope, options => options.Excluding(o => o.Id)); + apiScope.Should().BeEquivalentTo(newApiScopes, options => options.Excluding(o => o.Id)); } } @@ -85,7 +85,7 @@ public async Task UpdateApiScopeAsync() var updatedApiScopeEntity = await context.ApiScopes.Where(x => x.Id == updatedApiScope.Id).SingleAsync(); //Assert updated api scope - updatedApiScope.ShouldBeEquivalentTo(updatedApiScopeEntity); + updatedApiScopeEntity.Should().BeEquivalentTo(updatedApiScope); } } @@ -106,7 +106,7 @@ public async Task DeleteApiScopeAsync() var newApiScopes = await context.ApiScopes.Where(x => x.Id == apiScope.Id).SingleOrDefaultAsync(); //Assert new api resource - newApiScopes.ShouldBeEquivalentTo(apiScope, options => options.Excluding(o => o.Id)); + apiScope.Should().BeEquivalentTo(newApiScopes, options => options.Excluding(o => o.Id)); //Try delete it await apiResourceRepository.DeleteApiScopeAsync(newApiScopes); @@ -136,12 +136,12 @@ public async Task GetApiScopeAsync() var newApiScopes = await apiResourceRepository.GetApiScopeAsync(apiScope.Id); //Assert new api resource - newApiScopes.ShouldBeEquivalentTo(apiScope, options => options.Excluding(o => o.Id) + apiScope.Should().BeEquivalentTo(newApiScopes, options => options.Excluding(o => o.Id) .Excluding(o => o.UserClaims)); - newApiScopes.UserClaims.ShouldBeEquivalentTo(apiScope.UserClaims, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("Scope"))); + apiScope.UserClaims.Should().BeEquivalentTo(newApiScopes.UserClaims, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("Scope"))); } } } diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Repositories/ClientRepositoryTests.cs b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Repositories/ClientRepositoryTests.cs index d3d54054c..b97f41b76 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Repositories/ClientRepositoryTests.cs +++ b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Repositories/ClientRepositoryTests.cs @@ -79,7 +79,7 @@ public async Task AddClientAsync() var clientEntity = await context.Clients.Where(x => x.Id == client.Id).SingleAsync(); //Assert new client - clientEntity.ShouldBeEquivalentTo(client, options => options.Excluding(o => o.Id)); + client.Should().BeEquivalentTo(clientEntity, options => options.Excluding(o => o.Id)); } } @@ -112,7 +112,7 @@ public async Task AddClientClaimAsync() var newClientClaim = await context.ClientClaims.Where(x => x.Id == clientClaim.Id).SingleOrDefaultAsync(); - newClientClaim.ShouldBeEquivalentTo(clientClaim, + clientClaim.Should().BeEquivalentTo(newClientClaim, options => options.Excluding(o => o.Id).Excluding(x => x.Client)); } } @@ -146,7 +146,7 @@ public async Task AddClientPropertyAsync() var newClientProperty = await context.ClientProperties.Where(x => x.Id == clientProperty.Id) .SingleOrDefaultAsync(); - newClientProperty.ShouldBeEquivalentTo(clientProperty, + clientProperty.Should().BeEquivalentTo(newClientProperty, options => options.Excluding(o => o.Id).Excluding(x => x.Client)); } } @@ -179,7 +179,7 @@ public async Task AddClientSecretAsync() //Get new client secret var newSecret = await context.ClientSecrets.Where(x => x.Id == clientSecret.Id).SingleOrDefaultAsync(); - newSecret.ShouldBeEquivalentTo(clientSecret, + clientSecret.Should().BeEquivalentTo(newSecret, options => options.Excluding(o => o.Id).Excluding(x => x.Client)); } } @@ -439,7 +439,7 @@ public async Task DeleteClientClaimAsync() await context.ClientClaims.Where(x => x.Id == clientClaim.Id).SingleOrDefaultAsync(); //Assert - newClientClaim.ShouldBeEquivalentTo(clientClaim, + clientClaim.Should().BeEquivalentTo(newClientClaim, options => options.Excluding(o => o.Id).Excluding(x => x.Client)); //Try delete it @@ -484,7 +484,7 @@ public async Task DeleteClientPropertyAsync() .SingleOrDefaultAsync(); //Assert - newClientProperties.ShouldBeEquivalentTo(clientProperty, + clientProperty.Should().BeEquivalentTo(newClientProperties, options => options.Excluding(o => o.Id).Excluding(x => x.Client)); //Try delete it @@ -528,7 +528,7 @@ public async Task DeleteClientSecretAsync() var newSecret = await context.ClientSecrets.Where(x => x.Id == clientSecret.Id).SingleOrDefaultAsync(); //Assert - newSecret.ShouldBeEquivalentTo(clientSecret, + clientSecret.Should().BeEquivalentTo(newSecret, options => options.Excluding(o => o.Id).Excluding(x => x.Client)); //Try delete it @@ -592,7 +592,7 @@ public async Task GetClientClaimAsync() //Get new client claim var newClientClaim = await clientRepository.GetClientClaimAsync(clientClaim.Id); - newClientClaim.ShouldBeEquivalentTo(clientClaim, + clientClaim.Should().BeEquivalentTo(newClientClaim, options => options.Excluding(o => o.Id).Excluding(x => x.Client)); } } @@ -625,7 +625,7 @@ public async Task GetClientPropertyAsync() //Get new client Property var newClientProperty = await clientRepository.GetClientPropertyAsync(clientProperty.Id); - newClientProperty.ShouldBeEquivalentTo(clientProperty, + clientProperty.Should().BeEquivalentTo(newClientProperty, options => options.Excluding(o => o.Id).Excluding(x => x.Client)); } } @@ -653,7 +653,7 @@ public async Task GetClientsAsync() clients.Data.Count.Should().Be(randomClients.Count); //Assert that clients are same - clients.Data.ShouldBeEquivalentTo(randomClients); + randomClients.Should().BeEquivalentTo(clients.Data); } } @@ -685,7 +685,7 @@ public async Task GetClientSecretAsync() //Get new client secret var newSecret = await clientRepository.GetClientSecretAsync(clientSecret.Id); - newSecret.ShouldBeEquivalentTo(clientSecret, + clientSecret.Should().BeEquivalentTo(newSecret, options => options.Excluding(o => o.Id).Excluding(x => x.Client)); } } @@ -707,7 +707,7 @@ public async Task RemoveClientAsync() var clientEntity = await context.Clients.Where(x => x.Id == client.Id).SingleAsync(); //Assert new client - clientEntity.ShouldBeEquivalentTo(client, options => options.Excluding(o => o.Id)); + client.Should().BeEquivalentTo(clientEntity, options => options.Excluding(o => o.Id)); //Detached the added item context.Entry(clientEntity).State = EntityState.Detached; @@ -741,7 +741,7 @@ public async Task UpdateClientAsync() var clientEntity = await context.Clients.Where(x => x.Id == client.Id).SingleAsync(); //Assert new client - clientEntity.ShouldBeEquivalentTo(client, options => options.Excluding(o => o.Id)); + client.Should().BeEquivalentTo(clientEntity, options => options.Excluding(o => o.Id)); //Detached the added item context.Entry(clientEntity).State = EntityState.Detached; @@ -757,7 +757,7 @@ public async Task UpdateClientAsync() await context.Clients.Where(x => x.Id == updatedClient.Id).SingleAsync(); //Assert updated client - updatedClientEntity.ShouldBeEquivalentTo(updatedClient); + updatedClient.Should().BeEquivalentTo(updatedClientEntity); } } @@ -828,7 +828,7 @@ public async Task GetScopesApiResourceAsync() private void ClientCloneCompare(Client cloneClientEntity, Client clientToCompare, bool cloneClientCorsOrigins = true, bool cloneClientGrantTypes = true, bool cloneClientIdPRestrictions = true, bool cloneClientPostLogoutRedirectUris = true, bool cloneClientScopes = true, bool cloneClientRedirectUris = true, bool cloneClientClaims = true, bool cloneClientProperties = true) { //Assert cloned client - cloneClientEntity.ShouldBeEquivalentTo(clientToCompare, + clientToCompare.Should().BeEquivalentTo(cloneClientEntity, options => options.Excluding(o => o.Id) .Excluding(o => o.ClientSecrets) .Excluding(o => o.ClientId) @@ -851,9 +851,9 @@ private void ClientCloneCompare(Client cloneClientEntity, Client clientToCompare //New client relations have new id's and client relations therefore is required ignore them if (cloneClientGrantTypes) { - cloneClientEntity.AllowedGrantTypes.ShouldBeEquivalentTo(clientToCompare.AllowedGrantTypes, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("Client"))); + clientToCompare.AllowedGrantTypes.Should().BeEquivalentTo(cloneClientEntity.AllowedGrantTypes, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("Client"))); } else { @@ -862,9 +862,9 @@ private void ClientCloneCompare(Client cloneClientEntity, Client clientToCompare if (cloneClientCorsOrigins) { - cloneClientEntity.AllowedCorsOrigins.ShouldBeEquivalentTo(clientToCompare.AllowedCorsOrigins, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("Client"))); + clientToCompare.AllowedCorsOrigins.Should().BeEquivalentTo(cloneClientEntity.AllowedCorsOrigins, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("Client"))); } else { @@ -873,9 +873,9 @@ private void ClientCloneCompare(Client cloneClientEntity, Client clientToCompare if (cloneClientRedirectUris) { - cloneClientEntity.RedirectUris.ShouldBeEquivalentTo(clientToCompare.RedirectUris, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("Client"))); + clientToCompare.RedirectUris.Should().BeEquivalentTo(cloneClientEntity.RedirectUris, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("Client"))); } else { @@ -884,9 +884,9 @@ private void ClientCloneCompare(Client cloneClientEntity, Client clientToCompare if (cloneClientPostLogoutRedirectUris) { - cloneClientEntity.PostLogoutRedirectUris.ShouldBeEquivalentTo(clientToCompare.PostLogoutRedirectUris, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("Client"))); + clientToCompare.PostLogoutRedirectUris.Should().BeEquivalentTo(cloneClientEntity.PostLogoutRedirectUris, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("Client"))); } else { @@ -895,9 +895,9 @@ private void ClientCloneCompare(Client cloneClientEntity, Client clientToCompare if (cloneClientScopes) { - cloneClientEntity.AllowedScopes.ShouldBeEquivalentTo(clientToCompare.AllowedScopes, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("Client"))); + clientToCompare.AllowedScopes.Should().BeEquivalentTo(cloneClientEntity.AllowedScopes, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("Client"))); } else { @@ -906,9 +906,9 @@ private void ClientCloneCompare(Client cloneClientEntity, Client clientToCompare if (cloneClientClaims) { - cloneClientEntity.Claims.ShouldBeEquivalentTo(clientToCompare.Claims, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("Client"))); + clientToCompare.Claims.Should().BeEquivalentTo(cloneClientEntity.Claims, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("Client"))); } else { @@ -917,9 +917,9 @@ private void ClientCloneCompare(Client cloneClientEntity, Client clientToCompare if (cloneClientIdPRestrictions) { - cloneClientEntity.IdentityProviderRestrictions.ShouldBeEquivalentTo(clientToCompare.IdentityProviderRestrictions, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("Client"))); + clientToCompare.IdentityProviderRestrictions.Should().BeEquivalentTo(cloneClientEntity.IdentityProviderRestrictions, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("Client"))); } else { @@ -928,9 +928,9 @@ private void ClientCloneCompare(Client cloneClientEntity, Client clientToCompare if (cloneClientProperties) { - cloneClientEntity.Properties.ShouldBeEquivalentTo(clientToCompare.Properties, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("Client"))); + clientToCompare.Properties.Should().BeEquivalentTo(cloneClientEntity.Properties, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("Client"))); } else { @@ -942,7 +942,7 @@ private void ClientCloneCompare(Client cloneClientEntity, Client clientToCompare private void ClientAssert(Client client, Client clientToCompare) { - client.ShouldBeEquivalentTo(clientToCompare, + clientToCompare.Should().BeEquivalentTo(client, options => options.Excluding(o => o.Id) .Excluding(o => o.ClientSecrets) .Excluding(o => o.ClientId) @@ -961,42 +961,42 @@ private void ClientAssert(Client client, Client clientToCompare) .Excluding(o => o.Properties) ); - client.AllowedGrantTypes.ShouldBeEquivalentTo(clientToCompare.AllowedGrantTypes, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("Client"))); + clientToCompare.AllowedGrantTypes.Should().BeEquivalentTo(client.AllowedGrantTypes, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("Client"))); - client.AllowedCorsOrigins.ShouldBeEquivalentTo(clientToCompare.AllowedCorsOrigins, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("Client"))); + clientToCompare.AllowedCorsOrigins.Should().BeEquivalentTo(client.AllowedCorsOrigins, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("Client"))); - client.RedirectUris.ShouldBeEquivalentTo(clientToCompare.RedirectUris, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("Client"))); + clientToCompare.RedirectUris.Should().BeEquivalentTo(client.RedirectUris, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("Client"))); - client.PostLogoutRedirectUris.ShouldBeEquivalentTo(clientToCompare.PostLogoutRedirectUris, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("Client"))); + clientToCompare.PostLogoutRedirectUris.Should().BeEquivalentTo(client.PostLogoutRedirectUris, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("Client"))); - client.AllowedScopes.ShouldBeEquivalentTo(clientToCompare.AllowedScopes, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("Client"))); + clientToCompare.AllowedScopes.Should().BeEquivalentTo(client.AllowedScopes, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("Client"))); - client.ClientSecrets.ShouldBeEquivalentTo(clientToCompare.ClientSecrets, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("Client"))); + clientToCompare.ClientSecrets.Should().BeEquivalentTo(client.ClientSecrets, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("Client"))); - client.Claims.ShouldBeEquivalentTo(clientToCompare.Claims, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("Client"))); + clientToCompare.Claims.Should().BeEquivalentTo(client.Claims, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("Client"))); - client.IdentityProviderRestrictions.ShouldBeEquivalentTo( - clientToCompare.IdentityProviderRestrictions, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("Client"))); + clientToCompare.IdentityProviderRestrictions.Should().BeEquivalentTo( + client.IdentityProviderRestrictions, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("Client"))); - client.Properties.ShouldBeEquivalentTo(clientToCompare.Properties, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("Client"))); + clientToCompare.Properties.Should().BeEquivalentTo(client.Properties, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("Client"))); } } } \ No newline at end of file diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Repositories/IdentityResourceRepositoryTests.cs b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Repositories/IdentityResourceRepositoryTests.cs index a6d4eb9bd..9fbed6058 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Repositories/IdentityResourceRepositoryTests.cs +++ b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Repositories/IdentityResourceRepositoryTests.cs @@ -57,7 +57,7 @@ public async Task AddIdentityResourceAsync() var newIdentityResource = await context.IdentityResources.Where(x => x.Id == identityResource.Id).SingleAsync(); //Assert new identity resource - newIdentityResource.ShouldBeEquivalentTo(identityResource, options => options.Excluding(o => o.Id)); + identityResource.Should().BeEquivalentTo(newIdentityResource, options => options.Excluding(o => o.Id)); } } @@ -78,11 +78,11 @@ public async Task GetIdentityResourceAsync() var newIdentityResource = await identityResourceRepository.GetIdentityResourceAsync(identityResource.Id); //Assert new identity resource - newIdentityResource.ShouldBeEquivalentTo(identityResource, options => options.Excluding(o => o.Id).Excluding(o => o.UserClaims)); + identityResource.Should().BeEquivalentTo(newIdentityResource, options => options.Excluding(o => o.Id).Excluding(o => o.UserClaims)); - newIdentityResource.UserClaims.ShouldBeEquivalentTo(identityResource.UserClaims, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("IdentityResource"))); + identityResource.UserClaims.Should().BeEquivalentTo(newIdentityResource.UserClaims, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("IdentityResource"))); } } @@ -103,7 +103,7 @@ public async Task DeleteIdentityResourceAsync() var newIdentityResource = await context.IdentityResources.Where(x => x.Id == identityResource.Id).SingleAsync(); //Assert new identity resource - newIdentityResource.ShouldBeEquivalentTo(identityResource, options => options.Excluding(o => o.Id)); + identityResource.Should().BeEquivalentTo(newIdentityResource, options => options.Excluding(o => o.Id)); //Delete identity resource await identityResourceRepository.DeleteIdentityResourceAsync(newIdentityResource); @@ -133,7 +133,7 @@ public async Task UpdateIdentityResourceAsync() var newIdentityResource = await context.IdentityResources.Where(x => x.Id == identityResource.Id).SingleOrDefaultAsync(); //Assert new identity resource - newIdentityResource.ShouldBeEquivalentTo(identityResource, options => options.Excluding(o => o.Id)); + identityResource.Should().BeEquivalentTo(newIdentityResource, options => options.Excluding(o => o.Id)); //Detached the added item context.Entry(newIdentityResource).State = EntityState.Detached; @@ -148,7 +148,7 @@ public async Task UpdateIdentityResourceAsync() var updatedIdentityResourceEntity = await context.IdentityResources.Where(x => x.Id == updatedIdentityResource.Id).SingleAsync(); //Assert updated identity resource - updatedIdentityResource.ShouldBeEquivalentTo(updatedIdentityResourceEntity); + updatedIdentityResourceEntity.Should().BeEquivalentTo(updatedIdentityResource); } } @@ -168,13 +168,13 @@ public async Task AddIdentityResourcePropertyAsync() //Get new identity resource var resource = await identityResourceRepository.GetIdentityResourceAsync(identityResource.Id); - //Assert new identity resource - resource.ShouldBeEquivalentTo(identityResource, options => options.Excluding(o => o.Id) + //Assert new identity resource + identityResource.Should().BeEquivalentTo(resource, options => options.Excluding(o => o.Id) .Excluding(o => o.UserClaims)); - resource.UserClaims.ShouldBeEquivalentTo(identityResource.UserClaims, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("IdentityResource"))); + identityResource.UserClaims.Should().BeEquivalentTo(resource.UserClaims, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("IdentityResource"))); //Generate random new identity resource property var identityResourceProperty = IdentityResourceMock.GenerateRandomIdentityResourceProperty(0); @@ -186,7 +186,7 @@ public async Task AddIdentityResourcePropertyAsync() var resourceProperty = await context.IdentityResourceProperties.Where(x => x.Id == identityResourceProperty.Id) .SingleOrDefaultAsync(); - resourceProperty.ShouldBeEquivalentTo(identityResourceProperty, + identityResourceProperty.Should().BeEquivalentTo(resourceProperty, options => options.Excluding(o => o.Id).Excluding(x => x.IdentityResource)); } } @@ -207,12 +207,12 @@ public async Task DeleteIdentityResourcePropertyAsync() //Get new identity resource var resource = await identityResourceRepository.GetIdentityResourceAsync(identityResource.Id); - //Assert new identity resource - resource.ShouldBeEquivalentTo(identityResource, options => options.Excluding(o => o.Id).Excluding(o => o.UserClaims)); + //Assert new identity resource + identityResource.Should().BeEquivalentTo(resource, options => options.Excluding(o => o.Id).Excluding(o => o.UserClaims)); - resource.UserClaims.ShouldBeEquivalentTo(identityResource.UserClaims, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("IdentityResource"))); + identityResource.UserClaims.Should().BeEquivalentTo(resource.UserClaims, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("IdentityResource"))); //Generate random new identity resource property var identityResourceProperty = IdentityResourceMock.GenerateRandomIdentityResourceProperty(0); @@ -224,8 +224,8 @@ public async Task DeleteIdentityResourcePropertyAsync() var property = await context.IdentityResourceProperties.Where(x => x.Id == identityResourceProperty.Id) .SingleOrDefaultAsync(); - //Assert - property.ShouldBeEquivalentTo(identityResourceProperty, + //Assert + identityResourceProperty.Should().BeEquivalentTo(property, options => options.Excluding(o => o.Id).Excluding(x => x.IdentityResource)); //Try delete it @@ -256,12 +256,12 @@ public async Task GetIdentityResourcePropertyAsync() //Get new identity resource var resource = await identityResourceRepository.GetIdentityResourceAsync(identityResource.Id); - //Assert new identity resource - resource.ShouldBeEquivalentTo(identityResource, options => options.Excluding(o => o.Id).Excluding(o => o.UserClaims)); + //Assert new identity resource + identityResource.Should().BeEquivalentTo(resource, options => options.Excluding(o => o.Id).Excluding(o => o.UserClaims)); - resource.UserClaims.ShouldBeEquivalentTo(identityResource.UserClaims, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("IdentityResource"))); + identityResource.UserClaims.Should().BeEquivalentTo(resource.UserClaims, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("IdentityResource"))); //Generate random new identity resource property var identityResourceProperty = IdentityResourceMock.GenerateRandomIdentityResourceProperty(0); @@ -272,7 +272,7 @@ public async Task GetIdentityResourcePropertyAsync() //Get new identity resource property var resourceProperty = await identityResourceRepository.GetIdentityResourcePropertyAsync(identityResourceProperty.Id); - resourceProperty.ShouldBeEquivalentTo(identityResourceProperty, + identityResourceProperty.Should().BeEquivalentTo(resourceProperty, options => options.Excluding(o => o.Id).Excluding(x => x.IdentityResource)); } } diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Repositories/PersistedGrantRepositoryTests.cs b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Repositories/PersistedGrantRepositoryTests.cs index 981862854..2eaa03cf7 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Repositories/PersistedGrantRepositoryTests.cs +++ b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Repositories/PersistedGrantRepositoryTests.cs @@ -67,7 +67,7 @@ public async Task GetPersistedGrantAsync() var persistedGrantAdded = await persistedGrantRepository.GetPersistedGrantAsync(persistedGrantKey); //Assert - persistedGrant.ShouldBeEquivalentTo(persistedGrantAdded, opt => opt.Excluding(x => x.Key)); + persistedGrantAdded.Should().BeEquivalentTo(persistedGrant, opt => opt.Excluding(x => x.Key)); } } } diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Services/ApiResourceServiceTests.cs b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Services/ApiResourceServiceTests.cs index 70d9e9d8f..56a6c6628 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Services/ApiResourceServiceTests.cs +++ b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Services/ApiResourceServiceTests.cs @@ -105,7 +105,7 @@ public async Task AddApiResourceAsync() var newApiResourceDto = await apiResourceService.GetApiResourceAsync(apiResource.Id); //Assert new api resource - apiResourceDto.ShouldBeEquivalentTo(newApiResourceDto, options => options.Excluding(o => o.Id)); + newApiResourceDto.Should().BeEquivalentTo(apiResourceDto, options => options.Excluding(o => o.Id)); } } @@ -127,7 +127,7 @@ public async Task GetApiResourceAsync() var newApiResourceDto = await apiResourceService.GetApiResourceAsync(apiResource.Id); //Assert new api resource - apiResourceDto.ShouldBeEquivalentTo(newApiResourceDto, options => options.Excluding(o => o.Id)); + newApiResourceDto.Should().BeEquivalentTo(apiResourceDto, options => options.Excluding(o => o.Id)); } } @@ -149,7 +149,7 @@ public async Task RemoveApiResourceAsync() var newApiResourceDto = await apiResourceService.GetApiResourceAsync(apiResource.Id); //Assert new api resource - apiResourceDto.ShouldBeEquivalentTo(newApiResourceDto, options => options.Excluding(o => o.Id)); + newApiResourceDto.Should().BeEquivalentTo(apiResourceDto, options => options.Excluding(o => o.Id)); //Remove api resource await apiResourceService.DeleteApiResourceAsync(newApiResourceDto); @@ -181,7 +181,7 @@ public async Task UpdateApiResourceAsync() var newApiResourceDto = await apiResourceService.GetApiResourceAsync(apiResource.Id); //Assert new api resource - apiResourceDto.ShouldBeEquivalentTo(newApiResourceDto, options => options.Excluding(o => o.Id)); + newApiResourceDto.Should().BeEquivalentTo(apiResourceDto, options => options.Excluding(o => o.Id)); //Detached the added item context.Entry(apiResource).State = EntityState.Detached; @@ -195,7 +195,7 @@ public async Task UpdateApiResourceAsync() var updatedApiResourceDto = await apiResourceService.GetApiResourceAsync(apiResource.Id); //Assert updated api resuorce - updatedApiResource.ShouldBeEquivalentTo(updatedApiResourceDto, options => options.Excluding(o => o.Id)); + updatedApiResourceDto.Should().BeEquivalentTo(updatedApiResource, options => options.Excluding(o => o.Id)); } } @@ -217,7 +217,7 @@ public async Task AddApiSecretAsync() var newApiResourceDto = await apiResourceService.GetApiResourceAsync(apiResource.Id); //Assert new api resource - apiResourceDto.ShouldBeEquivalentTo(newApiResourceDto, options => options.Excluding(o => o.Id)); + newApiResourceDto.Should().BeEquivalentTo(apiResourceDto, options => options.Excluding(o => o.Id)); //Generate random new api secret var apiSecretsDto = ApiResourceDtoMock.GenerateRandomApiSecret(0, newApiResourceDto.Id); @@ -239,7 +239,7 @@ public async Task AddApiSecretAsync() secretsDto.Value.Should().Be(apiSecretsDto.Value); //Assert - newApiSecret.ShouldBeEquivalentTo(secretsDto, o => o.Excluding(x => x.ApiResourceName).Excluding(x => x.Value)); + secretsDto.Should().BeEquivalentTo(newApiSecret, o => o.Excluding(x => x.ApiResourceName).Excluding(x => x.Value)); } } @@ -261,7 +261,7 @@ public async Task DeleteApiSecretAsync() var newApiResourceDto = await apiResourceService.GetApiResourceAsync(apiResource.Id); //Assert new api resource - apiResourceDto.ShouldBeEquivalentTo(newApiResourceDto, options => options.Excluding(o => o.Id)); + newApiResourceDto.Should().BeEquivalentTo(apiResourceDto, options => options.Excluding(o => o.Id)); //Generate random new api secret var apiSecretsDtoMock = ApiResourceDtoMock.GenerateRandomApiSecret(0, newApiResourceDto.Id); @@ -280,7 +280,7 @@ public async Task DeleteApiSecretAsync() var newApiSecret = await apiResourceService.GetApiSecretAsync(apiSecretsDto.ApiSecretId); //Assert - newApiSecret.ShouldBeEquivalentTo(apiSecretsDto, o => o.Excluding(x => x.ApiResourceName).Excluding(x => x.Value)); + apiSecretsDto.Should().BeEquivalentTo(newApiSecret, o => o.Excluding(x => x.ApiResourceName).Excluding(x => x.Value)); apiSecretsDto.Value.Should().Be(apiSecretsDtoMock.Value); @@ -313,7 +313,7 @@ public async Task AddApiResourcePropertyAsync() var apiResourceDto = await apiResourceService.GetApiResourceAsync(resource.Id); //Assert new api resource - apiResource.ShouldBeEquivalentTo(apiResourceDto, options => options.Excluding(o => o.Id)); + apiResourceDto.Should().BeEquivalentTo(apiResource, options => options.Excluding(o => o.Id)); //Generate random new api resource property var apiResourceProperty = ApiResourceDtoMock.GenerateRandomApiResourceProperty(0, resource.Id); @@ -332,7 +332,7 @@ public async Task AddApiResourcePropertyAsync() var resourcePropertiesDto = await apiResourceService.GetApiResourcePropertyAsync(property.Id); //Assert - resourcePropertiesDto.ShouldBeEquivalentTo(propertyDto, options => + propertyDto.Should().BeEquivalentTo(resourcePropertiesDto, options => options.Excluding(o => o.ApiResourcePropertyId) .Excluding(o => o.ApiResourceName)); } @@ -356,7 +356,7 @@ public async Task GetApiResourcePropertyAsync() var apiResourceDto = await apiResourceService.GetApiResourceAsync(resource.Id); //Assert new api resource - apiResource.ShouldBeEquivalentTo(apiResourceDto, options => options.Excluding(o => o.Id)); + apiResourceDto.Should().BeEquivalentTo(apiResource, options => options.Excluding(o => o.Id)); //Generate random new api resource property var apiResourceProperty = ApiResourceDtoMock.GenerateRandomApiResourceProperty(0, resource.Id); @@ -375,7 +375,7 @@ public async Task GetApiResourcePropertyAsync() var apiResourcePropertiesDto = await apiResourceService.GetApiResourcePropertyAsync(property.Id); //Assert - apiResourcePropertiesDto.ShouldBeEquivalentTo(propertyDto, options => + propertyDto.Should().BeEquivalentTo(apiResourcePropertiesDto, options => options.Excluding(o => o.ApiResourcePropertyId) .Excluding(o => o.ApiResourceName)); } @@ -399,7 +399,7 @@ public async Task DeleteApiResourcePropertyAsync() var apiResourceDto = await apiResourceService.GetApiResourceAsync(resource.Id); //Assert new api resource - apiResource.ShouldBeEquivalentTo(apiResourceDto, options => options.Excluding(o => o.Id)); + apiResourceDto.Should().BeEquivalentTo(apiResource, options => options.Excluding(o => o.Id)); //Generate random new api resource Property var apiResourcePropertiesDto = ApiResourceDtoMock.GenerateRandomApiResourceProperty(0, resource.Id); @@ -418,7 +418,7 @@ public async Task DeleteApiResourcePropertyAsync() var resourcePropertiesDto = await apiResourceService.GetApiResourcePropertyAsync(property.Id); //Assert - resourcePropertiesDto.ShouldBeEquivalentTo(propertiesDto, options => + propertiesDto.Should().BeEquivalentTo(resourcePropertiesDto, options => options.Excluding(o => o.ApiResourcePropertyId) .Excluding(o => o.ApiResourceName)); diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Services/ApiScopeServiceTests.cs b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Services/ApiScopeServiceTests.cs index 95090696f..89e7e6e57 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Services/ApiScopeServiceTests.cs +++ b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Services/ApiScopeServiceTests.cs @@ -93,7 +93,7 @@ public async Task AddApiScopeAsync() var newApiScope = await apiScopeService.GetApiScopeAsync(apiScopesDto.Id); //Assert - newApiScope.ShouldBeEquivalentTo(apiScopesDto); + apiScopesDto.Should().BeEquivalentTo(newApiScope); } } @@ -121,7 +121,7 @@ public async Task GetApiScopeAsync() var newApiScope = await apiScopeService.GetApiScopeAsync(apiScopesDto.Id); //Assert - newApiScope.ShouldBeEquivalentTo(apiScopesDto); + apiScopesDto.Should().BeEquivalentTo(newApiScope); } } @@ -149,7 +149,7 @@ public async Task UpdateApiScopeAsync() var newApiScope = await apiScopeService.GetApiScopeAsync(apiScopesDto.Id); //Assert - newApiScope.ShouldBeEquivalentTo(apiScopesDto); + apiScopesDto.Should().BeEquivalentTo(newApiScope); //Detached the added item context.Entry(apiScope).State = EntityState.Detached; @@ -162,7 +162,7 @@ public async Task UpdateApiScopeAsync() var updatedApiScopeDto = await apiScopeService.GetApiScopeAsync(apiScopesDto.Id); //Assert updated api scope - updatedApiScope.ShouldBeEquivalentTo(updatedApiScopeDto); + updatedApiScopeDto.Should().BeEquivalentTo(updatedApiScope); } } @@ -190,7 +190,7 @@ public async Task DeleteApiScopeAsync() var newApiScope = await apiScopeService.GetApiScopeAsync(apiScopeDto.Id); //Assert - newApiScope.ShouldBeEquivalentTo(apiScopeDto); + apiScopeDto.Should().BeEquivalentTo(newApiScope); //Delete it await apiScopeService.DeleteApiScopeAsync(newApiScope); diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Services/ClientServiceTests.cs b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Services/ClientServiceTests.cs index c1658d9ef..e0054b257 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Services/ClientServiceTests.cs +++ b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Services/ClientServiceTests.cs @@ -87,7 +87,7 @@ public async Task AddClientAsync() var clientDto = await clientService.GetClientAsync(clientEntity.Id); //Assert new client - client.ShouldBeEquivalentTo(clientDto, options => options.Excluding(o => o.Id)); + clientDto.Should().BeEquivalentTo(client, options => options.Excluding(o => o.Id)); } } @@ -141,7 +141,7 @@ public async Task CloneClientAsync() .Where(x => x.Id == clientDtoToClone.Id).SingleOrDefaultAsync(); //Assert cloned client - cloneClientEntity.ShouldBeEquivalentTo(clientToCompare, + clientToCompare.Should().BeEquivalentTo(cloneClientEntity, options => options.Excluding(o => o.Id) .Excluding(o => o.ClientSecrets) .Excluding(o => o.ClientId) @@ -162,42 +162,42 @@ public async Task CloneClientAsync() //New client relations have new id's and client relations therefore is required ignore them - cloneClientEntity.AllowedGrantTypes.ShouldBeEquivalentTo(clientToCompare.AllowedGrantTypes, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("Client"))); + clientToCompare.AllowedGrantTypes.Should().BeEquivalentTo(cloneClientEntity.AllowedGrantTypes, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("Client"))); - cloneClientEntity.AllowedCorsOrigins.ShouldBeEquivalentTo(clientToCompare.AllowedCorsOrigins, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("Client"))); + clientToCompare.AllowedCorsOrigins.Should().BeEquivalentTo(cloneClientEntity.AllowedCorsOrigins, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("Client"))); - cloneClientEntity.RedirectUris.ShouldBeEquivalentTo(clientToCompare.RedirectUris, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("Client"))); + clientToCompare.RedirectUris.Should().BeEquivalentTo(cloneClientEntity.RedirectUris, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("Client"))); - cloneClientEntity.PostLogoutRedirectUris.ShouldBeEquivalentTo(clientToCompare.PostLogoutRedirectUris, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("Client"))); + clientToCompare.PostLogoutRedirectUris.Should().BeEquivalentTo(cloneClientEntity.PostLogoutRedirectUris, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("Client"))); - cloneClientEntity.AllowedScopes.ShouldBeEquivalentTo(clientToCompare.AllowedScopes, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("Client"))); + clientToCompare.AllowedScopes.Should().BeEquivalentTo(cloneClientEntity.AllowedScopes, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("Client"))); - cloneClientEntity.ClientSecrets.ShouldBeEquivalentTo(clientToCompare.ClientSecrets, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("Client"))); + clientToCompare.ClientSecrets.Should().BeEquivalentTo(cloneClientEntity.ClientSecrets, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("Client"))); - cloneClientEntity.Claims.ShouldBeEquivalentTo(clientToCompare.Claims, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("Client"))); + clientToCompare.Claims.Should().BeEquivalentTo(cloneClientEntity.Claims, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("Client"))); - cloneClientEntity.IdentityProviderRestrictions.ShouldBeEquivalentTo( + clientToCompare.IdentityProviderRestrictions.Should().BeEquivalentTo( clientToCompare.IdentityProviderRestrictions, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("Client"))); + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("Client"))); - cloneClientEntity.Properties.ShouldBeEquivalentTo(clientToCompare.Properties, - option => option.Excluding(x => x.SelectedMemberPath.EndsWith("Id")) - .Excluding(x => x.SelectedMemberPath.EndsWith("Client"))); + clientToCompare.Properties.Should().BeEquivalentTo(cloneClientEntity.Properties, + option => option.Excluding(x => x.Path.EndsWith("Id")) + .Excluding(x => x.Path.EndsWith("Client"))); } } @@ -221,7 +221,7 @@ public async Task UpdateClientAsync() var clientDto = await clientService.GetClientAsync(clientEntity.Id); //Assert new client - client.ShouldBeEquivalentTo(clientDto, options => options.Excluding(o => o.Id)); + clientDto.Should().BeEquivalentTo(client, options => options.Excluding(o => o.Id)); //Detached the added item context.Entry(clientEntity).State = EntityState.Detached; @@ -238,7 +238,7 @@ public async Task UpdateClientAsync() var updatedClientDto = await clientService.GetClientAsync(updatedClientEntity.Id); //Assert updated client - updatedClient.ShouldBeEquivalentTo(updatedClientDto, options => options.Excluding(o => o.Id)); + updatedClientDto.Should().BeEquivalentTo(updatedClient, options => options.Excluding(o => o.Id)); } } @@ -262,7 +262,7 @@ public async Task RemoveClientAsync() var clientDto = await clientService.GetClientAsync(clientEntity.Id); //Assert new client - client.ShouldBeEquivalentTo(clientDto, options => options.Excluding(o => o.Id)); + clientDto.Should().BeEquivalentTo(client, options => options.Excluding(o => o.Id)); //Detached the added item context.Entry(clientEntity).State = EntityState.Detached; @@ -298,7 +298,7 @@ public async Task GetClientAsync() var clientDto = await clientService.GetClientAsync(clientEntity.Id); //Assert new client - client.ShouldBeEquivalentTo(clientDto, options => options.Excluding(o => o.Id)); + clientDto.Should().BeEquivalentTo(client, options => options.Excluding(o => o.Id)); } } @@ -321,7 +321,7 @@ public async Task AddClientClaimAsync() var clientDto = await clientService.GetClientAsync(clientEntity.Id); //Assert new client - client.ShouldBeEquivalentTo(clientDto, options => options.Excluding(o => o.Id)); + clientDto.Should().BeEquivalentTo(client, options => options.Excluding(o => o.Id)); //Generate random new Client Claim var clientClaim = ClientDtoMock.GenerateRandomClientClaim(0, clientEntity.Id); @@ -340,7 +340,7 @@ public async Task AddClientClaimAsync() var clientClaimsDto = await clientService.GetClientClaimAsync(claim.Id); //Assert - clientClaimsDto.ShouldBeEquivalentTo(claimsDto, options => + claimsDto.Should().BeEquivalentTo(clientClaimsDto, options => options.Excluding(o => o.ClientClaimId) .Excluding(o => o.ClientName)); } @@ -365,7 +365,7 @@ public async Task DeleteClientClaimAsync() var clientDto = await clientService.GetClientAsync(clientEntity.Id); //Assert new client - client.ShouldBeEquivalentTo(clientDto, options => options.Excluding(o => o.Id)); + clientDto.Should().BeEquivalentTo(client, options => options.Excluding(o => o.Id)); //Generate random new Client Claim var clientClaim = ClientDtoMock.GenerateRandomClientClaim(0, clientEntity.Id); @@ -384,7 +384,7 @@ public async Task DeleteClientClaimAsync() var clientClaimsDto = await clientService.GetClientClaimAsync(claim.Id); //Assert - clientClaimsDto.ShouldBeEquivalentTo(claimsDto, options => options.Excluding(o => o.ClientClaimId) + claimsDto.Should().BeEquivalentTo(clientClaimsDto, options => options.Excluding(o => o.ClientClaimId) .Excluding(o => o.ClientName)); //Delete client claim @@ -417,7 +417,7 @@ public async Task GetClientClaimAsync() var clientDto = await clientService.GetClientAsync(clientEntity.Id); //Assert new client - client.ShouldBeEquivalentTo(clientDto, options => options.Excluding(o => o.Id)); + clientDto.Should().BeEquivalentTo(client, options => options.Excluding(o => o.Id)); //Generate random new Client Claim var clientClaim = ClientDtoMock.GenerateRandomClientClaim(0, clientEntity.Id); @@ -436,7 +436,7 @@ public async Task GetClientClaimAsync() var clientClaimsDto = await clientService.GetClientClaimAsync(claim.Id); //Assert - clientClaimsDto.ShouldBeEquivalentTo(claimsDto, options => options.Excluding(o => o.ClientClaimId) + claimsDto.Should().BeEquivalentTo(clientClaimsDto, options => options.Excluding(o => o.ClientClaimId) .Excluding(o => o.ClientName)); } } @@ -460,7 +460,7 @@ public async Task AddClientPropertyAsync() var clientDto = await clientService.GetClientAsync(clientEntity.Id); //Assert new client - client.ShouldBeEquivalentTo(clientDto, options => options.Excluding(o => o.Id)); + clientDto.Should().BeEquivalentTo(client, options => options.Excluding(o => o.Id)); //Generate random new Client property var clicentProperty = ClientDtoMock.GenerateRandomClientProperty(0, clientEntity.Id); @@ -479,7 +479,7 @@ public async Task AddClientPropertyAsync() var clientPropertiesDto = await clientService.GetClientPropertyAsync(property.Id); //Assert - clientPropertiesDto.ShouldBeEquivalentTo(propertyDto, options => + propertyDto.Should().BeEquivalentTo(clientPropertiesDto, options => options.Excluding(o => o.ClientPropertyId) .Excluding(o => o.ClientName)); } @@ -504,7 +504,7 @@ public async Task GetClientPropertyAsync() var clientDto = await clientService.GetClientAsync(clientEntity.Id); //Assert new client - client.ShouldBeEquivalentTo(clientDto, options => options.Excluding(o => o.Id)); + clientDto.Should().BeEquivalentTo(client, options => options.Excluding(o => o.Id)); //Generate random new Client property var clicentProperty = ClientDtoMock.GenerateRandomClientProperty(0, clientEntity.Id); @@ -523,7 +523,7 @@ public async Task GetClientPropertyAsync() var clientPropertiesDto = await clientService.GetClientPropertyAsync(property.Id); //Assert - clientPropertiesDto.ShouldBeEquivalentTo(propertyDto, options => options.Excluding(o => o.ClientPropertyId) + propertyDto.Should().BeEquivalentTo(clientPropertiesDto, options => options.Excluding(o => o.ClientPropertyId) .Excluding(o => o.ClientName)); } } @@ -547,7 +547,7 @@ public async Task DeleteClientPropertyAsync() var clientDto = await clientService.GetClientAsync(clientEntity.Id); //Assert new client - client.ShouldBeEquivalentTo(clientDto, options => options.Excluding(o => o.Id)); + clientDto.Should().BeEquivalentTo(client, options => options.Excluding(o => o.Id)); //Generate random new Client Property var clientProperty = ClientDtoMock.GenerateRandomClientProperty(0, clientEntity.Id); @@ -566,7 +566,7 @@ public async Task DeleteClientPropertyAsync() var clientPropertiesDto = await clientService.GetClientPropertyAsync(property.Id); //Assert - clientPropertiesDto.ShouldBeEquivalentTo(propertiesDto, options => options.Excluding(o => o.ClientPropertyId) + propertiesDto.Should().BeEquivalentTo(clientPropertiesDto, options => options.Excluding(o => o.ClientPropertyId) .Excluding(o => o.ClientName)); //Delete client Property @@ -599,7 +599,7 @@ public async Task AddClientSecretAsync() var clientDto = await clientService.GetClientAsync(clientEntity.Id); //Assert new client - client.ShouldBeEquivalentTo(clientDto, options => options.Excluding(o => o.Id)); + clientDto.Should().BeEquivalentTo(client, options => options.Excluding(o => o.Id)); //Generate random new Client secret var clientSecret = ClientDtoMock.GenerateRandomClientSecret(0, clientEntity.Id); @@ -620,7 +620,7 @@ public async Task AddClientSecretAsync() clientSecretsDto.Value.Should().Be(clientSecret.Value); //Assert - secretsDto.ShouldBeEquivalentTo(clientSecretsDto, options => + clientSecretsDto.Should().BeEquivalentTo(secretsDto, options => options.Excluding(o => o.ClientSecretId) .Excluding(o => o.ClientName) .Excluding(o => o.Value)); @@ -646,7 +646,7 @@ public async Task GetClientSecretAsync() var clientDto = await clientService.GetClientAsync(clientEntity.Id); //Assert new client - client.ShouldBeEquivalentTo(clientDto, options => options.Excluding(o => o.Id)); + clientDto.Should().BeEquivalentTo(client, options => options.Excluding(o => o.Id)); //Generate random new Client secret var clientSecret = ClientDtoMock.GenerateRandomClientSecret(0, clientEntity.Id); @@ -667,7 +667,7 @@ public async Task GetClientSecretAsync() clientSecretsDto.Value.Should().Be(clientSecret.Value); //Assert - secretsDto.ShouldBeEquivalentTo(clientSecretsDto, options => options.Excluding(o => o.ClientSecretId) + clientSecretsDto.Should().BeEquivalentTo(secretsDto, options => options.Excluding(o => o.ClientSecretId) .Excluding(o => o.ClientName) .Excluding(o => o.Value)); } @@ -692,7 +692,7 @@ public async Task DeleteClientSecretAsync() var clientDto = await clientService.GetClientAsync(clientEntity.Id); //Assert new client - client.ShouldBeEquivalentTo(clientDto, options => options.Excluding(o => o.Id)); + clientDto.Should().BeEquivalentTo(client, options => options.Excluding(o => o.Id)); //Generate random new Client secret var clientSecret = ClientDtoMock.GenerateRandomClientSecret(0, clientEntity.Id); @@ -711,7 +711,7 @@ public async Task DeleteClientSecretAsync() var clientSecretsDto = await clientService.GetClientSecretAsync(secret.Id); //Assert - clientSecretsDto.ShouldBeEquivalentTo(secretsDto, options => options.Excluding(o => o.ClientSecretId) + secretsDto.Should().BeEquivalentTo(clientSecretsDto, options => options.Excluding(o => o.ClientSecretId) .Excluding(o => o.ClientName) .Excluding(o => o.Value)); diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Services/IdentityResourceServiceTests.cs b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Services/IdentityResourceServiceTests.cs index 2e4993491..cfd3f885f 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Services/IdentityResourceServiceTests.cs +++ b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Services/IdentityResourceServiceTests.cs @@ -86,7 +86,7 @@ public async Task AddIdentityResourceAsync() var newIdentityResourceDto = await identityResourceService.GetIdentityResourceAsync(identityResource.Id); //Assert new identity resource - identityResourceDto.ShouldBeEquivalentTo(newIdentityResourceDto, options => options.Excluding(o => o.Id)); + newIdentityResourceDto.Should().BeEquivalentTo(identityResourceDto, options => options.Excluding(o => o.Id)); } } @@ -108,7 +108,7 @@ public async Task GetIdentityResourceAsync() var newIdentityResourceDto = await identityResourceService.GetIdentityResourceAsync(identityResource.Id); //Assert new identity resource - identityResourceDto.ShouldBeEquivalentTo(newIdentityResourceDto, options => options.Excluding(o => o.Id)); + newIdentityResourceDto.Should().BeEquivalentTo(identityResourceDto, options => options.Excluding(o => o.Id)); } } @@ -130,7 +130,7 @@ public async Task RemoveIdentityResourceAsync() var newIdentityResourceDto = await identityResourceService.GetIdentityResourceAsync(identityResource.Id); //Assert new identity resource - identityResourceDto.ShouldBeEquivalentTo(newIdentityResourceDto, options => options.Excluding(o => o.Id)); + newIdentityResourceDto.Should().BeEquivalentTo(identityResourceDto, options => options.Excluding(o => o.Id)); //Remove identity resource await identityResourceService.DeleteIdentityResourceAsync(newIdentityResourceDto); @@ -162,7 +162,7 @@ public async Task UpdateIdentityResourceAsync() var newIdentityResourceDto = await identityResourceService.GetIdentityResourceAsync(identityResource.Id); //Assert new identity resource - identityResourceDto.ShouldBeEquivalentTo(newIdentityResourceDto, options => options.Excluding(o => o.Id)); + newIdentityResourceDto.Should().BeEquivalentTo(identityResourceDto, options => options.Excluding(o => o.Id)); //Detached the added item context.Entry(identityResource).State = EntityState.Detached; @@ -176,7 +176,7 @@ public async Task UpdateIdentityResourceAsync() var updatedIdentityResourceDto = await identityResourceService.GetIdentityResourceAsync(identityResource.Id); //Assert updated identity resuorce - updatedIdentityResource.ShouldBeEquivalentTo(updatedIdentityResourceDto, options => options.Excluding(o => o.Id)); + updatedIdentityResourceDto.Should().BeEquivalentTo(updatedIdentityResource, options => options.Excluding(o => o.Id)); } } @@ -198,7 +198,7 @@ public async Task AddIdentityResourcePropertyAsync() var identityResourceDto = await identityResourceService.GetIdentityResourceAsync(resource.Id); //Assert new identity resource - identityResource.ShouldBeEquivalentTo(identityResourceDto, options => options.Excluding(o => o.Id)); + identityResourceDto.Should().BeEquivalentTo(identityResource, options => options.Excluding(o => o.Id)); //Generate random new identity resource property var resourceProperty = IdentityResourceDtoMock.GenerateRandomIdentityResourceProperty(0, resource.Id); @@ -217,7 +217,7 @@ public async Task AddIdentityResourcePropertyAsync() var resourcePropertiesDto = await identityResourceService.GetIdentityResourcePropertyAsync(property.Id); //Assert - resourcePropertiesDto.ShouldBeEquivalentTo(propertyDto, options => + propertyDto.Should().BeEquivalentTo(resourcePropertiesDto, options => options.Excluding(o => o.IdentityResourcePropertyId) .Excluding(o => o.IdentityResourceName)); } @@ -241,7 +241,7 @@ public async Task GetIdentityResourcePropertyAsync() var identityResourceDto = await identityResourceService.GetIdentityResourceAsync(resource.Id); //Assert new identity resource - identityResource.ShouldBeEquivalentTo(identityResourceDto, options => options.Excluding(o => o.Id)); + identityResourceDto.Should().BeEquivalentTo(identityResource, options => options.Excluding(o => o.Id)); //Generate random new identity resource property var identityResourceProperty = IdentityResourceDtoMock.GenerateRandomIdentityResourceProperty(0, resource.Id); @@ -260,7 +260,7 @@ public async Task GetIdentityResourcePropertyAsync() var resourcePropertiesDto = await identityResourceService.GetIdentityResourcePropertyAsync(property.Id); //Assert - resourcePropertiesDto.ShouldBeEquivalentTo(propertyDto, options => + propertyDto.Should().BeEquivalentTo(resourcePropertiesDto, options => options.Excluding(o => o.IdentityResourcePropertyId) .Excluding(o => o.IdentityResourceName)); } @@ -284,7 +284,7 @@ public async Task DeleteIdentityResourcePropertyAsync() var identityResourceDto = await identityResourceService.GetIdentityResourceAsync(resource.Id); //Assert new identity resource - resourceDto.ShouldBeEquivalentTo(identityResourceDto, options => options.Excluding(o => o.Id)); + identityResourceDto.Should().BeEquivalentTo(resourceDto, options => options.Excluding(o => o.Id)); //Generate random new identity resource Property var identityResourcePropertiesDto = IdentityResourceDtoMock.GenerateRandomIdentityResourceProperty(0, resource.Id); @@ -303,7 +303,7 @@ public async Task DeleteIdentityResourcePropertyAsync() var resourcePropertiesDto = await identityResourceService.GetIdentityResourcePropertyAsync(property.Id); //Assert - resourcePropertiesDto.ShouldBeEquivalentTo(propertiesDto, options => + propertiesDto.Should().BeEquivalentTo(resourcePropertiesDto, options => options.Excluding(o => o.IdentityResourcePropertyId) .Excluding(o => o.IdentityResourceName)); diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Services/IdentityServiceTests.cs b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Services/IdentityServiceTests.cs index e6e84324e..d73bc3d2b 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Services/IdentityServiceTests.cs +++ b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Services/IdentityServiceTests.cs @@ -143,7 +143,7 @@ public async Task AddUserAsync() var newUserDto = await identityService.GetUserAsync(userDto.Id.ToString()); //Assert new user - userDto.ShouldBeEquivalentTo(newUserDto); + newUserDto.Should().BeEquivalentTo(userDto); } } @@ -166,7 +166,7 @@ public async Task DeleteUserProviderAsync() var newUserDto = await identityService.GetUserAsync(userDto.Id.ToString()); //Assert new user - userDto.ShouldBeEquivalentTo(newUserDto); + newUserDto.Should().BeEquivalentTo(userDto); var userProvider = IdentityMock.GenerateRandomUserProviders(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), newUserDto.Id); @@ -209,7 +209,7 @@ public async Task AddUserRoleAsync() var newUserDto = await identityService.GetUserAsync(userDto.Id.ToString()); //Assert new user - userDto.ShouldBeEquivalentTo(newUserDto); + newUserDto.Should().BeEquivalentTo(userDto); //Generate random new role var roleDto = IdentityDtoMock.GenerateRandomRole(); @@ -223,7 +223,7 @@ public async Task AddUserRoleAsync() var newRoleDto = await identityService.GetRoleAsync(roleDto.Id.ToString()); //Assert new role - roleDto.ShouldBeEquivalentTo(newRoleDto); + newRoleDto.Should().BeEquivalentTo(roleDto); var userRoleDto = IdentityDtoMock.GenerateRandomUserRole>(roleDto.Id, userDto.Id); @@ -255,7 +255,7 @@ public async Task DeleteUserRoleAsync() var newUserDto = await identityService.GetUserAsync(userDto.Id.ToString()); //Assert new user - userDto.ShouldBeEquivalentTo(newUserDto); + newUserDto.Should().BeEquivalentTo(userDto); //Generate random new role var roleDto = IdentityDtoMock.GenerateRandomRole(); @@ -269,7 +269,7 @@ public async Task DeleteUserRoleAsync() var newRoleDto = await identityService.GetRoleAsync(roleDto.Id.ToString()); //Assert new role - roleDto.ShouldBeEquivalentTo(newRoleDto); + newRoleDto.Should().BeEquivalentTo(roleDto); var userRoleDto = IdentityDtoMock.GenerateRandomUserRole>(roleDto.Id, userDto.Id); @@ -306,7 +306,7 @@ public async Task AddUserClaimAsync() var newUserDto = await identityService.GetUserAsync(userDto.Id.ToString()); //Assert new user - userDto.ShouldBeEquivalentTo(newUserDto); + newUserDto.Should().BeEquivalentTo(userDto); //Generate random new user claim var userClaimDto = IdentityDtoMock.GenerateRandomUserClaim(0, userDto.Id); @@ -320,7 +320,7 @@ public async Task AddUserClaimAsync() var newUserClaim = await identityService.GetUserClaimAsync(userDto.Id.ToString(), claim.Id); //Assert new user claim - userClaimDto.ShouldBeEquivalentTo(newUserClaim); + newUserClaim.Should().BeEquivalentTo(userClaimDto); } } @@ -343,7 +343,7 @@ public async Task DeleteUserClaimAsync() var newUserDto = await identityService.GetUserAsync(userDto.Id.ToString()); //Assert new user - userDto.ShouldBeEquivalentTo(newUserDto); + newUserDto.Should().BeEquivalentTo(userDto); //Generate random new user claim var userClaimDto = IdentityDtoMock.GenerateRandomUserClaim(0, userDto.Id); @@ -357,7 +357,7 @@ public async Task DeleteUserClaimAsync() var newUserClaim = await identityService.GetUserClaimAsync(userDto.Id.ToString(), claim.Id); //Assert new user claim - userClaimDto.ShouldBeEquivalentTo(newUserClaim); + newUserClaim.Should().BeEquivalentTo(userClaimDto); await identityService.DeleteUserClaimAsync(userClaimDto); @@ -386,7 +386,7 @@ public async Task UpdateUserAsync() var newUserDto = await identityService.GetUserAsync(userDto.Id.ToString()); //Assert new user - userDto.ShouldBeEquivalentTo(newUserDto); + newUserDto.Should().BeEquivalentTo(userDto); //Detached the added item context.Entry(user).State = EntityState.Detached; @@ -400,7 +400,7 @@ public async Task UpdateUserAsync() var updatedUser = await identityService.GetUserAsync(userDtoForUpdate.Id.ToString()); //Assert updated user - userDtoForUpdate.ShouldBeEquivalentTo(updatedUser); + updatedUser.Should().BeEquivalentTo(userDtoForUpdate); } } @@ -423,7 +423,7 @@ public async Task DeleteUserAsync() var newUserDto = await identityService.GetUserAsync(userDto.Id.ToString()); //Assert new user - userDto.ShouldBeEquivalentTo(newUserDto); + newUserDto.Should().BeEquivalentTo(userDto); //Remove user await identityService.DeleteUserAsync(newUserDto.Id.ToString(), newUserDto); @@ -456,7 +456,7 @@ public async Task AddRoleAsync() var newRoleDto = await identityService.GetRoleAsync(roleDto.Id.ToString()); //Assert new role - roleDto.ShouldBeEquivalentTo(newRoleDto); + newRoleDto.Should().BeEquivalentTo(roleDto); } } @@ -479,7 +479,7 @@ public async Task UpdateRoleAsync() var newRoleDto = await identityService.GetRoleAsync(roleDto.Id.ToString()); //Assert new role - roleDto.ShouldBeEquivalentTo(newRoleDto); + newRoleDto.Should().BeEquivalentTo(roleDto); //Detached the added item context.Entry(role).State = EntityState.Detached; @@ -493,7 +493,7 @@ public async Task UpdateRoleAsync() var updatedRole = await identityService.GetRoleAsync(roleDtoForUpdate.Id.ToString()); //Assert updated role - roleDtoForUpdate.ShouldBeEquivalentTo(updatedRole); + updatedRole.Should().BeEquivalentTo(roleDtoForUpdate); } } @@ -516,7 +516,7 @@ public async Task DeleteRoleAsync() var newRoleDto = await identityService.GetRoleAsync(roleDto.Id.ToString()); //Assert new role - roleDto.ShouldBeEquivalentTo(newRoleDto); + newRoleDto.Should().BeEquivalentTo(roleDto); //Remove role await identityService.DeleteRoleAsync(newRoleDto); @@ -549,7 +549,7 @@ public async Task AddRoleClaimAsync() var newRoleDto = await identityService.GetRoleAsync(roleDto.Id.ToString()); //Assert new role - roleDto.ShouldBeEquivalentTo(newRoleDto); + newRoleDto.Should().BeEquivalentTo(roleDto); //Generate random new role claim var roleClaimDto = IdentityDtoMock.GenerateRandomRoleClaim(0, roleDto.Id); @@ -563,7 +563,7 @@ public async Task AddRoleClaimAsync() var newRoleClaimDto = await identityService.GetRoleClaimAsync(roleDto.Id.ToString(), roleClaimDto.ClaimId); //Assert new role - roleClaimDto.ShouldBeEquivalentTo(newRoleClaimDto, options => options.Excluding(o => o.RoleName)); + newRoleClaimDto.Should().BeEquivalentTo(roleClaimDto, options => options.Excluding(o => o.RoleName)); } } @@ -586,7 +586,7 @@ public async Task RemoveRoleClaimAsync() var newRoleDto = await identityService.GetRoleAsync(roleDto.Id.ToString()); //Assert new role - roleDto.ShouldBeEquivalentTo(newRoleDto); + newRoleDto.Should().BeEquivalentTo(roleDto); //Generate random new role claim var roleClaimDto = IdentityDtoMock.GenerateRandomRoleClaim(0, roleDto.Id); @@ -600,7 +600,7 @@ public async Task RemoveRoleClaimAsync() var newRoleClaimDto = await identityService.GetRoleClaimAsync(roleDto.Id.ToString(), roleClaimDto.ClaimId); //Assert new role - roleClaimDto.ShouldBeEquivalentTo(newRoleClaimDto, options => options.Excluding(o => o.RoleName)); + newRoleClaimDto.Should().BeEquivalentTo(roleClaimDto, options => options.Excluding(o => o.RoleName)); await identityService.DeleteRoleClaimAsync(roleClaimDto); diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Services/PersistedGrantServiceTests.cs b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Services/PersistedGrantServiceTests.cs index ce448e708..e6255057e 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Services/PersistedGrantServiceTests.cs +++ b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Services/PersistedGrantServiceTests.cs @@ -89,7 +89,7 @@ public async Task GetPersistedGrantAsync() var persistedGrantAdded = await persistedGrantService.GetPersistedGrantAsync(persistedGrantKey); //Assert - persistedGrant.ShouldBeEquivalentTo(persistedGrantAdded); + persistedGrantAdded.Should().BeEquivalentTo(persistedGrant); } } } diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Skoruba.Duende.IdentityServer.Admin.UnitTests.csproj b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Skoruba.Duende.IdentityServer.Admin.UnitTests.csproj index daf5a482b..7fce5cf8e 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Skoruba.Duende.IdentityServer.Admin.UnitTests.csproj +++ b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Skoruba.Duende.IdentityServer.Admin.UnitTests.csproj @@ -17,8 +17,8 @@ runtime; build; native; contentfiles; analyzers - - + + From 50f090b74ecec5fa4cb333a33b063ae6ae0c3246 Mon Sep 17 00:00:00 2001 From: janskoruba Date: Mon, 20 Dec 2021 13:41:00 +0100 Subject: [PATCH 04/23] Update to the latest packages --- docker-compose.vs.debug.yml | 2 +- docker-compose.vs.release.yml | 2 +- .../Dockerfile | 4 +-- ...uba.Duende.IdentityServer.Admin.Api.csproj | 20 ++++++------ ...Server.Admin.BusinessLogic.Identity.csproj | 2 +- ...Admin.EntityFramework.Configuration.csproj | 6 ++-- ...rver.Admin.EntityFramework.Identity.csproj | 2 +- ...er.Admin.EntityFramework.PostgreSQL.csproj | 2 +- ...Server.Admin.EntityFramework.Shared.csproj | 2 +- ...ver.Admin.EntityFramework.SqlServer.csproj | 2 +- ...dentityServer.Admin.EntityFramework.csproj | 2 +- ...ruba.Duende.IdentityServer.Admin.UI.csproj | 6 ++-- .../Dockerfile | 4 +-- ...Skoruba.Duende.IdentityServer.Admin.csproj | 18 +++++------ .../Dockerfile | 4 +-- ....Duende.IdentityServer.STS.Identity.csproj | 26 +++++++-------- ...IdentityServer.Shared.Configuration.csproj | 8 ++--- ...koruba.Duende.IdentityServer.Shared.csproj | 8 ++--- templates/0-build-template.ps1 | 32 +------------------ .../Dockerfile | 4 +-- .../Dockerfile | 4 +-- .../Dockerfile | 4 +-- ...tyServer.Admin.Api.IntegrationTests.csproj | 2 +- ...entityServer.Admin.IntegrationTests.csproj | 4 +-- ...erver.STS.Identity.IntegrationTests.csproj | 6 ++-- 25 files changed, 73 insertions(+), 103 deletions(-) diff --git a/docker-compose.vs.debug.yml b/docker-compose.vs.debug.yml index 92d1a4d4f..4bf6df5e8 100644 --- a/docker-compose.vs.debug.yml +++ b/docker-compose.vs.debug.yml @@ -5,7 +5,7 @@ services: volumes: - ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro labels: - com.microsoft.visualstudio.debuggee.arguments: ' --additionalProbingPath /root/.nuget/packages --additionalProbingPath /root/.nuget/fallbackpackages "bin/Debug/net5.0/Skoruba.Duende.IdentityServer.Admin.dll" /seed' + com.microsoft.visualstudio.debuggee.arguments: ' --additionalProbingPath /root/.nuget/packages --additionalProbingPath /root/.nuget/fallbackpackages "bin/Debug/net6.0/Skoruba.Duende.IdentityServer.Admin.dll" /seed' skoruba.duende.identityserver.admin.api: volumes: diff --git a/docker-compose.vs.release.yml b/docker-compose.vs.release.yml index 92d1a4d4f..4bf6df5e8 100644 --- a/docker-compose.vs.release.yml +++ b/docker-compose.vs.release.yml @@ -5,7 +5,7 @@ services: volumes: - ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro labels: - com.microsoft.visualstudio.debuggee.arguments: ' --additionalProbingPath /root/.nuget/packages --additionalProbingPath /root/.nuget/fallbackpackages "bin/Debug/net5.0/Skoruba.Duende.IdentityServer.Admin.dll" /seed' + com.microsoft.visualstudio.debuggee.arguments: ' --additionalProbingPath /root/.nuget/packages --additionalProbingPath /root/.nuget/fallbackpackages "bin/Debug/net6.0/Skoruba.Duende.IdentityServer.Admin.dll" /seed' skoruba.duende.identityserver.admin.api: volumes: diff --git a/src/Skoruba.Duende.IdentityServer.Admin.Api/Dockerfile b/src/Skoruba.Duende.IdentityServer.Admin.Api/Dockerfile index ef7b0b35c..2b249e1c4 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.Api/Dockerfile +++ b/src/Skoruba.Duende.IdentityServer.Admin.Api/Dockerfile @@ -1,9 +1,9 @@ -FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim AS base +FROM mcr.microsoft.com/dotnet/aspnet:6.0-buster-slim AS base WORKDIR /app EXPOSE 80 EXPOSE 443 -FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build +FROM mcr.microsoft.com/dotnet/sdk:6.0-buster-slim AS build WORKDIR /src COPY ["src/Skoruba.Duende.IdentityServer.Admin.Api/Skoruba.Duende.IdentityServer.Admin.Api.csproj", "src/Skoruba.Duende.IdentityServer.Admin.Api/"] COPY ["src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL.csproj", "src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL/"] diff --git a/src/Skoruba.Duende.IdentityServer.Admin.Api/Skoruba.Duende.IdentityServer.Admin.Api.csproj b/src/Skoruba.Duende.IdentityServer.Admin.Api/Skoruba.Duende.IdentityServer.Admin.Api.csproj index e9a58fc3b..12289c98c 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.Api/Skoruba.Duende.IdentityServer.Admin.Api.csproj +++ b/src/Skoruba.Duende.IdentityServer.Admin.Api/Skoruba.Duende.IdentityServer.Admin.Api.csproj @@ -17,24 +17,24 @@ - - - - - - + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + - + diff --git a/src/Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Identity/Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Identity.csproj b/src/Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Identity/Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Identity.csproj index af3be9ef4..523781493 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Identity/Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Identity.csproj +++ b/src/Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Identity/Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Identity.csproj @@ -7,7 +7,7 @@ - + diff --git a/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Configuration/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Configuration.csproj b/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Configuration/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Configuration.csproj index 871e95db1..d4b1f98aa 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Configuration/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Configuration.csproj +++ b/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Configuration/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Configuration.csproj @@ -6,9 +6,9 @@ - - - + + + diff --git a/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Identity/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Identity.csproj b/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Identity/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Identity.csproj index 8b000286c..b3d698225 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Identity/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Identity.csproj +++ b/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Identity/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Identity.csproj @@ -7,7 +7,7 @@ - + diff --git a/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL.csproj b/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL.csproj index 1bbcd99c6..50341e40e 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL.csproj +++ b/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared.csproj b/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared.csproj index 08623cfbe..6befff0ff 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared.csproj +++ b/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.SqlServer/Skoruba.Duende.IdentityServer.Admin.EntityFramework.SqlServer.csproj b/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.SqlServer/Skoruba.Duende.IdentityServer.Admin.EntityFramework.SqlServer.csproj index 7854e261d..ec5249557 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.SqlServer/Skoruba.Duende.IdentityServer.Admin.EntityFramework.SqlServer.csproj +++ b/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.SqlServer/Skoruba.Duende.IdentityServer.Admin.EntityFramework.SqlServer.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework/Skoruba.Duende.IdentityServer.Admin.EntityFramework.csproj b/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework/Skoruba.Duende.IdentityServer.Admin.EntityFramework.csproj index 9b7f7f592..5ce15922d 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework/Skoruba.Duende.IdentityServer.Admin.EntityFramework.csproj +++ b/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework/Skoruba.Duende.IdentityServer.Admin.EntityFramework.csproj @@ -7,7 +7,7 @@ - + diff --git a/src/Skoruba.Duende.IdentityServer.Admin.UI/Skoruba.Duende.IdentityServer.Admin.UI.csproj b/src/Skoruba.Duende.IdentityServer.Admin.UI/Skoruba.Duende.IdentityServer.Admin.UI.csproj index 7cc4fb356..c8c533f05 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.UI/Skoruba.Duende.IdentityServer.Admin.UI.csproj +++ b/src/Skoruba.Duende.IdentityServer.Admin.UI/Skoruba.Duende.IdentityServer.Admin.UI.csproj @@ -97,9 +97,9 @@ - - - + + + diff --git a/src/Skoruba.Duende.IdentityServer.Admin/Dockerfile b/src/Skoruba.Duende.IdentityServer.Admin/Dockerfile index b91cbc1eb..e774e398c 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin/Dockerfile +++ b/src/Skoruba.Duende.IdentityServer.Admin/Dockerfile @@ -1,9 +1,9 @@ -FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim AS base +FROM mcr.microsoft.com/dotnet/aspnet:6.0-buster-slim AS base WORKDIR /app EXPOSE 80 EXPOSE 443 -FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build +FROM mcr.microsoft.com/dotnet/sdk:6.0-buster-slim AS build WORKDIR /src COPY ["src/Skoruba.Duende.IdentityServer.Admin/Skoruba.Duende.IdentityServer.Admin.csproj", "src/Skoruba.Duende.IdentityServer.Admin/"] COPY ["src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL.csproj", "src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL/"] diff --git a/src/Skoruba.Duende.IdentityServer.Admin/Skoruba.Duende.IdentityServer.Admin.csproj b/src/Skoruba.Duende.IdentityServer.Admin/Skoruba.Duende.IdentityServer.Admin.csproj index 32e25991c..b7329ece1 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin/Skoruba.Duende.IdentityServer.Admin.csproj +++ b/src/Skoruba.Duende.IdentityServer.Admin/Skoruba.Duende.IdentityServer.Admin.csproj @@ -12,25 +12,25 @@ - - - - - + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - - + + - + diff --git a/src/Skoruba.Duende.IdentityServer.STS.Identity/Dockerfile b/src/Skoruba.Duende.IdentityServer.STS.Identity/Dockerfile index 1d42437fd..b7be73d7c 100644 --- a/src/Skoruba.Duende.IdentityServer.STS.Identity/Dockerfile +++ b/src/Skoruba.Duende.IdentityServer.STS.Identity/Dockerfile @@ -1,9 +1,9 @@ -FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim AS base +FROM mcr.microsoft.com/dotnet/aspnet:6.0-buster-slim AS base WORKDIR /app EXPOSE 80 EXPOSE 443 -FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build +FROM mcr.microsoft.com/dotnet/sdk:6.0-buster-slim AS build WORKDIR /src COPY ["src/Skoruba.Duende.IdentityServer.STS.Identity/Skoruba.Duende.IdentityServer.STS.Identity.csproj", "src/Skoruba.Duende.IdentityServer.STS.Identity/"] COPY ["src/Skoruba.Duende.IdentityServer.Shared.Configuration/Skoruba.Duende.IdentityServer.Shared.Configuration.csproj", "src/Skoruba.Duende.IdentityServer.Shared.Configuration/"] diff --git a/src/Skoruba.Duende.IdentityServer.STS.Identity/Skoruba.Duende.IdentityServer.STS.Identity.csproj b/src/Skoruba.Duende.IdentityServer.STS.Identity/Skoruba.Duende.IdentityServer.STS.Identity.csproj index 61ad63d8b..0e89b9e4f 100644 --- a/src/Skoruba.Duende.IdentityServer.STS.Identity/Skoruba.Duende.IdentityServer.STS.Identity.csproj +++ b/src/Skoruba.Duende.IdentityServer.STS.Identity/Skoruba.Duende.IdentityServer.STS.Identity.csproj @@ -9,26 +9,26 @@ - + - - - - - - + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - + + + + + @@ -36,7 +36,7 @@ - + diff --git a/src/Skoruba.Duende.IdentityServer.Shared.Configuration/Skoruba.Duende.IdentityServer.Shared.Configuration.csproj b/src/Skoruba.Duende.IdentityServer.Shared.Configuration/Skoruba.Duende.IdentityServer.Shared.Configuration.csproj index 827e53f21..00008389f 100644 --- a/src/Skoruba.Duende.IdentityServer.Shared.Configuration/Skoruba.Duende.IdentityServer.Shared.Configuration.csproj +++ b/src/Skoruba.Duende.IdentityServer.Shared.Configuration/Skoruba.Duende.IdentityServer.Shared.Configuration.csproj @@ -9,10 +9,10 @@ - - - - + + + + diff --git a/src/Skoruba.Duende.IdentityServer.Shared/Skoruba.Duende.IdentityServer.Shared.csproj b/src/Skoruba.Duende.IdentityServer.Shared/Skoruba.Duende.IdentityServer.Shared.csproj index 774add364..9db1ebb53 100644 --- a/src/Skoruba.Duende.IdentityServer.Shared/Skoruba.Duende.IdentityServer.Shared.csproj +++ b/src/Skoruba.Duende.IdentityServer.Shared/Skoruba.Duende.IdentityServer.Shared.csproj @@ -9,10 +9,10 @@ - - - - + + + + diff --git a/templates/0-build-template.ps1 b/templates/0-build-template.ps1 index a91986dd9..5cb4ce2f5 100644 --- a/templates/0-build-template.ps1 +++ b/templates/0-build-template.ps1 @@ -57,13 +57,10 @@ CleanBinObjFolders # API dotnet.exe remove ./$templateSrc/Skoruba.Duende.IdentityServer.Admin.Api/Skoruba.Duende.IdentityServer.Admin.Api.csproj reference ..\Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Identity\Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Identity.csproj -dotnet.exe remove ./$templateSrc/Skoruba.Duende.IdentityServer.Admin.Api/Skoruba.Duende.IdentityServer.Admin.Api.csproj reference ..\Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Shared\Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Shared.csproj dotnet.exe remove ./$templateSrc/Skoruba.Duende.IdentityServer.Admin.Api/Skoruba.Duende.IdentityServer.Admin.Api.csproj reference ..\Skoruba.Duende.IdentityServer.Admin.BusinessLogic\Skoruba.Duende.IdentityServer.Admin.BusinessLogic.csproj dotnet.exe remove ./$templateSrc/Skoruba.Duende.IdentityServer.Admin.Api/Skoruba.Duende.IdentityServer.Admin.Api.csproj reference ..\Skoruba.Duende.IdentityServer.Shared.Configuration\Skoruba.Duende.IdentityServer.Shared.Configuration.csproj # Admin -dotnet.exe remove ./$templateSrc/Skoruba.Duende.IdentityServer.Admin/Skoruba.Duende.IdentityServer.Admin.csproj reference ..\Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Identity\Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Identity.csproj -dotnet.exe remove ./$templateSrc/Skoruba.Duende.IdentityServer.Admin/Skoruba.Duende.IdentityServer.Admin.csproj reference ..\Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Shared\Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Shared.csproj dotnet.exe remove ./$templateSrc/Skoruba.Duende.IdentityServer.Admin/Skoruba.Duende.IdentityServer.Admin.csproj reference ..\Skoruba.Duende.IdentityServer.Admin.BusinessLogic\Skoruba.Duende.IdentityServer.Admin.BusinessLogic.csproj dotnet.exe remove ./$templateSrc/Skoruba.Duende.IdentityServer.Admin/Skoruba.Duende.IdentityServer.Admin.csproj reference ..\Skoruba.Duende.IdentityServer.Admin.UI\Skoruba.Duende.IdentityServer.Admin.UI.csproj @@ -72,22 +69,8 @@ dotnet.exe remove ./$templateSrc/Skoruba.Duende.IdentityServer.STS.Identity/Skor dotnet.exe remove ./$templateSrc/Skoruba.Duende.IdentityServer.STS.Identity/Skoruba.Duende.IdentityServer.STS.Identity.csproj reference ..\Skoruba.Duende.IdentityServer.Admin.EntityFramework.Configuration\Skoruba.Duende.IdentityServer.Admin.EntityFramework.Configuration.csproj # EF Shared -dotnet.exe remove ./$templateSrc/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared.csproj reference ..\Skoruba.Duende.IdentityServer.Admin.EntityFramework\Skoruba.Duende.IdentityServer.Admin.EntityFramework.csproj -dotnet.exe remove ./$templateSrc/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared.csproj reference ..\Skoruba.Duende.IdentityServer.Admin.EntityFramework.Identity\Skoruba.Duende.IdentityServer.Admin.EntityFramework.Identity.csproj dotnet.exe remove ./$templateSrc/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared.csproj reference ..\Skoruba.Duende.IdentityServer.Admin.EntityFramework.Configuration\Skoruba.Duende.IdentityServer.Admin.EntityFramework.Configuration.csproj -# EF MySql -dotnet.exe remove ./$templateSrc/Skoruba.Duende.IdentityServer.Admin.EntityFramework.MySql/Skoruba.Duende.IdentityServer.Admin.EntityFramework.MySql.csproj reference ..\Skoruba.Duende.IdentityServer.Admin.EntityFramework\Skoruba.Duende.IdentityServer.Admin.EntityFramework.csproj -dotnet.exe remove ./$templateSrc/Skoruba.Duende.IdentityServer.Admin.EntityFramework.MySql/Skoruba.Duende.IdentityServer.Admin.EntityFramework.MySql.csproj reference ..\Skoruba.Duende.IdentityServer.Admin.EntityFramework.Identity\Skoruba.Duende.IdentityServer.Admin.EntityFramework.Identity.csproj - -# EF PostgreSQL -dotnet.exe remove ./$templateSrc/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL.csproj reference ..\Skoruba.Duende.IdentityServer.Admin.EntityFramework\Skoruba.Duende.IdentityServer.Admin.EntityFramework.csproj -dotnet.exe remove ./$templateSrc/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL.csproj reference ..\Skoruba.Duende.IdentityServer.Admin.EntityFramework.Identity\Skoruba.Duende.IdentityServer.Admin.EntityFramework.Identity.csproj - -# EF SqlServer -dotnet.exe remove ./$templateSrc/Skoruba.Duende.IdentityServer.Admin.EntityFramework.SqlServer/Skoruba.Duende.IdentityServer.Admin.EntityFramework.SqlServer.csproj reference ..\Skoruba.Duende.IdentityServer.Admin.EntityFramework\Skoruba.Duende.IdentityServer.Admin.EntityFramework.csproj -dotnet.exe remove ./$templateSrc/Skoruba.Duende.IdentityServer.Admin.EntityFramework.SqlServer/Skoruba.Duende.IdentityServer.Admin.EntityFramework.SqlServer.csproj reference ..\Skoruba.Duende.IdentityServer.Admin.EntityFramework.Identity\Skoruba.Duende.IdentityServer.Admin.EntityFramework.Identity.csproj - # Shared dotnet.exe remove ./$templateSrc/Skoruba.Duende.IdentityServer.Shared/Skoruba.Duende.IdentityServer.Shared.csproj reference ..\Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Identity\Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Identity.csproj @@ -99,6 +82,7 @@ dotnet.exe add ./$templateSrc/Skoruba.Duende.IdentityServer.Admin/Skoruba.Duende # STS dotnet.exe add ./$templateSrc/Skoruba.Duende.IdentityServer.STS.Identity/Skoruba.Duende.IdentityServer.STS.Identity.csproj package Skoruba.Duende.IdentityServer.Shared.Configuration -v $packagesVersions +dotnet.exe add ./$templateSrc/Skoruba.Duende.IdentityServer.STS.Identity/Skoruba.Duende.IdentityServer.STS.Identity.csproj package Skoruba.Duende.IdentityServer.Admin.EntityFramework.Configuration -v $packagesVersions # API dotnet.exe add ./$templateSrc/Skoruba.Duende.IdentityServer.Admin.Api/Skoruba.Duende.IdentityServer.Admin.Api.csproj package Skoruba.Duende.IdentityServer.Admin.BusinessLogic -v $packagesVersions @@ -106,22 +90,8 @@ dotnet.exe add ./$templateSrc/Skoruba.Duende.IdentityServer.Admin.Api/Skoruba.Du dotnet.exe add ./$templateSrc/Skoruba.Duende.IdentityServer.Admin.Api/Skoruba.Duende.IdentityServer.Admin.Api.csproj package Skoruba.Duende.IdentityServer.Shared.Configuration -v $packagesVersions # EF Shared -dotnet.exe add ./$templateSrc/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared.csproj package Skoruba.Duende.IdentityServer.Admin.EntityFramework -v $packagesVersions -dotnet.exe add ./$templateSrc/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared.csproj package Skoruba.Duende.IdentityServer.Admin.EntityFramework.Identity -v $packagesVersions dotnet.exe add ./$templateSrc/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared.csproj package Skoruba.Duende.IdentityServer.Admin.EntityFramework.Configuration -v $packagesVersions -# EF MySql -dotnet.exe add ./$templateSrc/Skoruba.Duende.IdentityServer.Admin.EntityFramework.MySql/Skoruba.Duende.IdentityServer.Admin.EntityFramework.MySql.csproj package Skoruba.Duende.IdentityServer.Admin.EntityFramework -v $packagesVersions -dotnet.exe add ./$templateSrc/Skoruba.Duende.IdentityServer.Admin.EntityFramework.MySql/Skoruba.Duende.IdentityServer.Admin.EntityFramework.MySql.csproj package Skoruba.Duende.IdentityServer.Admin.EntityFramework.Identity -v $packagesVersions - -# EF PostgreSQL -dotnet.exe add ./$templateSrc/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL.csproj package Skoruba.Duende.IdentityServer.Admin.EntityFramework -v $packagesVersions -dotnet.exe add ./$templateSrc/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL.csproj package Skoruba.Duende.IdentityServer.Admin.EntityFramework.Identity -v $packagesVersions - -# EF SqlServer -dotnet.exe add ./$templateSrc/Skoruba.Duende.IdentityServer.Admin.EntityFramework.SqlServer/Skoruba.Duende.IdentityServer.Admin.EntityFramework.SqlServer.csproj package Skoruba.Duende.IdentityServer.Admin.EntityFramework -v $packagesVersions -dotnet.exe add ./$templateSrc/Skoruba.Duende.IdentityServer.Admin.EntityFramework.SqlServer/Skoruba.Duende.IdentityServer.Admin.EntityFramework.SqlServer.csproj package Skoruba.Duende.IdentityServer.Admin.EntityFramework.Identity -v $packagesVersions - # Shared dotnet.exe add ./$templateSrc/Skoruba.Duende.IdentityServer.Shared/Skoruba.Duende.IdentityServer.Shared.csproj package Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Identity -v $packagesVersions diff --git a/templates/template-docker/SkorubaDuende.IdentityServerAdmin.Admin.Api/Dockerfile b/templates/template-docker/SkorubaDuende.IdentityServerAdmin.Admin.Api/Dockerfile index a3be8d75e..c267f965c 100644 --- a/templates/template-docker/SkorubaDuende.IdentityServerAdmin.Admin.Api/Dockerfile +++ b/templates/template-docker/SkorubaDuende.IdentityServerAdmin.Admin.Api/Dockerfile @@ -1,9 +1,9 @@ -FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base +FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base WORKDIR /app EXPOSE 80 EXPOSE 443 -FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build WORKDIR /src COPY ["src/SkorubaDuende.IdentityServerAdmin.Admin.Api/SkorubaDuende.IdentityServerAdmin.Admin.Api.csproj", "src/SkorubaDuende.IdentityServerAdmin.Admin.Api/"] COPY ["src/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.Shared/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.Shared.csproj", "src/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.Shared/"] diff --git a/templates/template-docker/SkorubaDuende.IdentityServerAdmin.Admin/Dockerfile b/templates/template-docker/SkorubaDuende.IdentityServerAdmin.Admin/Dockerfile index b4e7fec14..fa340ba7b 100644 --- a/templates/template-docker/SkorubaDuende.IdentityServerAdmin.Admin/Dockerfile +++ b/templates/template-docker/SkorubaDuende.IdentityServerAdmin.Admin/Dockerfile @@ -1,9 +1,9 @@ -FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base +FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base WORKDIR /app EXPOSE 80 EXPOSE 443 -FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build WORKDIR /src COPY ["src/SkorubaDuende.IdentityServerAdmin.Admin/SkorubaDuende.IdentityServerAdmin.Admin.csproj", "src/SkorubaDuende.IdentityServerAdmin.Admin/"] COPY ["src/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.Shared/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.Shared.csproj", "src/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.Shared/"] diff --git a/templates/template-docker/SkorubaDuende.IdentityServerAdmin.STS.Identity/Dockerfile b/templates/template-docker/SkorubaDuende.IdentityServerAdmin.STS.Identity/Dockerfile index 680ad9faa..37314c492 100644 --- a/templates/template-docker/SkorubaDuende.IdentityServerAdmin.STS.Identity/Dockerfile +++ b/templates/template-docker/SkorubaDuende.IdentityServerAdmin.STS.Identity/Dockerfile @@ -1,9 +1,9 @@ -FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base +FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base WORKDIR /app EXPOSE 80 EXPOSE 443 -FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build WORKDIR /src COPY ["src/SkorubaDuende.IdentityServerAdmin.STS.Identity/SkorubaDuende.IdentityServerAdmin.STS.Identity.csproj", "src/SkorubaDuende.IdentityServerAdmin.STS.Identity/"] COPY ["src/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.Shared/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.Shared.csproj", "src/SkorubaDuende.IdentityServerAdmin.Admin.EntityFramework.Shared/"] diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.Api.IntegrationTests/Skoruba.Duende.IdentityServer.Admin.Api.IntegrationTests.csproj b/tests/Skoruba.Duende.IdentityServer.Admin.Api.IntegrationTests/Skoruba.Duende.IdentityServer.Admin.Api.IntegrationTests.csproj index 10dec7df3..058016067 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.Api.IntegrationTests/Skoruba.Duende.IdentityServer.Admin.Api.IntegrationTests.csproj +++ b/tests/Skoruba.Duende.IdentityServer.Admin.Api.IntegrationTests/Skoruba.Duende.IdentityServer.Admin.Api.IntegrationTests.csproj @@ -8,7 +8,7 @@ - + diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.IntegrationTests/Skoruba.Duende.IdentityServer.Admin.IntegrationTests.csproj b/tests/Skoruba.Duende.IdentityServer.Admin.IntegrationTests/Skoruba.Duende.IdentityServer.Admin.IntegrationTests.csproj index d85d1045c..6afb97a35 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.IntegrationTests/Skoruba.Duende.IdentityServer.Admin.IntegrationTests.csproj +++ b/tests/Skoruba.Duende.IdentityServer.Admin.IntegrationTests/Skoruba.Duende.IdentityServer.Admin.IntegrationTests.csproj @@ -13,8 +13,8 @@ runtime; build; native; contentfiles; analyzers - - + + diff --git a/tests/Skoruba.Duende.IdentityServer.STS.Identity.IntegrationTests/Skoruba.Duende.IdentityServer.STS.Identity.IntegrationTests.csproj b/tests/Skoruba.Duende.IdentityServer.STS.Identity.IntegrationTests/Skoruba.Duende.IdentityServer.STS.Identity.IntegrationTests.csproj index 9892ccbe9..bd96a469a 100644 --- a/tests/Skoruba.Duende.IdentityServer.STS.Identity.IntegrationTests/Skoruba.Duende.IdentityServer.STS.Identity.IntegrationTests.csproj +++ b/tests/Skoruba.Duende.IdentityServer.STS.Identity.IntegrationTests/Skoruba.Duende.IdentityServer.STS.Identity.IntegrationTests.csproj @@ -9,10 +9,10 @@ - + - - + + From eff5b90bf5d51ca38f37fad85ce3831a6189731f Mon Sep 17 00:00:00 2001 From: janskoruba Date: Mon, 20 Dec 2021 13:45:31 +0100 Subject: [PATCH 05/23] Keep user secrets optional --- src/Skoruba.Duende.IdentityServer.Admin.Api/Program.cs | 4 ++-- src/Skoruba.Duende.IdentityServer.Admin/Program.cs | 4 ++-- src/Skoruba.Duende.IdentityServer.STS.Identity/Program.cs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Skoruba.Duende.IdentityServer.Admin.Api/Program.cs b/src/Skoruba.Duende.IdentityServer.Admin.Api/Program.cs index b6dbba8ea..e777d6c52 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.Api/Program.cs +++ b/src/Skoruba.Duende.IdentityServer.Admin.Api/Program.cs @@ -50,7 +50,7 @@ private static IConfiguration GetConfiguration(string[] args) if (isDevelopment) { - configurationBuilder.AddUserSecrets(); + configurationBuilder.AddUserSecrets(false); } var configuration = configurationBuilder.Build(); @@ -77,7 +77,7 @@ public static IHostBuilder CreateHostBuilder(string[] args) => if (env.IsDevelopment()) { - configApp.AddUserSecrets(); + configApp.AddUserSecrets(false); } configurationRoot.AddAzureKeyVaultConfiguration(configApp); diff --git a/src/Skoruba.Duende.IdentityServer.Admin/Program.cs b/src/Skoruba.Duende.IdentityServer.Admin/Program.cs index 7863e1734..01c052f4a 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin/Program.cs +++ b/src/Skoruba.Duende.IdentityServer.Admin/Program.cs @@ -79,7 +79,7 @@ private static IConfiguration GetConfiguration(string[] args) if (isDevelopment) { - configurationBuilder.AddUserSecrets(); + configurationBuilder.AddUserSecrets(false); } var configuration = configurationBuilder.Build(); @@ -110,7 +110,7 @@ public static IHostBuilder CreateHostBuilder(string[] args) => if (env.IsDevelopment()) { - configApp.AddUserSecrets(); + configApp.AddUserSecrets(false); } configurationRoot.AddAzureKeyVaultConfiguration(configApp); diff --git a/src/Skoruba.Duende.IdentityServer.STS.Identity/Program.cs b/src/Skoruba.Duende.IdentityServer.STS.Identity/Program.cs index 1298df7dd..3db51a6fb 100644 --- a/src/Skoruba.Duende.IdentityServer.STS.Identity/Program.cs +++ b/src/Skoruba.Duende.IdentityServer.STS.Identity/Program.cs @@ -47,7 +47,7 @@ private static IConfiguration GetConfiguration(string[] args) if (isDevelopment) { - configurationBuilder.AddUserSecrets(); + configurationBuilder.AddUserSecrets(false); } var configuration = configurationBuilder.Build(); @@ -74,7 +74,7 @@ public static IHostBuilder CreateHostBuilder(string[] args) => if (env.IsDevelopment()) { - configApp.AddUserSecrets(); + configApp.AddUserSecrets(false); } configurationRoot.AddAzureKeyVaultConfiguration(configApp); From df5023087100c62cc6dc0479d37f984e7058d12c Mon Sep 17 00:00:00 2001 From: janskoruba Date: Mon, 20 Dec 2021 14:04:12 +0100 Subject: [PATCH 06/23] Add option to migrate db and seed only; Use redirectUri only if is presented; Fix column in PersistedGrant view; --- .../Helpers/DbMigrationHelpers.cs | 28 +++- .../AdminUI/Views/Grant/PersistedGrant.cshtml | 130 +++++++++--------- .../Helpers/StartupHelpers.cs | 11 +- .../Program.cs | 27 +++- 4 files changed, 118 insertions(+), 78 deletions(-) diff --git a/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared/Helpers/DbMigrationHelpers.cs b/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared/Helpers/DbMigrationHelpers.cs index 36e06b5b3..7c9667217 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared/Helpers/DbMigrationHelpers.cs +++ b/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.Shared/Helpers/DbMigrationHelpers.cs @@ -29,7 +29,7 @@ public static class DbMigrationHelpers /// /// /// - public static async Task ApplyDbMigrationsWithDataSeedAsync ApplyDbMigrationsWithDataSeedAsync( IHost host, bool applyDbMigrationWithDataSeedFromProgramArguments, SeedConfiguration seedConfiguration, DatabaseMigrationsConfiguration databaseMigrationsConfiguration) @@ -42,6 +42,8 @@ public static class DbMigrationHelpers where TUser : IdentityUser, new() where TRole : IdentityRole, new() { + var migrationComplete = false; + using (var serviceScope = host.Services.CreateScope()) { var services = serviceScope.ServiceProvider; @@ -49,18 +51,22 @@ public static class DbMigrationHelpers if ((databaseMigrationsConfiguration != null && databaseMigrationsConfiguration.ApplyDatabaseMigrations) || (applyDbMigrationWithDataSeedFromProgramArguments)) { - await EnsureDatabasesMigratedAsync(services); + migrationComplete = await EnsureDatabasesMigratedAsync(services); } if ((seedConfiguration != null && seedConfiguration.ApplySeed) || (applyDbMigrationWithDataSeedFromProgramArguments)) { - await EnsureSeedDataAsync(services); + var seedComplete = await EnsureSeedDataAsync(services); + + return migrationComplete && seedComplete; } } + + return migrationComplete; } - public static async Task EnsureDatabasesMigratedAsync(IServiceProvider services) + public static async Task EnsureDatabasesMigratedAsync(IServiceProvider services) where TIdentityDbContext : DbContext where TPersistedGrantDbContext : DbContext where TConfigurationDbContext : DbContext @@ -68,41 +74,51 @@ public static async Task EnsureDatabasesMigratedAsync().CreateScope()) { using (var context = scope.ServiceProvider.GetRequiredService()) { await context.Database.MigrateAsync(); + pendingMigrationCount += (await context.Database.GetPendingMigrationsAsync()).Count(); } using (var context = scope.ServiceProvider.GetRequiredService()) { await context.Database.MigrateAsync(); + pendingMigrationCount += (await context.Database.GetPendingMigrationsAsync()).Count(); } using (var context = scope.ServiceProvider.GetRequiredService()) { await context.Database.MigrateAsync(); + pendingMigrationCount += (await context.Database.GetPendingMigrationsAsync()).Count(); } using (var context = scope.ServiceProvider.GetRequiredService()) { await context.Database.MigrateAsync(); + pendingMigrationCount += (await context.Database.GetPendingMigrationsAsync()).Count(); } using (var context = scope.ServiceProvider.GetRequiredService()) { await context.Database.MigrateAsync(); + pendingMigrationCount += (await context.Database.GetPendingMigrationsAsync()).Count(); } using (var context = scope.ServiceProvider.GetRequiredService()) { await context.Database.MigrateAsync(); + pendingMigrationCount += (await context.Database.GetPendingMigrationsAsync()).Count(); } } + + return pendingMigrationCount == 0; } - public static async Task EnsureSeedDataAsync(IServiceProvider serviceProvider) + public static async Task EnsureSeedDataAsync(IServiceProvider serviceProvider) where TIdentityServerDbContext : DbContext, IAdminConfigurationDbContext where TUser : IdentityUser, new() where TRole : IdentityRole, new() @@ -118,6 +134,8 @@ public static async Task EnsureSeedDataAsync diff --git a/src/Skoruba.Duende.IdentityServer.Admin.UI/Areas/AdminUI/Views/Grant/PersistedGrant.cshtml b/src/Skoruba.Duende.IdentityServer.Admin.UI/Areas/AdminUI/Views/Grant/PersistedGrant.cshtml index 220a52364..68b928056 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.UI/Areas/AdminUI/Views/Grant/PersistedGrant.cshtml +++ b/src/Skoruba.Duende.IdentityServer.Admin.UI/Areas/AdminUI/Views/Grant/PersistedGrant.cshtml @@ -6,36 +6,36 @@ @inject IViewLocalizer Localizer @{ - ViewBag.Title = Localizer["PageTitle"]; - Layout = "_Layout"; + ViewBag.Title = Localizer["PageTitle"]; + Layout = "_Layout"; }
-
- -
+
+ +
-
-

@Localizer["PageTitle"]

-
+
+

@Localizer["PageTitle"]

+
- @Localizer["ButtonDeleteAll"] + @Localizer["ButtonDeleteAll"] - - + + -
-
- - +
+
+
+ @@ -43,57 +43,57 @@ - + - + - - @foreach (var persistedGrant in Model.PersistedGrants) - { - - - - - - - - - - - - - } - -
@Localizer["TableSubjectId"]@Localizer["TableExpiration"] @Localizer["TableData"] @Localizer["TableClient"]@Localizer["TableDescription"] @Localizer["TableSessionId"] @Localizer["TableCreationTime"] @Localizer["TableConsumedTime"]
@persistedGrant.SubjectId@persistedGrant.Type@persistedGrant.Expiration@persistedGrant.Data@persistedGrant.ClientId@persistedGrant.Description@persistedGrant.SessionId@persistedGrant.ConsumedTime@persistedGrant.CreationTime
-
-
+ + @foreach (var persistedGrant in Model.PersistedGrants) + { + + + @persistedGrant.SubjectId + @persistedGrant.Type + @persistedGrant.Expiration + @persistedGrant.Data + @persistedGrant.ClientId + @persistedGrant.Description + @persistedGrant.SessionId + @persistedGrant.CreationTime + @persistedGrant.ConsumedTime + + } + + + + -
-
- @await Html.PartialAsync("Common/Pager", new Pager { Action = "PersistedGrant", PageSize = Model.PageSize, TotalCount = Model.TotalCount }) -
-
+
+
+ @await Html.PartialAsync("Common/Pager", new Pager { Action = "PersistedGrant", PageSize = Model.PageSize, TotalCount = Model.TotalCount }) +
+
- - + +
\ No newline at end of file diff --git a/src/Skoruba.Duende.IdentityServer.Admin.UI/Helpers/StartupHelpers.cs b/src/Skoruba.Duende.IdentityServer.Admin.UI/Helpers/StartupHelpers.cs index 29d7cd6fa..8d2fd4913 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.UI/Helpers/StartupHelpers.cs +++ b/src/Skoruba.Duende.IdentityServer.Admin.UI/Helpers/StartupHelpers.cs @@ -417,14 +417,17 @@ private static Task OnMessageReceived(MessageReceivedContext context, AdminConfi context.Properties.IsPersistent = true; context.Properties.ExpiresUtc = new DateTimeOffset(DateTime.Now.AddHours(adminConfiguration.IdentityAdminCookieExpiresUtcHours)); - return Task.FromResult(0); + return Task.CompletedTask; } - private static Task OnRedirectToIdentityProvider(RedirectContext n, AdminConfiguration adminConfiguration) + private static Task OnRedirectToIdentityProvider(RedirectContext context, AdminConfiguration adminConfiguration) { - n.ProtocolMessage.RedirectUri = adminConfiguration.IdentityAdminRedirectUri; + if (!string.IsNullOrEmpty(adminConfiguration.IdentityAdminRedirectUri)) + { + context.ProtocolMessage.RedirectUri = adminConfiguration.IdentityAdminRedirectUri; + } - return Task.FromResult(0); + return Task.CompletedTask; } public static void AddIdSHealthChecks MigrateOnlyOperationAsync(string[] args, IHost host, bool migrationComplete) + { + if (args.Any(x => x == MigrateOnlyArgs)) + { + await host.StopAsync(); + + if (!migrationComplete) + { + Environment.ExitCode = -1; + } + + return true; + } + + return false; + } + + private static async Task ApplyDbMigrationsWithDataSeedAsync(string[] args, IConfiguration configuration, IHost host) { var applyDbMigrationWithDataSeedFromProgramArguments = args.Any(x => x == SeedArgs); if (applyDbMigrationWithDataSeedFromProgramArguments) args = args.Except(new[] { SeedArgs }).ToArray(); @@ -58,7 +77,7 @@ private static async Task ApplyDbMigrationsWithDataSeedAsync(string[] args, ICon var databaseMigrationsConfiguration = configuration.GetSection(nameof(DatabaseMigrationsConfiguration)) .Get(); - await DbMigrationHelpers + return await DbMigrationHelpers .ApplyDbMigrationsWithDataSeedAsync(host, From df5f52f151dc454cad518ccc8022b7b6bd048079 Mon Sep 17 00:00:00 2001 From: janskoruba Date: Mon, 20 Dec 2021 14:17:21 +0100 Subject: [PATCH 07/23] Update README --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 057a83b89..3046525e9 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ [![Build status](https://ci.appveyor.com/api/projects/status/563ug5gcxk904m6g/branch/main?svg=true)](https://ci.appveyor.com/project/JanSkoruba/duende-identityserver-admin/branch/main) [![Join the chat at https://gitter.im/skoruba/IdentityServer4.Admin](https://badges.gitter.im/skoruba/IdentityServer4.Admin.svg)](https://gitter.im/skoruba/IdentityServer4.Admin?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -The application is written in the **Asp.Net Core MVC - using .NET 5.0** +The application is written in the **Asp.Net Core MVC - using .NET 6.0** ## Requirements @@ -22,7 +22,7 @@ The application is written in the **Asp.Net Core MVC - using .NET 5.0** - 🔒 **NOTE:** The project uses the default database migrations which affect your database therefore double check the migrations according to your database provider and create a database backup ```sh -dotnet new -i Skoruba.Duende.IdentityServer.Admin.Templates::1.0.1 +dotnet new -i Skoruba.Duende.IdentityServer.Admin.Templates::1.1.0 ``` ### Create new project: @@ -731,7 +731,7 @@ It is possible to define the configuration according the client type - by defaul - [x] Extract UI part into nuget package ([#770](https://github.com/skoruba/IdentityServer4.Admin/issues/770), [#409](https://github.com/skoruba/IdentityServer4.Admin/issues/409), [#55](https://github.com/skoruba/IdentityServer4.Admin/issues/55), [#322](https://github.com/skoruba/IdentityServer4.Admin/issues/322), [#28](https://github.com/skoruba/IdentityServer4.Admin/issues/28), [#133](https://github.com/skoruba/IdentityServer4.Admin/issues/133)) ### 1.1.0 -- [ ] Update to .NET 6 +- [x] Update to .NET 6 ### 2.0.0 - [ ] Connect Admin Api to the Admin UI ([#478](https://github.com/skoruba/IdentityServer4.Admin/issues/478)) From 1e8b807fb819a3c985419547099eb84a3a98ce54 Mon Sep 17 00:00:00 2001 From: janskoruba Date: Mon, 20 Dec 2021 14:49:41 +0100 Subject: [PATCH 08/23] Change version to 1.1.0 --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 1e4f97306..9516708f3 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ - 1.0.1 + 1.1.0 Jan Škoruba Duende IdentityServer Admin OpenIDConnect OAuth2 Identity https://github.com/skoruba/Duende.IdentityServer.Admin/blob/main/LICENSE From be10456bda531b7bc5b81410098152ba5367e847 Mon Sep 17 00:00:00 2001 From: janskoruba Date: Tue, 21 Dec 2021 17:16:54 +0100 Subject: [PATCH 09/23] Fix Dockerfile to correct image; Udate README; --- README.md | 2 +- src/Skoruba.Duende.IdentityServer.Admin.Api/Dockerfile | 4 ++-- .../Dtos/Key/KeyApiDto.cs | 2 -- src/Skoruba.Duende.IdentityServer.Admin.Api/Program.cs | 4 ++-- .../Dtos/Key/KeyDto.cs | 2 -- src/Skoruba.Duende.IdentityServer.Admin/Dockerfile | 4 ++-- src/Skoruba.Duende.IdentityServer.Admin/Program.cs | 4 ++-- src/Skoruba.Duende.IdentityServer.STS.Identity/Dockerfile | 4 ++-- src/Skoruba.Duende.IdentityServer.STS.Identity/Program.cs | 4 ++-- .../Mocks/KeyApiDtoMock.cs | 4 +--- .../Mocks/KeyDtoMock.cs | 4 +--- 11 files changed, 15 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 3046525e9..96a782741 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The application is written in the **Asp.Net Core MVC - using .NET 6.0** ## Requirements -- [Install](https://www.microsoft.com/net/download/windows#/current) the latest .NET 5 SDK (using older versions may lead to 502.5 errors when hosted on IIS or application exiting immediately after starting when self-hosted) +- [Install](https://www.microsoft.com/net/download/windows#/current) the latest .NET 6 SDK (using older versions may lead to 502.5 errors when hosted on IIS or application exiting immediately after starting when self-hosted) ## Installation via dotnet new template diff --git a/src/Skoruba.Duende.IdentityServer.Admin.Api/Dockerfile b/src/Skoruba.Duende.IdentityServer.Admin.Api/Dockerfile index 2b249e1c4..f64a81703 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.Api/Dockerfile +++ b/src/Skoruba.Duende.IdentityServer.Admin.Api/Dockerfile @@ -1,9 +1,9 @@ -FROM mcr.microsoft.com/dotnet/aspnet:6.0-buster-slim AS base +FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base WORKDIR /app EXPOSE 80 EXPOSE 443 -FROM mcr.microsoft.com/dotnet/sdk:6.0-buster-slim AS build +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build WORKDIR /src COPY ["src/Skoruba.Duende.IdentityServer.Admin.Api/Skoruba.Duende.IdentityServer.Admin.Api.csproj", "src/Skoruba.Duende.IdentityServer.Admin.Api/"] COPY ["src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL.csproj", "src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL/"] diff --git a/src/Skoruba.Duende.IdentityServer.Admin.Api/Dtos/Key/KeyApiDto.cs b/src/Skoruba.Duende.IdentityServer.Admin.Api/Dtos/Key/KeyApiDto.cs index d4f11342e..bbc7419e8 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.Api/Dtos/Key/KeyApiDto.cs +++ b/src/Skoruba.Duende.IdentityServer.Admin.Api/Dtos/Key/KeyApiDto.cs @@ -13,7 +13,5 @@ public class KeyApiDto public string Use { get; set; } public string Algorithm { get; set; } public bool IsX509Certificate { get; set; } - public bool DataProtected { get; set; } - public string Data { get; set; } } } \ No newline at end of file diff --git a/src/Skoruba.Duende.IdentityServer.Admin.Api/Program.cs b/src/Skoruba.Duende.IdentityServer.Admin.Api/Program.cs index e777d6c52..f62df4099 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.Api/Program.cs +++ b/src/Skoruba.Duende.IdentityServer.Admin.Api/Program.cs @@ -50,7 +50,7 @@ private static IConfiguration GetConfiguration(string[] args) if (isDevelopment) { - configurationBuilder.AddUserSecrets(false); + configurationBuilder.AddUserSecrets(true); } var configuration = configurationBuilder.Build(); @@ -77,7 +77,7 @@ public static IHostBuilder CreateHostBuilder(string[] args) => if (env.IsDevelopment()) { - configApp.AddUserSecrets(false); + configApp.AddUserSecrets(true); } configurationRoot.AddAzureKeyVaultConfiguration(configApp); diff --git a/src/Skoruba.Duende.IdentityServer.Admin.BusinessLogic/Dtos/Key/KeyDto.cs b/src/Skoruba.Duende.IdentityServer.Admin.BusinessLogic/Dtos/Key/KeyDto.cs index 275dd2d94..43ba1ed80 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.BusinessLogic/Dtos/Key/KeyDto.cs +++ b/src/Skoruba.Duende.IdentityServer.Admin.BusinessLogic/Dtos/Key/KeyDto.cs @@ -13,7 +13,5 @@ public class KeyDto public string Use { get; set; } public string Algorithm { get; set; } public bool IsX509Certificate { get; set; } - public bool DataProtected { get; set; } - public string Data { get; set; } } } \ No newline at end of file diff --git a/src/Skoruba.Duende.IdentityServer.Admin/Dockerfile b/src/Skoruba.Duende.IdentityServer.Admin/Dockerfile index e774e398c..2fd505ca8 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin/Dockerfile +++ b/src/Skoruba.Duende.IdentityServer.Admin/Dockerfile @@ -1,9 +1,9 @@ -FROM mcr.microsoft.com/dotnet/aspnet:6.0-buster-slim AS base +FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base WORKDIR /app EXPOSE 80 EXPOSE 443 -FROM mcr.microsoft.com/dotnet/sdk:6.0-buster-slim AS build +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build WORKDIR /src COPY ["src/Skoruba.Duende.IdentityServer.Admin/Skoruba.Duende.IdentityServer.Admin.csproj", "src/Skoruba.Duende.IdentityServer.Admin/"] COPY ["src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL.csproj", "src/Skoruba.Duende.IdentityServer.Admin.EntityFramework.PostgreSQL/"] diff --git a/src/Skoruba.Duende.IdentityServer.Admin/Program.cs b/src/Skoruba.Duende.IdentityServer.Admin/Program.cs index 46f30b40a..1316321be 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin/Program.cs +++ b/src/Skoruba.Duende.IdentityServer.Admin/Program.cs @@ -98,7 +98,7 @@ private static IConfiguration GetConfiguration(string[] args) if (isDevelopment) { - configurationBuilder.AddUserSecrets(false); + configurationBuilder.AddUserSecrets(true); } var configuration = configurationBuilder.Build(); @@ -129,7 +129,7 @@ public static IHostBuilder CreateHostBuilder(string[] args) => if (env.IsDevelopment()) { - configApp.AddUserSecrets(false); + configApp.AddUserSecrets(true); } configurationRoot.AddAzureKeyVaultConfiguration(configApp); diff --git a/src/Skoruba.Duende.IdentityServer.STS.Identity/Dockerfile b/src/Skoruba.Duende.IdentityServer.STS.Identity/Dockerfile index b7be73d7c..b15579380 100644 --- a/src/Skoruba.Duende.IdentityServer.STS.Identity/Dockerfile +++ b/src/Skoruba.Duende.IdentityServer.STS.Identity/Dockerfile @@ -1,9 +1,9 @@ -FROM mcr.microsoft.com/dotnet/aspnet:6.0-buster-slim AS base +FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base WORKDIR /app EXPOSE 80 EXPOSE 443 -FROM mcr.microsoft.com/dotnet/sdk:6.0-buster-slim AS build +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build WORKDIR /src COPY ["src/Skoruba.Duende.IdentityServer.STS.Identity/Skoruba.Duende.IdentityServer.STS.Identity.csproj", "src/Skoruba.Duende.IdentityServer.STS.Identity/"] COPY ["src/Skoruba.Duende.IdentityServer.Shared.Configuration/Skoruba.Duende.IdentityServer.Shared.Configuration.csproj", "src/Skoruba.Duende.IdentityServer.Shared.Configuration/"] diff --git a/src/Skoruba.Duende.IdentityServer.STS.Identity/Program.cs b/src/Skoruba.Duende.IdentityServer.STS.Identity/Program.cs index 3db51a6fb..db976bcc9 100644 --- a/src/Skoruba.Duende.IdentityServer.STS.Identity/Program.cs +++ b/src/Skoruba.Duende.IdentityServer.STS.Identity/Program.cs @@ -47,7 +47,7 @@ private static IConfiguration GetConfiguration(string[] args) if (isDevelopment) { - configurationBuilder.AddUserSecrets(false); + configurationBuilder.AddUserSecrets(true); } var configuration = configurationBuilder.Build(); @@ -74,7 +74,7 @@ public static IHostBuilder CreateHostBuilder(string[] args) => if (env.IsDevelopment()) { - configApp.AddUserSecrets(false); + configApp.AddUserSecrets(true); } configurationRoot.AddAzureKeyVaultConfiguration(configApp); diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Mocks/KeyApiDtoMock.cs b/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Mocks/KeyApiDtoMock.cs index f3e9d7021..6ddd2a034 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Mocks/KeyApiDtoMock.cs +++ b/tests/Skoruba.Duende.IdentityServer.Admin.Api.UnitTests/Mocks/KeyApiDtoMock.cs @@ -13,11 +13,9 @@ public static Faker KeyFaker(string id) .RuleFor(o => o.Id, id) .RuleFor(o => o.Algorithm, Guid.NewGuid().ToString()) .RuleFor(o => o.Created, f => f.Date.Future()) - .RuleFor(o => o.DataProtected, f => f.Random.Bool()) .RuleFor(o => o.Version, f => f.Random.Int(0)) .RuleFor(o => o.IsX509Certificate, f => f.Random.Bool()) - .RuleFor(o => o.Use, Guid.NewGuid().ToString()) - .RuleFor(o => o.Data, Guid.NewGuid().ToString()); + .RuleFor(o => o.Use, Guid.NewGuid().ToString()); return keyFaker; } diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mocks/KeyDtoMock.cs b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mocks/KeyDtoMock.cs index c0feb02dc..487cae2de 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mocks/KeyDtoMock.cs +++ b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mocks/KeyDtoMock.cs @@ -13,11 +13,9 @@ public static Faker KeyFaker(string id) .RuleFor(o => o.Id, id) .RuleFor(o => o.Algorithm, Guid.NewGuid().ToString()) .RuleFor(o => o.Created, f => f.Date.Future()) - .RuleFor(o => o.DataProtected, f => f.Random.Bool()) .RuleFor(o => o.Version, f => f.Random.Int(0)) .RuleFor(o => o.IsX509Certificate, f => f.Random.Bool()) - .RuleFor(o => o.Use, Guid.NewGuid().ToString()) - .RuleFor(o => o.Data, Guid.NewGuid().ToString()); + .RuleFor(o => o.Use, Guid.NewGuid().ToString()); return keyFaker; } From 7952e543144f14a519b6ea0395fd8446cf0e7c1c Mon Sep 17 00:00:00 2001 From: janskoruba Date: Tue, 21 Dec 2021 17:46:55 +0100 Subject: [PATCH 10/23] Fix tests --- .../Mappers/KeyMappers.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mappers/KeyMappers.cs b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mappers/KeyMappers.cs index a7581f7ae..2ef35433c 100644 --- a/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mappers/KeyMappers.cs +++ b/tests/Skoruba.Duende.IdentityServer.Admin.UnitTests/Mappers/KeyMappers.cs @@ -15,7 +15,9 @@ public void CanMapKeyToKeyDto() var keyDto = key.ToModel(); - keyDto.Should().BeEquivalentTo(key); + keyDto.Should().BeEquivalentTo(key, options => + options.Excluding(x=> x.DataProtected) + .Excluding(x=> x.Data)); } } } \ No newline at end of file From 9afae1c3d33af0de5caf7fb8e5a1582a550e6d52 Mon Sep 17 00:00:00 2001 From: janskoruba Date: Tue, 21 Dec 2021 20:52:20 +0100 Subject: [PATCH 11/23] Fix CSP in STS --- .../Helpers/StartupHelpers.cs | 35 ++++++++++++++++--- .../Startup.cs | 6 ++-- 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/src/Skoruba.Duende.IdentityServer.STS.Identity/Helpers/StartupHelpers.cs b/src/Skoruba.Duende.IdentityServer.STS.Identity/Helpers/StartupHelpers.cs index 0337c5b3d..2d0649051 100644 --- a/src/Skoruba.Duende.IdentityServer.STS.Identity/Helpers/StartupHelpers.cs +++ b/src/Skoruba.Duende.IdentityServer.STS.Identity/Helpers/StartupHelpers.cs @@ -118,10 +118,13 @@ public static void UseSecurityHeaders(this IApplicationBuilder app, IConfigurati { app.UseCsp(csp => { + var imagesSources = new List { "data:" }; + imagesSources.AddRange(cspTrustedDomains); + csp.ImageSources(options => { options.SelfSrc = true; - options.CustomSources = cspTrustedDomains; + options.CustomSources = imagesSources; options.Enabled = true; }); csp.FontSources(options => @@ -144,11 +147,35 @@ public static void UseSecurityHeaders(this IApplicationBuilder app, IConfigurati options.Enabled = true; options.UnsafeInlineSrc = true; }); + csp.Sandbox(options => + { + options.AllowForms() + .AllowSameOrigin() + .AllowScripts(); + }); + csp.FrameAncestors(option => + { + option.NoneSrc = true; + option.Enabled = true; + }); + + csp.BaseUris(options => + { + options.SelfSrc = true; + options.Enabled = true; + }); + + csp.ObjectSources(options => + { + options.NoneSrc = true; + options.Enabled = true; + }); + csp.DefaultSources(options => { + options.Enabled = true; options.SelfSrc = true; options.CustomSources = cspTrustedDomains; - options.Enabled = true; }); }); } @@ -333,7 +360,7 @@ public static IIdentityServerBuilder AddIdentityServer(); - + var builder = services.AddIdentityServer(options => configurationSection.Bind(options)) .AddConfigurationStore() .AddOperationalStore() @@ -344,7 +371,7 @@ public static IIdentityServerBuilder AddIdentityServer(); return builder; diff --git a/src/Skoruba.Duende.IdentityServer.STS.Identity/Startup.cs b/src/Skoruba.Duende.IdentityServer.STS.Identity/Startup.cs index a677aeb7c..e9d0235af 100644 --- a/src/Skoruba.Duende.IdentityServer.STS.Identity/Startup.cs +++ b/src/Skoruba.Duende.IdentityServer.STS.Identity/Startup.cs @@ -72,11 +72,13 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) app.UsePathBase(Configuration.GetValue("BasePath")); - // Add custom security headers - app.UseSecurityHeaders(Configuration); app.UseStaticFiles(); UseAuthentication(app); + + // Add custom security headers + app.UseSecurityHeaders(Configuration); + app.UseMvcLocalizationServices(); app.UseRouting(); From dba2cf29810cb29251e1634157493c8122ccc583 Mon Sep 17 00:00:00 2001 From: janskoruba Date: Tue, 21 Dec 2021 22:22:14 +0100 Subject: [PATCH 12/23] Fix deleting of role in user; Add userName to view where is user deleted from role; Fix runtimeViewCompilation --- .../Areas/AdminUI/Controllers/IdentityController.cs | 6 +++--- .../Areas/AdminUI/Views/Identity/Roles.cshtml | 2 +- .../Areas/AdminUI/Views/Identity/UserRolesDelete.cshtml | 9 +++++++++ .../Helpers/StartupHelpers.cs | 3 ++- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/Skoruba.Duende.IdentityServer.Admin.UI/Areas/AdminUI/Controllers/IdentityController.cs b/src/Skoruba.Duende.IdentityServer.Admin.UI/Areas/AdminUI/Controllers/IdentityController.cs index ffcb914f9..87f971752 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.UI/Areas/AdminUI/Controllers/IdentityController.cs +++ b/src/Skoruba.Duende.IdentityServer.Admin.UI/Areas/AdminUI/Controllers/IdentityController.cs @@ -124,12 +124,12 @@ public async Task Users(int? page, string search) } [HttpGet] - public async Task RoleUsers(string id, int? page, string search) + public async Task RoleUsers(string roleId, int? page, string search) { ViewBag.Search = search; - var roleUsers = await _identityService.GetRoleUsersAsync(id, search, page ?? 1); + var roleUsers = await _identityService.GetRoleUsersAsync(roleId, search, page ?? 1); - var roleDto = await _identityService.GetRoleAsync(id); + var roleDto = await _identityService.GetRoleAsync(roleId); ViewData["RoleName"] = roleDto.Name; return View(roleUsers); diff --git a/src/Skoruba.Duende.IdentityServer.Admin.UI/Areas/AdminUI/Views/Identity/Roles.cshtml b/src/Skoruba.Duende.IdentityServer.Admin.UI/Areas/AdminUI/Views/Identity/Roles.cshtml index f5f8061a3..2b2236e5d 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.UI/Areas/AdminUI/Views/Identity/Roles.cshtml +++ b/src/Skoruba.Duende.IdentityServer.Admin.UI/Areas/AdminUI/Views/Identity/Roles.cshtml @@ -44,7 +44,7 @@ @Localizer["TableButtonEdit"] - @Localizer["TableButtonUsers"] + @Localizer["TableButtonUsers"] @role.Name diff --git a/src/Skoruba.Duende.IdentityServer.Admin.UI/Areas/AdminUI/Views/Identity/UserRolesDelete.cshtml b/src/Skoruba.Duende.IdentityServer.Admin.UI/Areas/AdminUI/Views/Identity/UserRolesDelete.cshtml index 9b0f660bb..48877ef6c 100644 --- a/src/Skoruba.Duende.IdentityServer.Admin.UI/Areas/AdminUI/Views/Identity/UserRolesDelete.cshtml +++ b/src/Skoruba.Duende.IdentityServer.Admin.UI/Areas/AdminUI/Views/Identity/UserRolesDelete.cshtml @@ -37,6 +37,15 @@
@Localizer["SubTitle"]
+
+ +
+ +
+
+
+ +
+ +
+ +
+
+ + +
+ +
+ +
+
+