From ae1228cae847acf78c4710a38f72aaa35277c4f9 Mon Sep 17 00:00:00 2001 From: Hao Kung <HaoK@users.noreply.github.com> Date: Mon, 19 Jul 2021 12:49:19 -0700 Subject: [PATCH] IdentityServer4 -> Duende the Sequel (#34321) --- eng/Dependencies.props | 10 +- eng/Versions.props | 10 +- .../Data/ApplicationDbContext.cs | 2 +- .../20200324213904_Initial.Designer.cs | 40 +++++- .../Data/Migrations/20200324213904_Initial.cs | 31 +++++ .../ApplicationDbContextModelSnapshot.cs | 43 +++++- .../Wasm.Authentication.Server.csproj | 2 + .../ApiAuthSample/ApiAuthSample.csproj | 4 +- .../Data/ApplicationDbContext.cs | 2 +- ...0180919224505_InitialMigration.Designer.cs | 93 ++++++++++++- .../20180919224505_InitialMigration.cs | 72 ++++++++++ .../ApplicationDbContextModelSnapshot.cs | 127 ++++++++++++++++-- .../src/ApiAuthorizationDbContext.cs | 0 .../AuthenticationBuilderExtensions.cs | 2 +- ...tityServerJwtBearerOptionsConfiguration.cs | 4 +- .../ApplicationProfilesPropertyNames.cs | 2 +- .../ApplicationProfilesPropertyValues.cs | 2 +- .../AspNetConventionsConfigureOptions.cs | 2 +- .../Configuration/ConfigureApiResources.cs | 2 +- .../src/Configuration/ConfigureApiScopes.cs | 2 +- .../Configuration/ConfigureClientScopes.cs | 2 +- .../src/Configuration/ConfigureClients.cs | 2 +- .../ConfigureIdentityResources.cs | 10 +- .../src/Data/ApiAuthorizationDbContext.cs | 13 +- .../AutoRedirectEndSessionEndpoint.cs | 12 +- .../DefaultClientRequestParametersProvider.cs | 2 +- .../RelativeRedirectUriValidator.cs | 4 +- ...ityServerBuilderConfigurationExtensions.cs | 12 +- ...ore.ApiAuthorization.IdentityServer.csproj | 20 ++- .../src/Options/ApiResourceBuilder.cs | 4 +- .../src/Options/ApiResourceCollection.cs | 2 +- .../src/Options/ApiScopeCollection.cs | 2 +- .../src/Options/ClientBuilder.cs | 4 +- .../src/Options/ClientCollection.cs | 2 +- .../src/Options/IdentityResourceBuilder.cs | 10 +- .../src/Options/IdentityResourceCollection.cs | 2 +- .../src/PublicAPI.Unshipped.txt | 51 +++++++ .../LocalApiJwtBearerConfigurationTest.cs | 4 +- .../AspNetConventionsConfigureOptionsTests.cs | 2 +- .../Configuration/ConfigureClientsTests.cs | 4 +- .../AutoRedirectEndSessionEndpointTests.cs | 10 +- ...ultClientRequestParametersProviderTests.cs | 2 +- ...rverBuilderConfigurationExtensionsTests.cs | 8 +- .../RelativeRedirectUriValidatorTests.cs | 2 +- ...iAuthorization.IdentityServer.Tests.csproj | 4 +- .../Server/Data/ApplicationDbContext.cs | 2 +- ...000000000_CreateIdentitySchema.Designer.cs | 44 +++++- .../00000000000000_CreateIdentitySchema.cs | 31 +++++ .../ApplicationDbContextModelSnapshot.cs | 44 +++++- ...000000000_CreateIdentitySchema.Designer.cs | 45 ++++++- .../00000000000000_CreateIdentitySchema.cs | 31 +++++ .../ApplicationDbContextModelSnapshot.cs | 45 ++++++- 52 files changed, 778 insertions(+), 106 deletions(-) create mode 100644 src/Identity/ApiAuthorization.IdentityServer/src/ApiAuthorizationDbContext.cs diff --git a/eng/Dependencies.props b/eng/Dependencies.props index b0904d2b241..f4594285e69 100644 --- a/eng/Dependencies.props +++ b/eng/Dependencies.props @@ -160,17 +160,17 @@ and are generated based on the last package release. <LatestPackageReference Include="AngleSharp" /> <LatestPackageReference Include="BenchmarkDotNet" /> <LatestPackageReference Include="CommandLineParser" /> + <LatestPackageReference Include="Duende.IdentityServer" /> + <LatestPackageReference Include="Duende.IdentityServer.AspNetIdentity" /> + <LatestPackageReference Include="Duende.IdentityServer.EntityFramework" /> + <LatestPackageReference Include="Duende.IdentityServer.EntityFramework.Storage" /> + <LatestPackageReference Include="Duende.IdentityServer.Storage" /> <LatestPackageReference Include="FSharp.Core" /> <LatestPackageReference Include="Google.Protobuf" /> <LatestPackageReference Include="Grpc.AspNetCore" /> <LatestPackageReference Include="Grpc.Auth" /> <LatestPackageReference Include="Grpc.Net.Client" /> <LatestPackageReference Include="Grpc.Tools" /> - <LatestPackageReference Include="IdentityServer4" /> - <LatestPackageReference Include="IdentityServer4.AspNetIdentity" /> - <LatestPackageReference Include="IdentityServer4.EntityFramework" /> - <LatestPackageReference Include="IdentityServer4.EntityFramework.Storage" /> - <LatestPackageReference Include="IdentityServer4.Storage" /> <LatestPackageReference Include="Libuv" /> <LatestPackageReference Include="MessagePack" /> <LatestPackageReference Include="MessagePackAnalyzer" /> diff --git a/eng/Versions.props b/eng/Versions.props index e88cf23d549..89ac7f51223 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -229,11 +229,11 @@ <GrpcAuthVersion>2.32.0</GrpcAuthVersion> <GrpcNetClientVersion>2.32.0</GrpcNetClientVersion> <GrpcToolsVersion>2.32.0</GrpcToolsVersion> - <IdentityServer4AspNetIdentityVersion>4.1.0</IdentityServer4AspNetIdentityVersion> - <IdentityServer4EntityFrameworkVersion>4.1.0</IdentityServer4EntityFrameworkVersion> - <IdentityServer4Version>4.1.0</IdentityServer4Version> - <IdentityServer4StorageVersion>4.1.0</IdentityServer4StorageVersion> - <IdentityServer4EntityFrameworkStorageVersion>4.1.0</IdentityServer4EntityFrameworkStorageVersion> + <DuendeIdentityServerAspNetIdentityVersion>5.2.0</DuendeIdentityServerAspNetIdentityVersion> + <DuendeIdentityServerEntityFrameworkVersion>5.2.0</DuendeIdentityServerEntityFrameworkVersion> + <DuendeIdentityServerVersion>5.2.0</DuendeIdentityServerVersion> + <DuendeIdentityServerStorageVersion>5.2.0</DuendeIdentityServerStorageVersion> + <DuendeIdentityServerEntityFrameworkStorageVersion>5.2.0</DuendeIdentityServerEntityFrameworkStorageVersion> <MessagePackVersion>2.1.90</MessagePackVersion> <MicrosoftIdentityWebVersion>1.14.1</MicrosoftIdentityWebVersion> <MicrosoftIdentityWebMicrosoftGraphVersion>1.1.0</MicrosoftIdentityWebMicrosoftGraphVersion> diff --git a/src/Components/WebAssembly/testassets/Wasm.Authentication.Server/Data/ApplicationDbContext.cs b/src/Components/WebAssembly/testassets/Wasm.Authentication.Server/Data/ApplicationDbContext.cs index dbb7e235131..ae1031562b2 100644 --- a/src/Components/WebAssembly/testassets/Wasm.Authentication.Server/Data/ApplicationDbContext.cs +++ b/src/Components/WebAssembly/testassets/Wasm.Authentication.Server/Data/ApplicationDbContext.cs @@ -1,5 +1,5 @@ using Wasm.Authentication.Server.Models; -using IdentityServer4.EntityFramework.Options; +using Duende.IdentityServer.EntityFramework.Options; using Microsoft.AspNetCore.ApiAuthorization.IdentityServer; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Options; diff --git a/src/Components/WebAssembly/testassets/Wasm.Authentication.Server/Data/Migrations/20200324213904_Initial.Designer.cs b/src/Components/WebAssembly/testassets/Wasm.Authentication.Server/Data/Migrations/20200324213904_Initial.Designer.cs index 5a9de57b6de..0bdcef9eb0c 100644 --- a/src/Components/WebAssembly/testassets/Wasm.Authentication.Server/Data/Migrations/20200324213904_Initial.Designer.cs +++ b/src/Components/WebAssembly/testassets/Wasm.Authentication.Server/Data/Migrations/20200324213904_Initial.Designer.cs @@ -18,7 +18,7 @@ namespace Wasm.Authentication.Server.Data.Migrations modelBuilder .HasAnnotation("ProductVersion", "3.1.2"); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b => + modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", b => { b.Property<string>("UserCode") .HasColumnType("TEXT") @@ -60,7 +60,43 @@ namespace Wasm.Authentication.Server.Data.Migrations b.ToTable("DeviceCodes"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => + modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.Key", b => + { + b.Property<string>("Id") + .HasColumnType("TEXT"); + + b.Property<string>("Algorithm") + .IsRequired() + .HasColumnType("TEXT") + .HasMaxLength(100); + + b.Property<DateTime>("Created") + .HasColumnType("datetime2"); + + b.Property<string>("Data") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property<bool>("DataProtected") + .HasColumnType("bit"); + + b.Property<bool>("IsX509Certificate") + .HasColumnType("bit"); + + b.Property<string>("Use") + .HasColumnType("TEXT"); + + b.Property<int>("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Use"); + + b.ToTable("Keys"); + }); + + modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", b => { b.Property<string>("Key") .HasColumnType("TEXT") diff --git a/src/Components/WebAssembly/testassets/Wasm.Authentication.Server/Data/Migrations/20200324213904_Initial.cs b/src/Components/WebAssembly/testassets/Wasm.Authentication.Server/Data/Migrations/20200324213904_Initial.cs index fcafd568d1e..22fd95f30fe 100644 --- a/src/Components/WebAssembly/testassets/Wasm.Authentication.Server/Data/Migrations/20200324213904_Initial.cs +++ b/src/Components/WebAssembly/testassets/Wasm.Authentication.Server/Data/Migrations/20200324213904_Initial.cs @@ -63,6 +63,24 @@ namespace Wasm.Authentication.Server.Data.Migrations table.PrimaryKey("PK_DeviceCodes", x => x.UserCode); }); + migrationBuilder.CreateTable( + name: "Keys", + columns: table => new + { + Id = table.Column<string>(nullable: false), + Version = table.Column<int>(nullable: false), + Created = table.Column<DateTime>(nullable: false), + Use = table.Column<string>(nullable: true), + Algorithm = table.Column<string>(maxLength: 100, nullable: false), + IsX509Certificate = table.Column<bool>(nullable: false), + DataProtected = table.Column<bool>(nullable: false), + Data = table.Column<string>(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Keys", x => x.Id); + }); + migrationBuilder.CreateTable( name: "PersistedGrants", columns: table => new @@ -253,6 +271,16 @@ namespace Wasm.Authentication.Server.Data.Migrations table: "DeviceCodes", column: "Expiration"); + migrationBuilder.CreateIndex( + name: "IX_Keys_Use", + table: "Keys", + column: "Use"); + + migrationBuilder.CreateIndex( + name: "IX_PersistedGrants_ConsumedTime", + table: "PersistedGrants", + column: "ConsumedTime"); + migrationBuilder.CreateIndex( name: "IX_PersistedGrants_Expiration", table: "PersistedGrants", @@ -290,6 +318,9 @@ namespace Wasm.Authentication.Server.Data.Migrations migrationBuilder.DropTable( name: "DeviceCodes"); + migrationBuilder.DropTable( + name: "Keys"); + migrationBuilder.DropTable( name: "PersistedGrants"); diff --git a/src/Components/WebAssembly/testassets/Wasm.Authentication.Server/Data/Migrations/ApplicationDbContextModelSnapshot.cs b/src/Components/WebAssembly/testassets/Wasm.Authentication.Server/Data/Migrations/ApplicationDbContextModelSnapshot.cs index c68c2e09660..1bbf5f9b457 100644 --- a/src/Components/WebAssembly/testassets/Wasm.Authentication.Server/Data/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/src/Components/WebAssembly/testassets/Wasm.Authentication.Server/Data/Migrations/ApplicationDbContextModelSnapshot.cs @@ -16,7 +16,7 @@ namespace Wasm.Authentication.Server.Data.Migrations modelBuilder .HasAnnotation("ProductVersion", "5.0.0-rc.1.20416.1"); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b => + modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", b => { b.Property<string>("UserCode") .HasMaxLength(200) @@ -66,7 +66,46 @@ namespace Wasm.Authentication.Server.Data.Migrations b.ToTable("DeviceCodes"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => + modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.Key", b => + { + b.Property<string>("Id") + .HasMaxLength(450) + .HasColumnType("TEXT"); + + b.Property<string>("Algorithm") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property<DateTime>("Created") + .HasColumnType("TEXT"); + + b.Property<string>("Data") + .IsRequired() + .HasColumnType("TEXT") + .HasMaxLength(50000); + + b.Property<bool>("DataProtected") + .HasColumnType("bit"); + + b.Property<bool>("IsX509Certificate") + .HasColumnType("bit"); + + b.Property<string>("Use") + .HasMaxLength(450) + .HasColumnType("TEXT"); + + b.Property<int>("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Use"); + + b.ToTable("Keys"); + }); + + modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", b => { b.Property<string>("Key") .HasMaxLength(200) diff --git a/src/Components/WebAssembly/testassets/Wasm.Authentication.Server/Wasm.Authentication.Server.csproj b/src/Components/WebAssembly/testassets/Wasm.Authentication.Server/Wasm.Authentication.Server.csproj index cdf4e7684bd..7e19f1566fe 100644 --- a/src/Components/WebAssembly/testassets/Wasm.Authentication.Server/Wasm.Authentication.Server.csproj +++ b/src/Components/WebAssembly/testassets/Wasm.Authentication.Server/Wasm.Authentication.Server.csproj @@ -3,6 +3,8 @@ <PropertyGroup> <TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework> + <!-- IdentityServer packages are not strong named. --> + <NoWarn>CS8002</NoWarn> <!-- This project references the shared framework transitively. Prevent restore errors by setting this flag. --> <GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks> </PropertyGroup> diff --git a/src/Identity/ApiAuthorization.IdentityServer/samples/ApiAuthSample/ApiAuthSample.csproj b/src/Identity/ApiAuthorization.IdentityServer/samples/ApiAuthSample/ApiAuthSample.csproj index fc7fd6784f5..ec21f0bbc98 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/samples/ApiAuthSample/ApiAuthSample.csproj +++ b/src/Identity/ApiAuthorization.IdentityServer/samples/ApiAuthSample/ApiAuthSample.csproj @@ -3,13 +3,15 @@ <PropertyGroup> <TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework> <UserSecretsId>aspnet-ApiAuthSample-12ED8ECC-9EF1-4D31-87B4-1405B3198E5E</UserSecretsId> + <!-- IdentityServer packages are not strong named --> + <NoWarn>CS8002</NoWarn> <!-- We are a package that depends on the shared framework, this allows us to avoid errors during restore --> <GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks> </PropertyGroup> <ItemGroup> - <!-- Remove the reference to Microsoft.AspNetCore.App from IdentityServer4 --> + <!-- Remove the reference to Microsoft.AspNetCore.App from Duende.IdentityServer --> <FrameworkReference Remove="Microsoft.AspNetCore.App" /> <Reference Include="Microsoft.AspNetCore.ApiAuthorization.IdentityServer" /> <Reference Include="Microsoft.AspNetCore.CookiePolicy" /> diff --git a/src/Identity/ApiAuthorization.IdentityServer/samples/ApiAuthSample/Data/ApplicationDbContext.cs b/src/Identity/ApiAuthorization.IdentityServer/samples/ApiAuthSample/Data/ApplicationDbContext.cs index cb0f0e9eed2..80618e81634 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/samples/ApiAuthSample/Data/ApplicationDbContext.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/samples/ApiAuthSample/Data/ApplicationDbContext.cs @@ -1,4 +1,4 @@ -using IdentityServer4.EntityFramework.Options; +using Duende.IdentityServer.EntityFramework.Options; using Microsoft.AspNetCore.ApiAuthorization.IdentityServer; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Options; diff --git a/src/Identity/ApiAuthorization.IdentityServer/samples/ApiAuthSample/Data/Migrations/20180919224505_InitialMigration.Designer.cs b/src/Identity/ApiAuthorization.IdentityServer/samples/ApiAuthSample/Data/Migrations/20180919224505_InitialMigration.Designer.cs index ae62ed80fc8..421d375524f 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/samples/ApiAuthSample/Data/Migrations/20180919224505_InitialMigration.Designer.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/samples/ApiAuthSample/Data/Migrations/20180919224505_InitialMigration.Designer.cs @@ -18,32 +18,119 @@ namespace ApiAuthSample.Data.Migrations modelBuilder .HasAnnotation("ProductVersion", "2.1.3-rtm-32065"); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => + modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", b => + { + b.Property<string>("UserCode") + .HasColumnType("TEXT") + .HasMaxLength(200); + + b.Property<string>("ClientId") + .IsRequired() + .HasColumnType("TEXT") + .HasMaxLength(200); + + b.Property<DateTime>("CreationTime") + .HasColumnType("TEXT"); + + b.Property<string>("Data") + .IsRequired() + .HasColumnType("TEXT") + .HasMaxLength(50000); + + b.Property<string>("DeviceCode") + .IsRequired() + .HasColumnType("TEXT") + .HasMaxLength(200); + + b.Property<DateTime?>("Expiration") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property<string>("SubjectId") + .HasColumnType("TEXT") + .HasMaxLength(200); + + b.HasKey("UserCode"); + + b.HasIndex("DeviceCode") + .IsUnique(); + + b.HasIndex("Expiration"); + + b.ToTable("DeviceCodes"); + }); + + modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.Key", b => + { + b.Property<string>("Id") + .HasColumnType("TEXT"); + + b.Property<string>("Algorithm") + .IsRequired() + .HasColumnType("TEXT") + .HasMaxLength(100); + + b.Property<DateTime>("Created") + .HasColumnType("datetime2"); + + b.Property<string>("Data") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property<bool>("DataProtected") + .HasColumnType("bit"); + + b.Property<bool>("IsX509Certificate") + .HasColumnType("bit"); + + b.Property<string>("Use") + .HasColumnType("TEXT"); + + b.Property<int>("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Use"); + + b.ToTable("Keys"); + }); + + modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", b => { b.Property<string>("Key") + .HasColumnType("TEXT") .HasMaxLength(200); b.Property<string>("ClientId") .IsRequired() + .HasColumnType("TEXT") .HasMaxLength(200); - b.Property<DateTime>("CreationTime"); + b.Property<DateTime>("CreationTime") + .HasColumnType("TEXT"); b.Property<string>("Data") .IsRequired() + .HasColumnType("TEXT") .HasMaxLength(50000); - b.Property<DateTime?>("Expiration"); + b.Property<DateTime?>("Expiration") + .HasColumnType("TEXT"); b.Property<string>("SubjectId") + .HasColumnType("TEXT") .HasMaxLength(200); b.Property<string>("Type") .IsRequired() + .HasColumnType("TEXT") .HasMaxLength(50); b.HasKey("Key"); + b.HasIndex("Expiration"); + b.HasIndex("SubjectId", "ClientId", "Type"); b.ToTable("PersistedGrants"); diff --git a/src/Identity/ApiAuthorization.IdentityServer/samples/ApiAuthSample/Data/Migrations/20180919224505_InitialMigration.cs b/src/Identity/ApiAuthorization.IdentityServer/samples/ApiAuthSample/Data/Migrations/20180919224505_InitialMigration.cs index e801149f5f9..e8ad17c6a19 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/samples/ApiAuthSample/Data/Migrations/20180919224505_InitialMigration.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/samples/ApiAuthSample/Data/Migrations/20180919224505_InitialMigration.cs @@ -46,6 +46,41 @@ namespace ApiAuthSample.Data.Migrations table.PrimaryKey("PK_AspNetUsers", x => x.Id); }); + migrationBuilder.CreateTable( + name: "DeviceCodes", + columns: table => new + { + UserCode = table.Column<string>(maxLength: 200, nullable: false), + DeviceCode = table.Column<string>(maxLength: 200, nullable: false), + SubjectId = table.Column<string>(maxLength: 200, nullable: true), + ClientId = table.Column<string>(maxLength: 200, nullable: false), + CreationTime = table.Column<DateTime>(nullable: false), + Expiration = table.Column<DateTime>(nullable: false), + Data = table.Column<string>(maxLength: 50000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_DeviceCodes", x => x.UserCode); + }); + + migrationBuilder.CreateTable( + name: "Keys", + columns: table => new + { + Id = table.Column<string>(nullable: false), + Version = table.Column<int>(nullable: false), + Created = table.Column<DateTime>(nullable: false), + Use = table.Column<string>(nullable: true), + Algorithm = table.Column<string>(maxLength: 100, nullable: false), + IsX509Certificate = table.Column<bool>(nullable: false), + DataProtected = table.Column<bool>(nullable: false), + Data = table.Column<string>(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Keys", x => x.Id); + }); + migrationBuilder.CreateTable( name: "PersistedGrants", columns: table => new @@ -206,10 +241,41 @@ namespace ApiAuthSample.Data.Migrations column: "NormalizedUserName", unique: true); + migrationBuilder.CreateIndex( + name: "IX_DeviceCodes_DeviceCode", + table: "DeviceCodes", + column: "DeviceCode", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_DeviceCodes_Expiration", + table: "DeviceCodes", + column: "Expiration"); + + migrationBuilder.CreateIndex( + name: "IX_Keys_Use", + table: "Keys", + column: "Use"); + + migrationBuilder.CreateIndex( + name: "IX_PersistedGrants_ConsumedTime", + table: "PersistedGrants", + column: "ConsumedTime"); + + migrationBuilder.CreateIndex( + name: "IX_PersistedGrants_Expiration", + table: "PersistedGrants", + column: "Expiration"); + migrationBuilder.CreateIndex( name: "IX_PersistedGrants_SubjectId_ClientId_Type", table: "PersistedGrants", columns: new[] { "SubjectId", "ClientId", "Type" }); + + migrationBuilder.CreateIndex( + name: "IX_PersistedGrants_SubjectId_SessionId_Type", + table: "PersistedGrants", + columns: new[] { "SubjectId", "SessionId", "Type" }); } protected override void Down(MigrationBuilder migrationBuilder) @@ -229,6 +295,12 @@ namespace ApiAuthSample.Data.Migrations migrationBuilder.DropTable( name: "AspNetUserTokens"); + migrationBuilder.DropTable( + name: "DeviceCodes"); + + migrationBuilder.DropTable( + name: "Keys"); + migrationBuilder.DropTable( name: "PersistedGrants"); diff --git a/src/Identity/ApiAuthorization.IdentityServer/samples/ApiAuthSample/Data/Migrations/ApplicationDbContextModelSnapshot.cs b/src/Identity/ApiAuthorization.IdentityServer/samples/ApiAuthSample/Data/Migrations/ApplicationDbContextModelSnapshot.cs index 23b1f3414fe..1055d1c700a 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/samples/ApiAuthSample/Data/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/samples/ApiAuthSample/Data/Migrations/ApplicationDbContextModelSnapshot.cs @@ -16,34 +16,145 @@ namespace ApiAuthSample.Data.Migrations modelBuilder .HasAnnotation("ProductVersion", "2.1.3-rtm-32065"); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => + modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", b => { - b.Property<string>("Key") - .HasMaxLength(200); + b.Property<string>("UserCode") + .HasMaxLength(200) + .HasColumnType("TEXT"); b.Property<string>("ClientId") .IsRequired() - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property<DateTime>("CreationTime") + .HasColumnType("TEXT"); + + b.Property<string>("Data") + .IsRequired() + .HasMaxLength(50000) + .HasColumnType("TEXT"); + + b.Property<string>("Description") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property<string>("DeviceCode") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property<DateTime?>("Expiration") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property<string>("SessionId") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property<string>("SubjectId") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.HasKey("UserCode"); + + b.HasIndex("DeviceCode") + .IsUnique(); + + b.HasIndex("Expiration"); + + b.ToTable("DeviceCodes"); + }); + + modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.Key", b => + { + b.Property<string>("Id") + .HasMaxLength(450) + .HasColumnType("TEXT"); + + b.Property<string>("Algorithm") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); - b.Property<DateTime>("CreationTime"); + b.Property<DateTime>("Created") + .HasColumnType("TEXT"); b.Property<string>("Data") .IsRequired() + .HasColumnType("TEXT") .HasMaxLength(50000); + + b.Property<bool>("DataProtected") + .HasColumnType("bit"); - b.Property<DateTime?>("Expiration"); + b.Property<bool>("IsX509Certificate") + .HasColumnType("bit"); + + b.Property<string>("Use") + .HasMaxLength(450) + .HasColumnType("TEXT"); + + b.Property<int>("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Use"); + + b.ToTable("Keys"); + }); + + modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", b => + { + b.Property<string>("Key") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property<string>("ClientId") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property<DateTime?>("ConsumedTime") + .HasColumnType("TEXT"); + + b.Property<DateTime>("CreationTime") + .HasColumnType("TEXT"); + + b.Property<string>("Data") + .IsRequired() + .HasMaxLength(50000) + .HasColumnType("TEXT"); + + b.Property<string>("Description") + .HasMaxLength(200) + .HasColumnType("TEXT"); + + b.Property<DateTime?>("Expiration") + .HasColumnType("TEXT"); + + b.Property<string>("SessionId") + .HasMaxLength(100) + .HasColumnType("TEXT"); b.Property<string>("SubjectId") - .HasMaxLength(200); + .HasMaxLength(200) + .HasColumnType("TEXT"); b.Property<string>("Type") .IsRequired() - .HasMaxLength(50); + .HasMaxLength(50) + .HasColumnType("TEXT"); b.HasKey("Key"); + b.HasIndex("Expiration"); + b.HasIndex("SubjectId", "ClientId", "Type"); + b.HasIndex("SubjectId", "SessionId", "Type"); + b.ToTable("PersistedGrants"); }); diff --git a/src/Identity/ApiAuthorization.IdentityServer/src/ApiAuthorizationDbContext.cs b/src/Identity/ApiAuthorization.IdentityServer/src/ApiAuthorizationDbContext.cs new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/Identity/ApiAuthorization.IdentityServer/src/Authentication/AuthenticationBuilderExtensions.cs b/src/Identity/ApiAuthorization.IdentityServer/src/Authentication/AuthenticationBuilderExtensions.cs index 65d2c327fa4..6fa1abbdfbf 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/src/Authentication/AuthenticationBuilderExtensions.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/src/Authentication/AuthenticationBuilderExtensions.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using IdentityServer4.Stores; +using Duende.IdentityServer.Stores; using Microsoft.AspNetCore.ApiAuthorization.IdentityServer; using Microsoft.AspNetCore.ApiAuthorization.IdentityServer.Authentication; using Microsoft.AspNetCore.ApiAuthorization.IdentityServer.Configuration; diff --git a/src/Identity/ApiAuthorization.IdentityServer/src/Authentication/IdentityServerJwtBearerOptionsConfiguration.cs b/src/Identity/ApiAuthorization.IdentityServer/src/Authentication/IdentityServerJwtBearerOptionsConfiguration.cs index 3e7c002a3de..9d9654bc8cd 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/src/Authentication/IdentityServerJwtBearerOptionsConfiguration.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/src/Authentication/IdentityServerJwtBearerOptionsConfiguration.cs @@ -2,8 +2,8 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using IdentityServer4.Extensions; -using IdentityServer4.Stores; +using Duende.IdentityServer.Extensions; +using Duende.IdentityServer.Stores; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.ApiAuthorization.IdentityServer.Configuration; diff --git a/src/Identity/ApiAuthorization.IdentityServer/src/Configuration/ApplicationProfilesPropertyNames.cs b/src/Identity/ApiAuthorization.IdentityServer/src/Configuration/ApplicationProfilesPropertyNames.cs index 67372253809..0588c4abb85 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/src/Configuration/ApplicationProfilesPropertyNames.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/src/Configuration/ApplicationProfilesPropertyNames.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using IdentityServer4.Models; +using Duende.IdentityServer.Models; namespace Microsoft.AspNetCore.ApiAuthorization.IdentityServer { diff --git a/src/Identity/ApiAuthorization.IdentityServer/src/Configuration/ApplicationProfilesPropertyValues.cs b/src/Identity/ApiAuthorization.IdentityServer/src/Configuration/ApplicationProfilesPropertyValues.cs index 9fba8195fac..cedefb2f987 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/src/Configuration/ApplicationProfilesPropertyValues.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/src/Configuration/ApplicationProfilesPropertyValues.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using IdentityServer4.Models; +using Duende.IdentityServer.Models; namespace Microsoft.AspNetCore.ApiAuthorization.IdentityServer { diff --git a/src/Identity/ApiAuthorization.IdentityServer/src/Configuration/AspNetConventionsConfigureOptions.cs b/src/Identity/ApiAuthorization.IdentityServer/src/Configuration/AspNetConventionsConfigureOptions.cs index 9699941961d..04a9fd33d88 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/src/Configuration/AspNetConventionsConfigureOptions.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/src/Configuration/AspNetConventionsConfigureOptions.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using IdentityServer4.Configuration; +using Duende.IdentityServer.Configuration; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.Options; diff --git a/src/Identity/ApiAuthorization.IdentityServer/src/Configuration/ConfigureApiResources.cs b/src/Identity/ApiAuthorization.IdentityServer/src/Configuration/ConfigureApiResources.cs index 27fa9f614ce..ac1ac6d1af2 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/src/Configuration/ConfigureApiResources.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/src/Configuration/ConfigureApiResources.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; -using IdentityServer4.Models; +using Duende.IdentityServer.Models; using Microsoft.AspNetCore.ApiAuthorization.IdentityServer; using Microsoft.AspNetCore.ApiAuthorization.IdentityServer.Configuration; using Microsoft.Extensions.Configuration; diff --git a/src/Identity/ApiAuthorization.IdentityServer/src/Configuration/ConfigureApiScopes.cs b/src/Identity/ApiAuthorization.IdentityServer/src/Configuration/ConfigureApiScopes.cs index 468c9700d72..6ce7f0011e4 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/src/Configuration/ConfigureApiScopes.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/src/Configuration/ConfigureApiScopes.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using IdentityServer4.Models; +using Duende.IdentityServer.Models; using Microsoft.Extensions.Options; namespace Microsoft.AspNetCore.ApiAuthorization.IdentityServer.Configuration diff --git a/src/Identity/ApiAuthorization.IdentityServer/src/Configuration/ConfigureClientScopes.cs b/src/Identity/ApiAuthorization.IdentityServer/src/Configuration/ConfigureClientScopes.cs index 85650c64d3f..6e374dd94d3 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/src/Configuration/ConfigureClientScopes.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/src/Configuration/ConfigureClientScopes.cs @@ -3,7 +3,7 @@ using System; using System.Linq; -using IdentityServer4.Models; +using Duende.IdentityServer.Models; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; diff --git a/src/Identity/ApiAuthorization.IdentityServer/src/Configuration/ConfigureClients.cs b/src/Identity/ApiAuthorization.IdentityServer/src/Configuration/ConfigureClients.cs index f242fdd9823..b1dc5ae7488 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/src/Configuration/ConfigureClients.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/src/Configuration/ConfigureClients.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; -using IdentityServer4.Models; +using Duende.IdentityServer.Models; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; diff --git a/src/Identity/ApiAuthorization.IdentityServer/src/Configuration/ConfigureIdentityResources.cs b/src/Identity/ApiAuthorization.IdentityServer/src/Configuration/ConfigureIdentityResources.cs index 438efe385a0..f8622d20a6d 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/src/Configuration/ConfigureIdentityResources.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/src/Configuration/ConfigureIdentityResources.cs @@ -34,31 +34,31 @@ namespace Microsoft.AspNetCore.ApiAuthorization.IdentityServer { switch (scope) { - case IdentityServer4.IdentityServerConstants.StandardScopes.OpenId: + case Duende.IdentityServer.IdentityServerConstants.StandardScopes.OpenId: options.IdentityResources.Add(IdentityResourceBuilder.OpenId() .AllowAllClients() .FromConfiguration() .Build()); break; - case IdentityServer4.IdentityServerConstants.StandardScopes.Profile: + case Duende.IdentityServer.IdentityServerConstants.StandardScopes.Profile: options.IdentityResources.Add(IdentityResourceBuilder.Profile() .AllowAllClients() .FromConfiguration() .Build()); break; - case IdentityServer4.IdentityServerConstants.StandardScopes.Address: + case Duende.IdentityServer.IdentityServerConstants.StandardScopes.Address: options.IdentityResources.Add(IdentityResourceBuilder.Address() .AllowAllClients() .FromConfiguration() .Build()); break; - case IdentityServer4.IdentityServerConstants.StandardScopes.Email: + case Duende.IdentityServer.IdentityServerConstants.StandardScopes.Email: options.IdentityResources.Add(IdentityResourceBuilder.Email() .AllowAllClients() .FromConfiguration() .Build()); break; - case IdentityServer4.IdentityServerConstants.StandardScopes.Phone: + case Duende.IdentityServer.IdentityServerConstants.StandardScopes.Phone: options.IdentityResources.Add(IdentityResourceBuilder.Phone() .AllowAllClients() .FromConfiguration() diff --git a/src/Identity/ApiAuthorization.IdentityServer/src/Data/ApiAuthorizationDbContext.cs b/src/Identity/ApiAuthorization.IdentityServer/src/Data/ApiAuthorizationDbContext.cs index 464e6c4c989..07e66cca233 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/src/Data/ApiAuthorizationDbContext.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/src/Data/ApiAuthorizationDbContext.cs @@ -3,10 +3,10 @@ using System; using System.Threading.Tasks; -using IdentityServer4.EntityFramework.Entities; -using IdentityServer4.EntityFramework.Extensions; -using IdentityServer4.EntityFramework.Interfaces; -using IdentityServer4.EntityFramework.Options; +using Duende.IdentityServer.EntityFramework.Entities; +using Duende.IdentityServer.EntityFramework.Extensions; +using Duende.IdentityServer.EntityFramework.Interfaces; +using Duende.IdentityServer.EntityFramework.Options; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; @@ -45,6 +45,11 @@ namespace Microsoft.AspNetCore.ApiAuthorization.IdentityServer /// </summary> public DbSet<DeviceFlowCodes> DeviceFlowCodes { get; set; } + /// <summary> + /// Gets or sets the <see cref="DbSet{Key}"/>. + /// </summary> + public DbSet<Key> Keys { get; set; } + Task<int> IPersistedGrantDbContext.SaveChangesAsync() => base.SaveChangesAsync(); /// <inheritdoc /> diff --git a/src/Identity/ApiAuthorization.IdentityServer/src/Extensions/AutoRedirectEndSessionEndpoint.cs b/src/Identity/ApiAuthorization.IdentityServer/src/Extensions/AutoRedirectEndSessionEndpoint.cs index 8fd763004db..bc20f7f3087 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/src/Extensions/AutoRedirectEndSessionEndpoint.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/src/Extensions/AutoRedirectEndSessionEndpoint.cs @@ -5,12 +5,12 @@ using System; using System.Collections.Specialized; using System.Net; using System.Threading.Tasks; -using IdentityServer4.Configuration; -using IdentityServer4.Endpoints.Results; -using IdentityServer4.Extensions; -using IdentityServer4.Hosting; -using IdentityServer4.Services; -using IdentityServer4.Validation; +using Duende.IdentityServer.Configuration; +using Duende.IdentityServer.Endpoints.Results; +using Duende.IdentityServer.Extensions; +using Duende.IdentityServer.Hosting; +using Duende.IdentityServer.Services; +using Duende.IdentityServer.Validation; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.WebUtilities; diff --git a/src/Identity/ApiAuthorization.IdentityServer/src/Extensions/DefaultClientRequestParametersProvider.cs b/src/Identity/ApiAuthorization.IdentityServer/src/Extensions/DefaultClientRequestParametersProvider.cs index 793a6f9d77f..397fd4c67a9 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/src/Extensions/DefaultClientRequestParametersProvider.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/src/Extensions/DefaultClientRequestParametersProvider.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using IdentityServer4.Extensions; +using Duende.IdentityServer.Extensions; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Options; using System; diff --git a/src/Identity/ApiAuthorization.IdentityServer/src/Extensions/RelativeRedirectUriValidator.cs b/src/Identity/ApiAuthorization.IdentityServer/src/Extensions/RelativeRedirectUriValidator.cs index 72a142f9348..83503b7398f 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/src/Extensions/RelativeRedirectUriValidator.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/src/Extensions/RelativeRedirectUriValidator.cs @@ -4,8 +4,8 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; -using IdentityServer4.Models; -using IdentityServer4.Validation; +using Duende.IdentityServer.Models; +using Duende.IdentityServer.Validation; namespace Microsoft.AspNetCore.ApiAuthorization.IdentityServer { diff --git a/src/Identity/ApiAuthorization.IdentityServer/src/IdentityServerBuilderConfigurationExtensions.cs b/src/Identity/ApiAuthorization.IdentityServer/src/IdentityServerBuilderConfigurationExtensions.cs index bfb5d6d049f..e3761466b86 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/src/IdentityServerBuilderConfigurationExtensions.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/src/IdentityServerBuilderConfigurationExtensions.cs @@ -4,12 +4,12 @@ using System; using System.Collections.Generic; using System.Linq; -using IdentityServer4.Configuration; -using IdentityServer4.EntityFramework.Interfaces; -using IdentityServer4.Hosting; -using IdentityServer4.Models; -using IdentityServer4.Stores; -using IdentityServer4.Validation; +using Duende.IdentityServer.Configuration; +using Duende.IdentityServer.EntityFramework.Interfaces; +using Duende.IdentityServer.Hosting; +using Duende.IdentityServer.Models; +using Duende.IdentityServer.Stores; +using Duende.IdentityServer.Validation; using Microsoft.AspNetCore.ApiAuthorization.IdentityServer; using Microsoft.AspNetCore.ApiAuthorization.IdentityServer.Configuration; using Microsoft.EntityFrameworkCore; diff --git a/src/Identity/ApiAuthorization.IdentityServer/src/Microsoft.AspNetCore.ApiAuthorization.IdentityServer.csproj b/src/Identity/ApiAuthorization.IdentityServer/src/Microsoft.AspNetCore.ApiAuthorization.IdentityServer.csproj index 69a21f955ce..8e2283e2c48 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/src/Microsoft.AspNetCore.ApiAuthorization.IdentityServer.csproj +++ b/src/Identity/ApiAuthorization.IdentityServer/src/Microsoft.AspNetCore.ApiAuthorization.IdentityServer.csproj @@ -8,19 +8,27 @@ <!-- We are a package that depends on the shared framework, this allows us to avoid errors during restore --> <GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks> + <!-- IdentityServer packages are not strong named --> + <NoWarn>CS8002</NoWarn> <Nullable>disable</Nullable> </PropertyGroup> <ItemGroup> - <!-- Remove the reference to Microsoft.AspNetCore.App from IdentityServer4 --> + <!-- Remove the reference to Microsoft.AspNetCore.App from Duende.IdentityServer --> <FrameworkReference Remove="Microsoft.AspNetCore.App" /> - <Reference Include="IdentityServer4.AspNetIdentity" /> - <Reference Include="IdentityServer4.EntityFramework" /> - <Reference Include="IdentityServer4.EntityFramework.Storage" /> - <Reference Include="IdentityServer4" /> - <Reference Include="IdentityServer4.Storage" /> + <Reference Include="Duende.IdentityServer.AspNetIdentity" /> + <Reference Include="Duende.IdentityServer.EntityFramework" /> + <Reference Include="Duende.IdentityServer.EntityFramework.Storage" /> + <Reference Include="Duende.IdentityServer" /> + <Reference Include="Duende.IdentityServer.Storage" /> <Reference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" /> <Reference Include="Microsoft.AspNetCore.Identity.UI" /> + <Reference Include="Newtonsoft.Json" /> + <SuppressBaselineReference Include="IdentityServer4.AspNetIdentity" /> + <SuppressBaselineReference Include="IdentityServer4.EntityFramework" /> + <SuppressBaselineReference Include="IdentityServer4.EntityFramework.Storage" /> + <SuppressBaselineReference Include="IdentityServer4" /> + <SuppressBaselineReference Include="IdentityServer4.Storage" /> <!-- These references don't matter as they'll be replaced by the shared framework reference --> <Reference Include="Microsoft.AspNetCore.Authentication.JwtBearer" /> diff --git a/src/Identity/ApiAuthorization.IdentityServer/src/Options/ApiResourceBuilder.cs b/src/Identity/ApiAuthorization.IdentityServer/src/Options/ApiResourceBuilder.cs index bff201bcba1..8e79198e3ad 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/src/Options/ApiResourceBuilder.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/src/Options/ApiResourceBuilder.cs @@ -3,7 +3,7 @@ using System; using System.Linq; -using IdentityServer4.Models; +using Duende.IdentityServer.Models; namespace Microsoft.AspNetCore.ApiAuthorization.IdentityServer { @@ -112,7 +112,7 @@ namespace Microsoft.AspNetCore.ApiAuthorization.IdentityServer /// <summary> /// Builds the API resource. /// </summary> - /// <returns>The built <see cref="IdentityServer4.Models.ApiResource"/>.</returns> + /// <returns>The built <see cref="Duende.IdentityServer.Models.ApiResource"/>.</returns> public ApiResource Build() { if (_built) diff --git a/src/Identity/ApiAuthorization.IdentityServer/src/Options/ApiResourceCollection.cs b/src/Identity/ApiAuthorization.IdentityServer/src/Options/ApiResourceCollection.cs index 104df03cbc0..0b8ef366ac8 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/src/Options/ApiResourceCollection.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/src/Options/ApiResourceCollection.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; -using IdentityServer4.Models; +using Duende.IdentityServer.Models; namespace Microsoft.AspNetCore.ApiAuthorization.IdentityServer { diff --git a/src/Identity/ApiAuthorization.IdentityServer/src/Options/ApiScopeCollection.cs b/src/Identity/ApiAuthorization.IdentityServer/src/Options/ApiScopeCollection.cs index 4ad0f2e6244..2c3059c20fc 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/src/Options/ApiScopeCollection.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/src/Options/ApiScopeCollection.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; -using IdentityServer4.Models; +using Duende.IdentityServer.Models; namespace Microsoft.AspNetCore.ApiAuthorization.IdentityServer { diff --git a/src/Identity/ApiAuthorization.IdentityServer/src/Options/ClientBuilder.cs b/src/Identity/ApiAuthorization.IdentityServer/src/Options/ClientBuilder.cs index 2e66158f0d0..9c22b90a54b 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/src/Options/ClientBuilder.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/src/Options/ClientBuilder.cs @@ -3,8 +3,8 @@ using System; using System.Collections.Generic; -using IdentityServer4; -using IdentityServer4.Models; +using Duende.IdentityServer; +using Duende.IdentityServer.Models; namespace Microsoft.AspNetCore.ApiAuthorization.IdentityServer { diff --git a/src/Identity/ApiAuthorization.IdentityServer/src/Options/ClientCollection.cs b/src/Identity/ApiAuthorization.IdentityServer/src/Options/ClientCollection.cs index 9f3dd10e1d0..c4ca12b5818 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/src/Options/ClientCollection.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/src/Options/ClientCollection.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using IdentityServer4.Models; +using Duende.IdentityServer.Models; using System; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/src/Identity/ApiAuthorization.IdentityServer/src/Options/IdentityResourceBuilder.cs b/src/Identity/ApiAuthorization.IdentityServer/src/Options/IdentityResourceBuilder.cs index 6a04a6640ee..8bfabf654e0 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/src/Options/IdentityResourceBuilder.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/src/Options/IdentityResourceBuilder.cs @@ -1,9 +1,9 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using IdentityServer4; -using IdentityServer4.Models; +using Duende.IdentityServer; +using Duende.IdentityServer.Models; namespace Microsoft.AspNetCore.ApiAuthorization.IdentityServer { @@ -74,7 +74,7 @@ namespace Microsoft.AspNetCore.ApiAuthorization.IdentityServer /// <summary> /// Builds the API resource. /// </summary> - /// <returns>The built <see cref="IdentityServer4.Models.IdentityResource"/>.</returns> + /// <returns>The built <see cref="Duende.IdentityServer.Models.IdentityResource"/>.</returns> public IdentityResource Build() { if (_built) @@ -129,4 +129,4 @@ namespace Microsoft.AspNetCore.ApiAuthorization.IdentityServer } } } -} \ No newline at end of file +} diff --git a/src/Identity/ApiAuthorization.IdentityServer/src/Options/IdentityResourceCollection.cs b/src/Identity/ApiAuthorization.IdentityServer/src/Options/IdentityResourceCollection.cs index e57358489c6..0e036d5c85f 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/src/Options/IdentityResourceCollection.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/src/Options/IdentityResourceCollection.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using IdentityServer4.Models; +using Duende.IdentityServer.Models; using System; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/src/Identity/ApiAuthorization.IdentityServer/src/PublicAPI.Unshipped.txt b/src/Identity/ApiAuthorization.IdentityServer/src/PublicAPI.Unshipped.txt index 7dc5c58110b..20b40db3492 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/src/PublicAPI.Unshipped.txt +++ b/src/Identity/ApiAuthorization.IdentityServer/src/PublicAPI.Unshipped.txt @@ -1 +1,52 @@ #nullable enable +*REMOVED*~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiAuthorizationDbContext<TUser>.ApiAuthorizationDbContext(Microsoft.EntityFrameworkCore.DbContextOptions options, Microsoft.Extensions.Options.IOptions<IdentityServer4.EntityFramework.Options.OperationalStoreOptions> operationalStoreOptions) -> void +*REMOVED*~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiAuthorizationDbContext<TUser>.DeviceFlowCodes.get -> Microsoft.EntityFrameworkCore.DbSet<IdentityServer4.EntityFramework.Entities.DeviceFlowCodes> +*REMOVED*~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiAuthorizationDbContext<TUser>.PersistedGrants.get -> Microsoft.EntityFrameworkCore.DbSet<IdentityServer4.EntityFramework.Entities.PersistedGrant> +*REMOVED*~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiResourceBuilder.ApiResourceBuilder(IdentityServer4.Models.ApiResource resource) -> void +*REMOVED*~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiResourceBuilder.Build() -> IdentityServer4.Models.ApiResource +*REMOVED*~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiResourceCollection.AddRange(params IdentityServer4.Models.ApiResource[] resources) -> void +*REMOVED*~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiResourceCollection.ApiResourceCollection(System.Collections.Generic.IList<IdentityServer4.Models.ApiResource> list) -> void +*REMOVED*~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiResourceCollection.this[string key].get -> IdentityServer4.Models.ApiResource +*REMOVED*~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiScopeCollection.AddRange(params IdentityServer4.Models.ApiScope[] scopes) -> void +*REMOVED*~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiScopeCollection.ApiScopeCollection(System.Collections.Generic.IList<IdentityServer4.Models.ApiScope> list) -> void +*REMOVED*~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiScopeCollection.this[string key].get -> IdentityServer4.Models.ApiScope +*REMOVED*~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientBuilder.Build() -> IdentityServer4.Models.Client +*REMOVED*~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientBuilder.ClientBuilder(IdentityServer4.Models.Client client) -> void +*REMOVED*~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientCollection.AddIdentityServerSPA(string clientId, System.Action<Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientBuilder> configure) -> IdentityServer4.Models.Client +*REMOVED*~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientCollection.AddNativeApp(string clientId, System.Action<Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientBuilder> configure) -> IdentityServer4.Models.Client +*REMOVED*~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientCollection.AddRange(params IdentityServer4.Models.Client[] clients) -> void +*REMOVED*~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientCollection.AddSPA(string clientId, System.Action<Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientBuilder> configure) -> IdentityServer4.Models.Client +*REMOVED*~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientCollection.ClientCollection(System.Collections.Generic.IList<IdentityServer4.Models.Client> list) -> void +*REMOVED*~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientCollection.this[string key].get -> IdentityServer4.Models.Client +*REMOVED*~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.IdentityResourceBuilder.Build() -> IdentityServer4.Models.IdentityResource +*REMOVED*~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.IdentityResourceBuilder.IdentityResourceBuilder(IdentityServer4.Models.IdentityResource resource) -> void +*REMOVED*~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.IdentityResourceCollection.AddRange(params IdentityServer4.Models.IdentityResource[] identityResources) -> void +*REMOVED*~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.IdentityResourceCollection.IdentityResourceCollection(System.Collections.Generic.IList<IdentityServer4.Models.IdentityResource> list) -> void +*REMOVED*~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.IdentityResourceCollection.this[string key].get -> IdentityServer4.Models.IdentityResource +*REMOVED*~static Microsoft.Extensions.DependencyInjection.IdentityServerBuilderConfigurationExtensions.AddSigningCredentials(this Microsoft.Extensions.DependencyInjection.IIdentityServerBuilder builder, Microsoft.Extensions.Configuration.IConfiguration configuration) -> Microsoft.Extensions.DependencyInjection.IIdentityServerBuilder +~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiAuthorizationDbContext<TUser>.ApiAuthorizationDbContext(Microsoft.EntityFrameworkCore.DbContextOptions options, Microsoft.Extensions.Options.IOptions<Duende.IdentityServer.EntityFramework.Options.OperationalStoreOptions> operationalStoreOptions) -> void +~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiAuthorizationDbContext<TUser>.DeviceFlowCodes.get -> Microsoft.EntityFrameworkCore.DbSet<Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes> +~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiAuthorizationDbContext<TUser>.Keys.get -> Microsoft.EntityFrameworkCore.DbSet<Duende.IdentityServer.EntityFramework.Entities.Key> +~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiAuthorizationDbContext<TUser>.Keys.set -> void +~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiAuthorizationDbContext<TUser>.PersistedGrants.get -> Microsoft.EntityFrameworkCore.DbSet<Duende.IdentityServer.EntityFramework.Entities.PersistedGrant> +~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiResourceBuilder.ApiResourceBuilder(Duende.IdentityServer.Models.ApiResource resource) -> void +~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiResourceBuilder.Build() -> Duende.IdentityServer.Models.ApiResource +~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiResourceCollection.AddRange(params Duende.IdentityServer.Models.ApiResource[] resources) -> void +~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiResourceCollection.ApiResourceCollection(System.Collections.Generic.IList<Duende.IdentityServer.Models.ApiResource> list) -> void +~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiResourceCollection.this[string key].get -> Duende.IdentityServer.Models.ApiResource +~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiScopeCollection.AddRange(params Duende.IdentityServer.Models.ApiScope[] scopes) -> void +~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiScopeCollection.ApiScopeCollection(System.Collections.Generic.IList<Duende.IdentityServer.Models.ApiScope> list) -> void +~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ApiScopeCollection.this[string key].get -> Duende.IdentityServer.Models.ApiScope +~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientBuilder.Build() -> Duende.IdentityServer.Models.Client +~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientBuilder.ClientBuilder(Duende.IdentityServer.Models.Client client) -> void +~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientCollection.AddIdentityServerSPA(string clientId, System.Action<Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientBuilder> configure) -> Duende.IdentityServer.Models.Client +~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientCollection.AddNativeApp(string clientId, System.Action<Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientBuilder> configure) -> Duende.IdentityServer.Models.Client +~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientCollection.AddRange(params Duende.IdentityServer.Models.Client[] clients) -> void +~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientCollection.AddSPA(string clientId, System.Action<Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientBuilder> configure) -> Duende.IdentityServer.Models.Client +~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientCollection.ClientCollection(System.Collections.Generic.IList<Duende.IdentityServer.Models.Client> list) -> void +~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientCollection.this[string key].get -> Duende.IdentityServer.Models.Client +~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.IdentityResourceBuilder.Build() -> Duende.IdentityServer.Models.IdentityResource +~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.IdentityResourceBuilder.IdentityResourceBuilder(Duende.IdentityServer.Models.IdentityResource resource) -> void +~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.IdentityResourceCollection.AddRange(params Duende.IdentityServer.Models.IdentityResource[] identityResources) -> void +~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.IdentityResourceCollection.IdentityResourceCollection(System.Collections.Generic.IList<Duende.IdentityServer.Models.IdentityResource> list) -> void +~Microsoft.AspNetCore.ApiAuthorization.IdentityServer.IdentityResourceCollection.this[string key].get -> Duende.IdentityServer.Models.IdentityResource diff --git a/src/Identity/ApiAuthorization.IdentityServer/test/Authentication/LocalApiJwtBearerConfigurationTest.cs b/src/Identity/ApiAuthorization.IdentityServer/test/Authentication/LocalApiJwtBearerConfigurationTest.cs index 1d6dc35261c..6414d4ef0d6 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/test/Authentication/LocalApiJwtBearerConfigurationTest.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/test/Authentication/LocalApiJwtBearerConfigurationTest.cs @@ -4,8 +4,8 @@ using System.Collections.Generic; using System.Security.Cryptography; using System.Threading.Tasks; -using IdentityServer4.Configuration; -using IdentityServer4.Stores; +using Duende.IdentityServer.Configuration; +using Duende.IdentityServer.Stores; using Microsoft.AspNetCore.ApiAuthorization.IdentityServer.Configuration; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.JwtBearer; diff --git a/src/Identity/ApiAuthorization.IdentityServer/test/Configuration/AspNetConventionsConfigureOptionsTests.cs b/src/Identity/ApiAuthorization.IdentityServer/test/Configuration/AspNetConventionsConfigureOptionsTests.cs index 8a1eecb5cd0..36efeb20d17 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/test/Configuration/AspNetConventionsConfigureOptionsTests.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/test/Configuration/AspNetConventionsConfigureOptionsTests.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using IdentityServer4.Configuration; +using Duende.IdentityServer.Configuration; using Microsoft.AspNetCore.Identity; using Xunit; diff --git a/src/Identity/ApiAuthorization.IdentityServer/test/Configuration/ConfigureClientsTests.cs b/src/Identity/ApiAuthorization.IdentityServer/test/Configuration/ConfigureClientsTests.cs index 42f1fcc2d06..c5d2c6d1352 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/test/Configuration/ConfigureClientsTests.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/test/Configuration/ConfigureClientsTests.cs @@ -1,8 +1,8 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using IdentityServer4; -using IdentityServer4.Models; +using Duende.IdentityServer; +using Duende.IdentityServer.Models; using Microsoft.Extensions.Configuration; using System; using System.Collections.Generic; diff --git a/src/Identity/ApiAuthorization.IdentityServer/test/Extensions/AutoRedirectEndSessionEndpointTests.cs b/src/Identity/ApiAuthorization.IdentityServer/test/Extensions/AutoRedirectEndSessionEndpointTests.cs index 389e8362178..a777a39f651 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/test/Extensions/AutoRedirectEndSessionEndpointTests.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/test/Extensions/AutoRedirectEndSessionEndpointTests.cs @@ -5,11 +5,11 @@ using System.Collections.Generic; using System.Collections.Specialized; using System.Security.Claims; using System.Threading.Tasks; -using IdentityServer4.Configuration; -using IdentityServer4.Endpoints.Results; -using IdentityServer4.Models; -using IdentityServer4.Services; -using IdentityServer4.Validation; +using Duende.IdentityServer.Configuration; +using Duende.IdentityServer.Endpoints.Results; +using Duende.IdentityServer.Models; +using Duende.IdentityServer.Services; +using Duende.IdentityServer.Validation; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Identity; diff --git a/src/Identity/ApiAuthorization.IdentityServer/test/Extensions/DefaultClientRequestParametersProviderTests.cs b/src/Identity/ApiAuthorization.IdentityServer/test/Extensions/DefaultClientRequestParametersProviderTests.cs index 308c1716014..f16176e1160 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/test/Extensions/DefaultClientRequestParametersProviderTests.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/test/Extensions/DefaultClientRequestParametersProviderTests.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; -using IdentityServer4.Configuration; +using Duende.IdentityServer.Configuration; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; diff --git a/src/Identity/ApiAuthorization.IdentityServer/test/Extensions/IdentityServerBuilderConfigurationExtensionsTests.cs b/src/Identity/ApiAuthorization.IdentityServer/test/Extensions/IdentityServerBuilderConfigurationExtensionsTests.cs index 440536272f9..31c02a466a3 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/test/Extensions/IdentityServerBuilderConfigurationExtensionsTests.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/test/Extensions/IdentityServerBuilderConfigurationExtensionsTests.cs @@ -4,9 +4,9 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; -using IdentityServer4.EntityFramework.Entities; -using IdentityServer4.EntityFramework.Interfaces; -using IdentityServer4.Stores; +using Duende.IdentityServer.EntityFramework.Entities; +using Duende.IdentityServer.EntityFramework.Interfaces; +using Duende.IdentityServer.Stores; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Testing; using Microsoft.EntityFrameworkCore; @@ -109,6 +109,8 @@ namespace Microsoft.AspNetCore.ApiAuthorization.IdentityServer.Extensions public DbSet<DeviceFlowCodes> DeviceFlowCodes { get; set; } + public DbSet<Key> Keys { get; set; } + public Task<int> SaveChangesAsync() { throw new NotImplementedException(); diff --git a/src/Identity/ApiAuthorization.IdentityServer/test/Extensions/RelativeRedirectUriValidatorTests.cs b/src/Identity/ApiAuthorization.IdentityServer/test/Extensions/RelativeRedirectUriValidatorTests.cs index f067b2c65e3..d427d712c1e 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/test/Extensions/RelativeRedirectUriValidatorTests.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/test/Extensions/RelativeRedirectUriValidatorTests.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using IdentityServer4.Models; +using Duende.IdentityServer.Models; using Microsoft.AspNetCore.Http; using System.Collections.Generic; using System.Threading.Tasks; diff --git a/src/Identity/ApiAuthorization.IdentityServer/test/Microsoft.AspNetCore.ApiAuthorization.IdentityServer.Tests.csproj b/src/Identity/ApiAuthorization.IdentityServer/test/Microsoft.AspNetCore.ApiAuthorization.IdentityServer.Tests.csproj index 8b291f49797..68c2b18fc1b 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/test/Microsoft.AspNetCore.ApiAuthorization.IdentityServer.Tests.csproj +++ b/src/Identity/ApiAuthorization.IdentityServer/test/Microsoft.AspNetCore.ApiAuthorization.IdentityServer.Tests.csproj @@ -5,10 +5,12 @@ <!-- We are a package that depends on the shared framework, this allows us to avoid errors during restore --> <GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks> + <!-- IdentityServer packages are not strong named --> + <NoWarn>CS8002</NoWarn> </PropertyGroup> <ItemGroup> - <!-- Remove the reference to Microsoft.AspNetCore.App from IdentityServer4 --> + <!-- Remove the reference to Microsoft.AspNetCore.App from Duende.IdentityServer --> <FrameworkReference Remove="Microsoft.AspNetCore.App" /> <Reference Include="Microsoft.AspNetCore.ApiAuthorization.IdentityServer" /> diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Data/ApplicationDbContext.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Data/ApplicationDbContext.cs index 39ef8cb3a4e..0169288a585 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Data/ApplicationDbContext.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Data/ApplicationDbContext.cs @@ -1,7 +1,7 @@ using Microsoft.AspNetCore.ApiAuthorization.IdentityServer; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Options; -using IdentityServer4.EntityFramework.Options; +using Duende.IdentityServer.EntityFramework.Options; using ComponentsWebAssembly_CSharp.Server.Models; namespace ComponentsWebAssembly_CSharp.Server.Data; diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Data/SqlLite/00000000000000_CreateIdentitySchema.Designer.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Data/SqlLite/00000000000000_CreateIdentitySchema.Designer.cs index 23df6673d35..56adafe29cb 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Data/SqlLite/00000000000000_CreateIdentitySchema.Designer.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Data/SqlLite/00000000000000_CreateIdentitySchema.Designer.cs @@ -82,7 +82,7 @@ namespace ComponentsWebAssembly_CSharp.Server.Data.Migrations b.ToTable("AspNetUsers"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b => + modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", b => { b.Property<string>("UserCode") .HasMaxLength(200) @@ -132,7 +132,45 @@ namespace ComponentsWebAssembly_CSharp.Server.Data.Migrations b.ToTable("DeviceCodes"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => + modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.Key", b => + { + b.Property<string>("Id") + .HasColumnType("TEXT"); + + b.Property<string>("Algorithm") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property<DateTime>("Created") + .HasColumnType("TEXT"); + + b.Property<string>("Data") + .IsRequired() + .HasMaxLength(50000) + .HasColumnType("TEXT"); + + b.Property<bool>("DataProtected") + .HasColumnType("INTEGER"); + + b.Property<bool>("IsX509Certificate") + .HasColumnType("INTEGER"); + + b.Property<string>("Use") + .HasMaxLength(450) + .HasColumnType("TEXT"); + + b.Property<int>("Version") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("Use"); + + b.ToTable("Keys"); + }); + + modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", b => { b.Property<string>("Key") .HasMaxLength(200) @@ -176,6 +214,8 @@ namespace ComponentsWebAssembly_CSharp.Server.Data.Migrations b.HasKey("Key"); + b.HasIndex("ConsumedTime"); + b.HasIndex("Expiration"); b.HasIndex("SubjectId", "ClientId", "Type"); diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Data/SqlLite/00000000000000_CreateIdentitySchema.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Data/SqlLite/00000000000000_CreateIdentitySchema.cs index 25d42c8dae4..a2f96bf2400 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Data/SqlLite/00000000000000_CreateIdentitySchema.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Data/SqlLite/00000000000000_CreateIdentitySchema.cs @@ -65,6 +65,24 @@ namespace ComponentsWebAssembly_CSharp.Server.Data.Migrations table.PrimaryKey("PK_DeviceCodes", x => x.UserCode); }); + migrationBuilder.CreateTable( + name: "Keys", + columns: table => new + { + Id = table.Column<string>(type: "TEXT", nullable: false), + Version = table.Column<int>(type: "INTEGER", nullable: false), + Created = table.Column<DateTime>(type: "TEXT", nullable: false), + Use = table.Column<string>(type: "TEXT", maxLength: 450, nullable: true), + Algorithm = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false), + IsX509Certificate = table.Column<bool>(type: "INTEGER", nullable: false), + DataProtected = table.Column<bool>(type: "INTEGER", nullable: false), + Data = table.Column<string>(type: "TEXT", maxLength: 50000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Keys", x => x.Id); + }); + migrationBuilder.CreateTable( name: "PersistedGrants", columns: table => new @@ -239,6 +257,16 @@ namespace ComponentsWebAssembly_CSharp.Server.Data.Migrations table: "DeviceCodes", column: "Expiration"); + migrationBuilder.CreateIndex( + name: "IX_Keys_Use", + table: "Keys", + column: "Use"); + + migrationBuilder.CreateIndex( + name: "IX_PersistedGrants_ConsumedTime", + table: "PersistedGrants", + column: "ConsumedTime"); + migrationBuilder.CreateIndex( name: "IX_PersistedGrants_Expiration", table: "PersistedGrants", @@ -275,6 +303,9 @@ namespace ComponentsWebAssembly_CSharp.Server.Data.Migrations migrationBuilder.DropTable( name: "DeviceCodes"); + migrationBuilder.DropTable( + name: "Keys"); + migrationBuilder.DropTable( name: "PersistedGrants"); diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Data/SqlLite/ApplicationDbContextModelSnapshot.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Data/SqlLite/ApplicationDbContextModelSnapshot.cs index 3c3c91a357f..53f211899d3 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Data/SqlLite/ApplicationDbContextModelSnapshot.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Data/SqlLite/ApplicationDbContextModelSnapshot.cs @@ -80,7 +80,7 @@ namespace ComponentsWebAssembly_CSharp.Server.Data.Migrations b.ToTable("AspNetUsers"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b => + modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", b => { b.Property<string>("UserCode") .HasMaxLength(200) @@ -130,7 +130,45 @@ namespace ComponentsWebAssembly_CSharp.Server.Data.Migrations b.ToTable("DeviceCodes"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => + modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.Key", b => + { + b.Property<string>("Id") + .HasColumnType("TEXT"); + + b.Property<string>("Algorithm") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property<DateTime>("Created") + .HasColumnType("TEXT"); + + b.Property<string>("Data") + .IsRequired() + .HasMaxLength(50000) + .HasColumnType("TEXT"); + + b.Property<bool>("DataProtected") + .HasColumnType("INTEGER"); + + b.Property<bool>("IsX509Certificate") + .HasColumnType("INTEGER"); + + b.Property<string>("Use") + .HasMaxLength(450) + .HasColumnType("TEXT"); + + b.Property<int>("Version") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("Use"); + + b.ToTable("Keys"); + }); + + modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", b => { b.Property<string>("Key") .HasMaxLength(200) @@ -174,6 +212,8 @@ namespace ComponentsWebAssembly_CSharp.Server.Data.Migrations b.HasKey("Key"); + b.HasIndex("ConsumedTime"); + b.HasIndex("Expiration"); b.HasIndex("SubjectId", "ClientId", "Type"); diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Data/SqlServer/00000000000000_CreateIdentitySchema.Designer.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Data/SqlServer/00000000000000_CreateIdentitySchema.Designer.cs index 072bc519965..efa118bae84 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Data/SqlServer/00000000000000_CreateIdentitySchema.Designer.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Data/SqlServer/00000000000000_CreateIdentitySchema.Designer.cs @@ -86,7 +86,7 @@ namespace ComponentsWebAssembly_CSharp.Server.Data.Migrations b.ToTable("AspNetUsers"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b => + modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", b => { b.Property<string>("UserCode") .HasMaxLength(200) @@ -136,7 +136,46 @@ namespace ComponentsWebAssembly_CSharp.Server.Data.Migrations b.ToTable("DeviceCodes"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => + modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.Key", b => + { + b.Property<string>("Id") + .HasMaxLength(450) + .HasColumnType("nvarchar(450)"); + + b.Property<string>("Algorithm") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property<DateTime>("Created") + .HasColumnType("datetime2"); + + b.Property<string>("Data") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(50000); + + b.Property<bool>("DataProtected") + .HasColumnType("bit"); + + b.Property<bool>("IsX509Certificate") + .HasColumnType("bit"); + + b.Property<string>("Use") + .HasMaxLength(450) + .HasColumnType("nvarchar(450)"); + + b.Property<int>("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Use"); + + b.ToTable("Keys"); + }); + + modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", b => { b.Property<string>("Key") .HasMaxLength(200) @@ -180,6 +219,8 @@ namespace ComponentsWebAssembly_CSharp.Server.Data.Migrations b.HasKey("Key"); + b.HasIndex("ConsumedTime"); + b.HasIndex("Expiration"); b.HasIndex("SubjectId", "ClientId", "Type"); diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Data/SqlServer/00000000000000_CreateIdentitySchema.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Data/SqlServer/00000000000000_CreateIdentitySchema.cs index 84ba4d1e073..915296bf392 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Data/SqlServer/00000000000000_CreateIdentitySchema.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Data/SqlServer/00000000000000_CreateIdentitySchema.cs @@ -65,6 +65,24 @@ namespace ComponentsWebAssembly_CSharp.Server.Data.Migrations table.PrimaryKey("PK_DeviceCodes", x => x.UserCode); }); + migrationBuilder.CreateTable( + name: "Keys", + columns: table => new + { + Id = table.Column<string>(type: "nvarchar(450)", nullable: false), + Version = table.Column<int>(type: "int", nullable: false), + Created = table.Column<DateTime>(type: "datetime2", nullable: false), + Use = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true), + Algorithm = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false), + IsX509Certificate = table.Column<bool>(type: "bit", nullable: false), + DataProtected = table.Column<bool>(type: "bit", nullable: false), + Data = table.Column<string>(type: "nvarchar(max)", maxLength: 50000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Keys", x => x.Id); + }); + migrationBuilder.CreateTable( name: "PersistedGrants", columns: table => new @@ -241,6 +259,16 @@ namespace ComponentsWebAssembly_CSharp.Server.Data.Migrations table: "DeviceCodes", column: "Expiration"); + migrationBuilder.CreateIndex( + name: "IX_Keys_Use", + table: "Keys", + column: "Use"); + + migrationBuilder.CreateIndex( + name: "IX_PersistedGrants_ConsumedTime", + table: "PersistedGrants", + column: "ConsumedTime"); + migrationBuilder.CreateIndex( name: "IX_PersistedGrants_Expiration", table: "PersistedGrants", @@ -277,6 +305,9 @@ namespace ComponentsWebAssembly_CSharp.Server.Data.Migrations migrationBuilder.DropTable( name: "DeviceCodes"); + migrationBuilder.DropTable( + name: "Keys"); + migrationBuilder.DropTable( name: "PersistedGrants"); diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Data/SqlServer/ApplicationDbContextModelSnapshot.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Data/SqlServer/ApplicationDbContextModelSnapshot.cs index c751e16729b..9eea2ae4bd8 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Data/SqlServer/ApplicationDbContextModelSnapshot.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Data/SqlServer/ApplicationDbContextModelSnapshot.cs @@ -84,7 +84,7 @@ namespace ComponentsWebAssembly_CSharp.Server.Data.Migrations b.ToTable("AspNetUsers"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b => + modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", b => { b.Property<string>("UserCode") .HasMaxLength(200) @@ -134,7 +134,46 @@ namespace ComponentsWebAssembly_CSharp.Server.Data.Migrations b.ToTable("DeviceCodes"); }); - modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => + modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.Key", b => + { + b.Property<string>("Id") + .HasMaxLength(450) + .HasColumnType("nvarchar(450)"); + + b.Property<string>("Algorithm") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property<DateTime>("Created") + .HasColumnType("datetime2"); + + b.Property<string>("Data") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(50000); + + b.Property<bool>("DataProtected") + .HasColumnType("bit"); + + b.Property<bool>("IsX509Certificate") + .HasColumnType("bit"); + + b.Property<string>("Use") + .HasMaxLength(450) + .HasColumnType("nvarchar(450)"); + + b.Property<int>("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Use"); + + b.ToTable("Keys"); + }); + + modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", b => { b.Property<string>("Key") .HasMaxLength(200) @@ -178,6 +217,8 @@ namespace ComponentsWebAssembly_CSharp.Server.Data.Migrations b.HasKey("Key"); + b.HasIndex("ConsumedTime"); + b.HasIndex("Expiration"); b.HasIndex("SubjectId", "ClientId", "Type"); -- GitLab