@ -0,0 +1,23 @@ | |||
namespace Identity.API.Extensions | |||
{ | |||
public static class Extensions | |||
{ | |||
/// <summary> | |||
/// Checks if the redirect URI is for a native client. | |||
/// </summary> | |||
/// <returns></returns> | |||
public static bool IsNativeClient(this AuthorizationRequest context) | |||
{ | |||
return !context.RedirectUri.StartsWith("https", StringComparison.Ordinal) | |||
&& !context.RedirectUri.StartsWith("http", StringComparison.Ordinal); | |||
} | |||
public static IActionResult LoadingPage(this Controller controller, string viewName, string redirectUri) | |||
{ | |||
controller.HttpContext.Response.StatusCode = 200; | |||
controller.HttpContext.Response.Headers["Location"] = ""; | |||
return controller.View(viewName, new RedirectViewModel { RedirectUrl = redirectUri }); | |||
} | |||
} | |||
} |
@ -1,911 +0,0 @@ | |||
// <auto-generated /> | |||
using System; | |||
using IdentityServer4.EntityFramework.DbContexts; | |||
using Microsoft.EntityFrameworkCore; | |||
using Microsoft.EntityFrameworkCore.Infrastructure; | |||
using Microsoft.EntityFrameworkCore.Metadata; | |||
using Microsoft.EntityFrameworkCore.Migrations; | |||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; | |||
namespace Identity.API.Migrations.ConfigurationDb | |||
{ | |||
[DbContext(typeof(ConfigurationDbContext))] | |||
[Migration("20210813072543_InitialMigration")] | |||
partial class InitialMigration | |||
{ | |||
protected override void BuildTargetModel(ModelBuilder modelBuilder) | |||
{ | |||
#pragma warning disable 612, 618 | |||
modelBuilder | |||
.HasAnnotation("Relational:MaxIdentifierLength", 128) | |||
.HasAnnotation("ProductVersion", "6.0.0") | |||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResource", b => | |||
{ | |||
b.Property<int>("Id") | |||
.ValueGeneratedOnAdd() | |||
.HasColumnType("int") | |||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); | |||
b.Property<DateTime>("Created") | |||
.HasColumnType("datetime2"); | |||
b.Property<string>("Description") | |||
.HasMaxLength(1000) | |||
.HasColumnType("nvarchar(1000)"); | |||
b.Property<string>("DisplayName") | |||
.HasMaxLength(200) | |||
.HasColumnType("nvarchar(200)"); | |||
b.Property<bool>("Enabled") | |||
.HasColumnType("bit"); | |||
b.Property<DateTime?>("LastAccessed") | |||
.HasColumnType("datetime2"); | |||
b.Property<string>("Name") | |||
.IsRequired() | |||
.HasMaxLength(200) | |||
.HasColumnType("nvarchar(200)"); | |||
b.Property<bool>("NonEditable") | |||
.HasColumnType("bit"); | |||
b.Property<DateTime?>("Updated") | |||
.HasColumnType("datetime2"); | |||
b.HasKey("Id"); | |||
b.HasIndex("Name") | |||
.IsUnique(); | |||
b.ToTable("ApiResources", (string)null); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceClaim", b => | |||
{ | |||
b.Property<int>("Id") | |||
.ValueGeneratedOnAdd() | |||
.HasColumnType("int") | |||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); | |||
b.Property<int>("ApiResourceId") | |||
.HasColumnType("int"); | |||
b.Property<string>("Type") | |||
.IsRequired() | |||
.HasMaxLength(200) | |||
.HasColumnType("nvarchar(200)"); | |||
b.HasKey("Id"); | |||
b.HasIndex("ApiResourceId"); | |||
b.ToTable("ApiClaims", (string)null); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceProperty", b => | |||
{ | |||
b.Property<int>("Id") | |||
.ValueGeneratedOnAdd() | |||
.HasColumnType("int") | |||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); | |||
b.Property<int>("ApiResourceId") | |||
.HasColumnType("int"); | |||
b.Property<string>("Key") | |||
.IsRequired() | |||
.HasMaxLength(250) | |||
.HasColumnType("nvarchar(250)"); | |||
b.Property<string>("Value") | |||
.IsRequired() | |||
.HasMaxLength(2000) | |||
.HasColumnType("nvarchar(2000)"); | |||
b.HasKey("Id"); | |||
b.HasIndex("ApiResourceId"); | |||
b.ToTable("ApiProperties", (string)null); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScope", b => | |||
{ | |||
b.Property<int>("Id") | |||
.ValueGeneratedOnAdd() | |||
.HasColumnType("int") | |||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); | |||
b.Property<int>("ApiResourceId") | |||
.HasColumnType("int"); | |||
b.Property<string>("Description") | |||
.HasMaxLength(1000) | |||
.HasColumnType("nvarchar(1000)"); | |||
b.Property<string>("DisplayName") | |||
.HasMaxLength(200) | |||
.HasColumnType("nvarchar(200)"); | |||
b.Property<bool>("Emphasize") | |||
.HasColumnType("bit"); | |||
b.Property<string>("Name") | |||
.IsRequired() | |||
.HasMaxLength(200) | |||
.HasColumnType("nvarchar(200)"); | |||
b.Property<bool>("Required") | |||
.HasColumnType("bit"); | |||
b.Property<bool>("ShowInDiscoveryDocument") | |||
.HasColumnType("bit"); | |||
b.HasKey("Id"); | |||
b.HasIndex("ApiResourceId"); | |||
b.HasIndex("Name") | |||
.IsUnique(); | |||
b.ToTable("ApiScopes", (string)null); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeClaim", b => | |||
{ | |||
b.Property<int>("Id") | |||
.ValueGeneratedOnAdd() | |||
.HasColumnType("int") | |||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); | |||
b.Property<int>("ApiScopeId") | |||
.HasColumnType("int"); | |||
b.Property<string>("Type") | |||
.IsRequired() | |||
.HasMaxLength(200) | |||
.HasColumnType("nvarchar(200)"); | |||
b.HasKey("Id"); | |||
b.HasIndex("ApiScopeId"); | |||
b.ToTable("ApiScopeClaims", (string)null); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiSecret", b => | |||
{ | |||
b.Property<int>("Id") | |||
.ValueGeneratedOnAdd() | |||
.HasColumnType("int") | |||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); | |||
b.Property<int>("ApiResourceId") | |||
.HasColumnType("int"); | |||
b.Property<DateTime>("Created") | |||
.HasColumnType("datetime2"); | |||
b.Property<string>("Description") | |||
.HasMaxLength(1000) | |||
.HasColumnType("nvarchar(1000)"); | |||
b.Property<DateTime?>("Expiration") | |||
.HasColumnType("datetime2"); | |||
b.Property<string>("Type") | |||
.IsRequired() | |||
.HasMaxLength(250) | |||
.HasColumnType("nvarchar(250)"); | |||
b.Property<string>("Value") | |||
.IsRequired() | |||
.HasMaxLength(4000) | |||
.HasColumnType("nvarchar(4000)"); | |||
b.HasKey("Id"); | |||
b.HasIndex("ApiResourceId"); | |||
b.ToTable("ApiSecrets", (string)null); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.Client", b => | |||
{ | |||
b.Property<int>("Id") | |||
.ValueGeneratedOnAdd() | |||
.HasColumnType("int") | |||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); | |||
b.Property<int>("AbsoluteRefreshTokenLifetime") | |||
.HasColumnType("int"); | |||
b.Property<int>("AccessTokenLifetime") | |||
.HasColumnType("int"); | |||
b.Property<int>("AccessTokenType") | |||
.HasColumnType("int"); | |||
b.Property<bool>("AllowAccessTokensViaBrowser") | |||
.HasColumnType("bit"); | |||
b.Property<bool>("AllowOfflineAccess") | |||
.HasColumnType("bit"); | |||
b.Property<bool>("AllowPlainTextPkce") | |||
.HasColumnType("bit"); | |||
b.Property<bool>("AllowRememberConsent") | |||
.HasColumnType("bit"); | |||
b.Property<bool>("AlwaysIncludeUserClaimsInIdToken") | |||
.HasColumnType("bit"); | |||
b.Property<bool>("AlwaysSendClientClaims") | |||
.HasColumnType("bit"); | |||
b.Property<int>("AuthorizationCodeLifetime") | |||
.HasColumnType("int"); | |||
b.Property<bool>("BackChannelLogoutSessionRequired") | |||
.HasColumnType("bit"); | |||
b.Property<string>("BackChannelLogoutUri") | |||
.HasMaxLength(2000) | |||
.HasColumnType("nvarchar(2000)"); | |||
b.Property<string>("ClientClaimsPrefix") | |||
.HasMaxLength(200) | |||
.HasColumnType("nvarchar(200)"); | |||
b.Property<string>("ClientId") | |||
.IsRequired() | |||
.HasMaxLength(200) | |||
.HasColumnType("nvarchar(200)"); | |||
b.Property<string>("ClientName") | |||
.HasMaxLength(200) | |||
.HasColumnType("nvarchar(200)"); | |||
b.Property<string>("ClientUri") | |||
.HasMaxLength(2000) | |||
.HasColumnType("nvarchar(2000)"); | |||
b.Property<int?>("ConsentLifetime") | |||
.HasColumnType("int"); | |||
b.Property<DateTime>("Created") | |||
.HasColumnType("datetime2"); | |||
b.Property<string>("Description") | |||
.HasMaxLength(1000) | |||
.HasColumnType("nvarchar(1000)"); | |||
b.Property<int>("DeviceCodeLifetime") | |||
.HasColumnType("int"); | |||
b.Property<bool>("EnableLocalLogin") | |||
.HasColumnType("bit"); | |||
b.Property<bool>("Enabled") | |||
.HasColumnType("bit"); | |||
b.Property<bool>("FrontChannelLogoutSessionRequired") | |||
.HasColumnType("bit"); | |||
b.Property<string>("FrontChannelLogoutUri") | |||
.HasMaxLength(2000) | |||
.HasColumnType("nvarchar(2000)"); | |||
b.Property<int>("IdentityTokenLifetime") | |||
.HasColumnType("int"); | |||
b.Property<bool>("IncludeJwtId") | |||
.HasColumnType("bit"); | |||
b.Property<DateTime?>("LastAccessed") | |||
.HasColumnType("datetime2"); | |||
b.Property<string>("LogoUri") | |||
.HasMaxLength(2000) | |||
.HasColumnType("nvarchar(2000)"); | |||
b.Property<bool>("NonEditable") | |||
.HasColumnType("bit"); | |||
b.Property<string>("PairWiseSubjectSalt") | |||
.HasMaxLength(200) | |||
.HasColumnType("nvarchar(200)"); | |||
b.Property<string>("ProtocolType") | |||
.IsRequired() | |||
.HasMaxLength(200) | |||
.HasColumnType("nvarchar(200)"); | |||
b.Property<int>("RefreshTokenExpiration") | |||
.HasColumnType("int"); | |||
b.Property<int>("RefreshTokenUsage") | |||
.HasColumnType("int"); | |||
b.Property<bool>("RequireClientSecret") | |||
.HasColumnType("bit"); | |||
b.Property<bool>("RequireConsent") | |||
.HasColumnType("bit"); | |||
b.Property<bool>("RequirePkce") | |||
.HasColumnType("bit"); | |||
b.Property<int>("SlidingRefreshTokenLifetime") | |||
.HasColumnType("int"); | |||
b.Property<bool>("UpdateAccessTokenClaimsOnRefresh") | |||
.HasColumnType("bit"); | |||
b.Property<DateTime?>("Updated") | |||
.HasColumnType("datetime2"); | |||
b.Property<string>("UserCodeType") | |||
.HasMaxLength(100) | |||
.HasColumnType("nvarchar(100)"); | |||
b.Property<int?>("UserSsoLifetime") | |||
.HasColumnType("int"); | |||
b.HasKey("Id"); | |||
b.HasIndex("ClientId") | |||
.IsUnique(); | |||
b.ToTable("Clients", (string)null); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientClaim", b => | |||
{ | |||
b.Property<int>("Id") | |||
.ValueGeneratedOnAdd() | |||
.HasColumnType("int") | |||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); | |||
b.Property<int>("ClientId") | |||
.HasColumnType("int"); | |||
b.Property<string>("Type") | |||
.IsRequired() | |||
.HasMaxLength(250) | |||
.HasColumnType("nvarchar(250)"); | |||
b.Property<string>("Value") | |||
.IsRequired() | |||
.HasMaxLength(250) | |||
.HasColumnType("nvarchar(250)"); | |||
b.HasKey("Id"); | |||
b.HasIndex("ClientId"); | |||
b.ToTable("ClientClaims", (string)null); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientCorsOrigin", b => | |||
{ | |||
b.Property<int>("Id") | |||
.ValueGeneratedOnAdd() | |||
.HasColumnType("int") | |||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); | |||
b.Property<int>("ClientId") | |||
.HasColumnType("int"); | |||
b.Property<string>("Origin") | |||
.IsRequired() | |||
.HasMaxLength(150) | |||
.HasColumnType("nvarchar(150)"); | |||
b.HasKey("Id"); | |||
b.HasIndex("ClientId"); | |||
b.ToTable("ClientCorsOrigins", (string)null); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientGrantType", b => | |||
{ | |||
b.Property<int>("Id") | |||
.ValueGeneratedOnAdd() | |||
.HasColumnType("int") | |||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); | |||
b.Property<int>("ClientId") | |||
.HasColumnType("int"); | |||
b.Property<string>("GrantType") | |||
.IsRequired() | |||
.HasMaxLength(250) | |||
.HasColumnType("nvarchar(250)"); | |||
b.HasKey("Id"); | |||
b.HasIndex("ClientId"); | |||
b.ToTable("ClientGrantTypes", (string)null); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientIdPRestriction", b => | |||
{ | |||
b.Property<int>("Id") | |||
.ValueGeneratedOnAdd() | |||
.HasColumnType("int") | |||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); | |||
b.Property<int>("ClientId") | |||
.HasColumnType("int"); | |||
b.Property<string>("Provider") | |||
.IsRequired() | |||
.HasMaxLength(200) | |||
.HasColumnType("nvarchar(200)"); | |||
b.HasKey("Id"); | |||
b.HasIndex("ClientId"); | |||
b.ToTable("ClientIdPRestrictions", (string)null); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientPostLogoutRedirectUri", b => | |||
{ | |||
b.Property<int>("Id") | |||
.ValueGeneratedOnAdd() | |||
.HasColumnType("int") | |||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); | |||
b.Property<int>("ClientId") | |||
.HasColumnType("int"); | |||
b.Property<string>("PostLogoutRedirectUri") | |||
.IsRequired() | |||
.HasMaxLength(2000) | |||
.HasColumnType("nvarchar(2000)"); | |||
b.HasKey("Id"); | |||
b.HasIndex("ClientId"); | |||
b.ToTable("ClientPostLogoutRedirectUris", (string)null); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientProperty", b => | |||
{ | |||
b.Property<int>("Id") | |||
.ValueGeneratedOnAdd() | |||
.HasColumnType("int") | |||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); | |||
b.Property<int>("ClientId") | |||
.HasColumnType("int"); | |||
b.Property<string>("Key") | |||
.IsRequired() | |||
.HasMaxLength(250) | |||
.HasColumnType("nvarchar(250)"); | |||
b.Property<string>("Value") | |||
.IsRequired() | |||
.HasMaxLength(2000) | |||
.HasColumnType("nvarchar(2000)"); | |||
b.HasKey("Id"); | |||
b.HasIndex("ClientId"); | |||
b.ToTable("ClientProperties", (string)null); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientRedirectUri", b => | |||
{ | |||
b.Property<int>("Id") | |||
.ValueGeneratedOnAdd() | |||
.HasColumnType("int") | |||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); | |||
b.Property<int>("ClientId") | |||
.HasColumnType("int"); | |||
b.Property<string>("RedirectUri") | |||
.IsRequired() | |||
.HasMaxLength(2000) | |||
.HasColumnType("nvarchar(2000)"); | |||
b.HasKey("Id"); | |||
b.HasIndex("ClientId"); | |||
b.ToTable("ClientRedirectUris", (string)null); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientScope", b => | |||
{ | |||
b.Property<int>("Id") | |||
.ValueGeneratedOnAdd() | |||
.HasColumnType("int") | |||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); | |||
b.Property<int>("ClientId") | |||
.HasColumnType("int"); | |||
b.Property<string>("Scope") | |||
.IsRequired() | |||
.HasMaxLength(200) | |||
.HasColumnType("nvarchar(200)"); | |||
b.HasKey("Id"); | |||
b.HasIndex("ClientId"); | |||
b.ToTable("ClientScopes", (string)null); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientSecret", b => | |||
{ | |||
b.Property<int>("Id") | |||
.ValueGeneratedOnAdd() | |||
.HasColumnType("int") | |||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); | |||
b.Property<int>("ClientId") | |||
.HasColumnType("int"); | |||
b.Property<DateTime>("Created") | |||
.HasColumnType("datetime2"); | |||
b.Property<string>("Description") | |||
.HasMaxLength(2000) | |||
.HasColumnType("nvarchar(2000)"); | |||
b.Property<DateTime?>("Expiration") | |||
.HasColumnType("datetime2"); | |||
b.Property<string>("Type") | |||
.IsRequired() | |||
.HasMaxLength(250) | |||
.HasColumnType("nvarchar(250)"); | |||
b.Property<string>("Value") | |||
.IsRequired() | |||
.HasMaxLength(4000) | |||
.HasColumnType("nvarchar(4000)"); | |||
b.HasKey("Id"); | |||
b.HasIndex("ClientId"); | |||
b.ToTable("ClientSecrets", (string)null); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityClaim", b => | |||
{ | |||
b.Property<int>("Id") | |||
.ValueGeneratedOnAdd() | |||
.HasColumnType("int") | |||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); | |||
b.Property<int>("IdentityResourceId") | |||
.HasColumnType("int"); | |||
b.Property<string>("Type") | |||
.IsRequired() | |||
.HasMaxLength(200) | |||
.HasColumnType("nvarchar(200)"); | |||
b.HasKey("Id"); | |||
b.HasIndex("IdentityResourceId"); | |||
b.ToTable("IdentityClaims", (string)null); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResource", b => | |||
{ | |||
b.Property<int>("Id") | |||
.ValueGeneratedOnAdd() | |||
.HasColumnType("int") | |||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); | |||
b.Property<DateTime>("Created") | |||
.HasColumnType("datetime2"); | |||
b.Property<string>("Description") | |||
.HasMaxLength(1000) | |||
.HasColumnType("nvarchar(1000)"); | |||
b.Property<string>("DisplayName") | |||
.HasMaxLength(200) | |||
.HasColumnType("nvarchar(200)"); | |||
b.Property<bool>("Emphasize") | |||
.HasColumnType("bit"); | |||
b.Property<bool>("Enabled") | |||
.HasColumnType("bit"); | |||
b.Property<string>("Name") | |||
.IsRequired() | |||
.HasMaxLength(200) | |||
.HasColumnType("nvarchar(200)"); | |||
b.Property<bool>("NonEditable") | |||
.HasColumnType("bit"); | |||
b.Property<bool>("Required") | |||
.HasColumnType("bit"); | |||
b.Property<bool>("ShowInDiscoveryDocument") | |||
.HasColumnType("bit"); | |||
b.Property<DateTime?>("Updated") | |||
.HasColumnType("datetime2"); | |||
b.HasKey("Id"); | |||
b.HasIndex("Name") | |||
.IsUnique(); | |||
b.ToTable("IdentityResources", (string)null); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceProperty", b => | |||
{ | |||
b.Property<int>("Id") | |||
.ValueGeneratedOnAdd() | |||
.HasColumnType("int") | |||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); | |||
b.Property<int>("IdentityResourceId") | |||
.HasColumnType("int"); | |||
b.Property<string>("Key") | |||
.IsRequired() | |||
.HasMaxLength(250) | |||
.HasColumnType("nvarchar(250)"); | |||
b.Property<string>("Value") | |||
.IsRequired() | |||
.HasMaxLength(2000) | |||
.HasColumnType("nvarchar(2000)"); | |||
b.HasKey("Id"); | |||
b.HasIndex("IdentityResourceId"); | |||
b.ToTable("IdentityProperties", (string)null); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceClaim", b => | |||
{ | |||
b.HasOne("IdentityServer4.EntityFramework.Entities.ApiResource", "ApiResource") | |||
.WithMany("UserClaims") | |||
.HasForeignKey("ApiResourceId") | |||
.OnDelete(DeleteBehavior.Cascade) | |||
.IsRequired(); | |||
b.Navigation("ApiResource"); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceProperty", b => | |||
{ | |||
b.HasOne("IdentityServer4.EntityFramework.Entities.ApiResource", "ApiResource") | |||
.WithMany("Properties") | |||
.HasForeignKey("ApiResourceId") | |||
.OnDelete(DeleteBehavior.Cascade) | |||
.IsRequired(); | |||
b.Navigation("ApiResource"); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScope", b => | |||
{ | |||
b.HasOne("IdentityServer4.EntityFramework.Entities.ApiResource", "ApiResource") | |||
.WithMany("Scopes") | |||
.HasForeignKey("ApiResourceId") | |||
.OnDelete(DeleteBehavior.Cascade) | |||
.IsRequired(); | |||
b.Navigation("ApiResource"); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeClaim", b => | |||
{ | |||
b.HasOne("IdentityServer4.EntityFramework.Entities.ApiScope", "ApiScope") | |||
.WithMany("UserClaims") | |||
.HasForeignKey("ApiScopeId") | |||
.OnDelete(DeleteBehavior.Cascade) | |||
.IsRequired(); | |||
b.Navigation("ApiScope"); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiSecret", b => | |||
{ | |||
b.HasOne("IdentityServer4.EntityFramework.Entities.ApiResource", "ApiResource") | |||
.WithMany("Secrets") | |||
.HasForeignKey("ApiResourceId") | |||
.OnDelete(DeleteBehavior.Cascade) | |||
.IsRequired(); | |||
b.Navigation("ApiResource"); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientClaim", b => | |||
{ | |||
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client") | |||
.WithMany("Claims") | |||
.HasForeignKey("ClientId") | |||
.OnDelete(DeleteBehavior.Cascade) | |||
.IsRequired(); | |||
b.Navigation("Client"); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientCorsOrigin", b => | |||
{ | |||
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client") | |||
.WithMany("AllowedCorsOrigins") | |||
.HasForeignKey("ClientId") | |||
.OnDelete(DeleteBehavior.Cascade) | |||
.IsRequired(); | |||
b.Navigation("Client"); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientGrantType", b => | |||
{ | |||
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client") | |||
.WithMany("AllowedGrantTypes") | |||
.HasForeignKey("ClientId") | |||
.OnDelete(DeleteBehavior.Cascade) | |||
.IsRequired(); | |||
b.Navigation("Client"); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientIdPRestriction", b => | |||
{ | |||
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client") | |||
.WithMany("IdentityProviderRestrictions") | |||
.HasForeignKey("ClientId") | |||
.OnDelete(DeleteBehavior.Cascade) | |||
.IsRequired(); | |||
b.Navigation("Client"); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientPostLogoutRedirectUri", b => | |||
{ | |||
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client") | |||
.WithMany("PostLogoutRedirectUris") | |||
.HasForeignKey("ClientId") | |||
.OnDelete(DeleteBehavior.Cascade) | |||
.IsRequired(); | |||
b.Navigation("Client"); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientProperty", b => | |||
{ | |||
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client") | |||
.WithMany("Properties") | |||
.HasForeignKey("ClientId") | |||
.OnDelete(DeleteBehavior.Cascade) | |||
.IsRequired(); | |||
b.Navigation("Client"); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientRedirectUri", b => | |||
{ | |||
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client") | |||
.WithMany("RedirectUris") | |||
.HasForeignKey("ClientId") | |||
.OnDelete(DeleteBehavior.Cascade) | |||
.IsRequired(); | |||
b.Navigation("Client"); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientScope", b => | |||
{ | |||
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client") | |||
.WithMany("AllowedScopes") | |||
.HasForeignKey("ClientId") | |||
.OnDelete(DeleteBehavior.Cascade) | |||
.IsRequired(); | |||
b.Navigation("Client"); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientSecret", b => | |||
{ | |||
b.HasOne("IdentityServer4.EntityFramework.Entities.Client", "Client") | |||
.WithMany("ClientSecrets") | |||
.HasForeignKey("ClientId") | |||
.OnDelete(DeleteBehavior.Cascade) | |||
.IsRequired(); | |||
b.Navigation("Client"); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityClaim", b => | |||
{ | |||
b.HasOne("IdentityServer4.EntityFramework.Entities.IdentityResource", "IdentityResource") | |||
.WithMany("UserClaims") | |||
.HasForeignKey("IdentityResourceId") | |||
.OnDelete(DeleteBehavior.Cascade) | |||
.IsRequired(); | |||
b.Navigation("IdentityResource"); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceProperty", b => | |||
{ | |||
b.HasOne("IdentityServer4.EntityFramework.Entities.IdentityResource", "IdentityResource") | |||
.WithMany("Properties") | |||
.HasForeignKey("IdentityResourceId") | |||
.OnDelete(DeleteBehavior.Cascade) | |||
.IsRequired(); | |||
b.Navigation("IdentityResource"); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResource", b => | |||
{ | |||
b.Navigation("Properties"); | |||
b.Navigation("Scopes"); | |||
b.Navigation("Secrets"); | |||
b.Navigation("UserClaims"); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScope", b => | |||
{ | |||
b.Navigation("UserClaims"); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.Client", b => | |||
{ | |||
b.Navigation("AllowedCorsOrigins"); | |||
b.Navigation("AllowedGrantTypes"); | |||
b.Navigation("AllowedScopes"); | |||
b.Navigation("Claims"); | |||
b.Navigation("ClientSecrets"); | |||
b.Navigation("IdentityProviderRestrictions"); | |||
b.Navigation("PostLogoutRedirectUris"); | |||
b.Navigation("Properties"); | |||
b.Navigation("RedirectUris"); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResource", b => | |||
{ | |||
b.Navigation("Properties"); | |||
b.Navigation("UserClaims"); | |||
}); | |||
#pragma warning restore 612, 618 | |||
} | |||
} | |||
} |
@ -1,108 +0,0 @@ | |||
// <auto-generated /> | |||
using System; | |||
using IdentityServer4.EntityFramework.DbContexts; | |||
using Microsoft.EntityFrameworkCore; | |||
using Microsoft.EntityFrameworkCore.Infrastructure; | |||
using Microsoft.EntityFrameworkCore.Metadata; | |||
using Microsoft.EntityFrameworkCore.Migrations; | |||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; | |||
namespace Identity.API.Migrations.PersistedGrantDb | |||
{ | |||
[DbContext(typeof(PersistedGrantDbContext))] | |||
[Migration("20210813072513_InitialMigration")] | |||
partial class InitialMigration | |||
{ | |||
protected override void BuildTargetModel(ModelBuilder modelBuilder) | |||
{ | |||
#pragma warning disable 612, 618 | |||
modelBuilder | |||
.HasAnnotation("Relational:MaxIdentifierLength", 128) | |||
.HasAnnotation("ProductVersion", "6.0.0") | |||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b => | |||
{ | |||
b.Property<string>("UserCode") | |||
.HasMaxLength(200) | |||
.HasColumnType("nvarchar(200)"); | |||
b.Property<string>("ClientId") | |||
.IsRequired() | |||
.HasMaxLength(200) | |||
.HasColumnType("nvarchar(200)"); | |||
b.Property<DateTime>("CreationTime") | |||
.HasColumnType("datetime2"); | |||
b.Property<string>("Data") | |||
.IsRequired() | |||
.HasMaxLength(50000) | |||
.HasColumnType("nvarchar(max)"); | |||
b.Property<string>("DeviceCode") | |||
.IsRequired() | |||
.HasMaxLength(200) | |||
.HasColumnType("nvarchar(200)"); | |||
b.Property<DateTime?>("Expiration") | |||
.IsRequired() | |||
.HasColumnType("datetime2"); | |||
b.Property<string>("SubjectId") | |||
.HasMaxLength(200) | |||
.HasColumnType("nvarchar(200)"); | |||
b.HasKey("UserCode"); | |||
b.HasIndex("DeviceCode") | |||
.IsUnique(); | |||
b.HasIndex("Expiration"); | |||
b.ToTable("DeviceCodes", (string)null); | |||
}); | |||
modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b => | |||
{ | |||
b.Property<string>("Key") | |||
.HasMaxLength(200) | |||
.HasColumnType("nvarchar(200)"); | |||
b.Property<string>("ClientId") | |||
.IsRequired() | |||
.HasMaxLength(200) | |||
.HasColumnType("nvarchar(200)"); | |||
b.Property<DateTime>("CreationTime") | |||
.HasColumnType("datetime2"); | |||
b.Property<string>("Data") | |||
.IsRequired() | |||
.HasMaxLength(50000) | |||
.HasColumnType("nvarchar(max)"); | |||
b.Property<DateTime?>("Expiration") | |||
.HasColumnType("datetime2"); | |||
b.Property<string>("SubjectId") | |||
.HasMaxLength(200) | |||
.HasColumnType("nvarchar(200)"); | |||
b.Property<string>("Type") | |||
.IsRequired() | |||
.HasMaxLength(50) | |||
.HasColumnType("nvarchar(50)"); | |||
b.HasKey("Key"); | |||
b.HasIndex("Expiration"); | |||
b.HasIndex("SubjectId", "ClientId", "Type"); | |||
b.ToTable("PersistedGrants", (string)null); | |||
}); | |||
#pragma warning restore 612, 618 | |||
} | |||
} | |||
} |
@ -1,75 +0,0 @@ | |||
using System; | |||
using Microsoft.EntityFrameworkCore.Migrations; | |||
namespace Identity.API.Migrations.PersistedGrantDb | |||
{ | |||
public partial class InitialMigration : Migration | |||
{ | |||
protected override void Up(MigrationBuilder migrationBuilder) | |||
{ | |||
migrationBuilder.CreateTable( | |||
name: "DeviceCodes", | |||
columns: table => new | |||
{ | |||
UserCode = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false), | |||
DeviceCode = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false), | |||
SubjectId = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true), | |||
ClientId = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false), | |||
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), | |||
Expiration = table.Column<DateTime>(type: "datetime2", nullable: false), | |||
Data = table.Column<string>(type: "nvarchar(max)", maxLength: 50000, nullable: false) | |||
}, | |||
constraints: table => | |||
{ | |||
table.PrimaryKey("PK_DeviceCodes", x => x.UserCode); | |||
}); | |||
migrationBuilder.CreateTable( | |||
name: "PersistedGrants", | |||
columns: table => new | |||
{ | |||
Key = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false), | |||
Type = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false), | |||
SubjectId = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true), | |||
ClientId = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false), | |||
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), | |||
Expiration = table.Column<DateTime>(type: "datetime2", nullable: true), | |||
Data = table.Column<string>(type: "nvarchar(max)", maxLength: 50000, nullable: false) | |||
}, | |||
constraints: table => | |||
{ | |||
table.PrimaryKey("PK_PersistedGrants", x => x.Key); | |||
}); | |||
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_PersistedGrants_Expiration", | |||
table: "PersistedGrants", | |||
column: "Expiration"); | |||
migrationBuilder.CreateIndex( | |||
name: "IX_PersistedGrants_SubjectId_ClientId_Type", | |||
table: "PersistedGrants", | |||
columns: new[] { "SubjectId", "ClientId", "Type" }); | |||
} | |||
protected override void Down(MigrationBuilder migrationBuilder) | |||
{ | |||
migrationBuilder.DropTable( | |||
name: "DeviceCodes"); | |||
migrationBuilder.DropTable( | |||
name: "PersistedGrants"); | |||
} | |||
} | |||
} |
@ -0,0 +1,240 @@ | |||
// <auto-generated /> | |||
using System; | |||
using Duende.IdentityServer.EntityFramework.DbContexts; | |||
using Microsoft.EntityFrameworkCore; | |||
using Microsoft.EntityFrameworkCore.Infrastructure; | |||
using Microsoft.EntityFrameworkCore.Metadata; | |||
using Microsoft.EntityFrameworkCore.Migrations; | |||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; | |||
#nullable disable | |||
namespace Identity.API.Migrations.PersistedGrantDb | |||
{ | |||
[DbContext(typeof(PersistedGrantDbContext))] | |||
[Migration("20220324152905_Grants")] | |||
partial class Grants | |||
{ | |||
protected override void BuildTargetModel(ModelBuilder modelBuilder) | |||
{ | |||
#pragma warning disable 612, 618 | |||
modelBuilder | |||
.HasAnnotation("ProductVersion", "6.0.0") | |||
.HasAnnotation("Relational:MaxIdentifierLength", 128); | |||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); | |||
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", b => | |||
{ | |||
b.Property<string>("UserCode") | |||
.HasMaxLength(200) | |||
.HasColumnType("nvarchar(200)"); | |||
b.Property<string>("ClientId") | |||
.IsRequired() | |||
.HasMaxLength(200) | |||
.HasColumnType("nvarchar(200)"); | |||
b.Property<DateTime>("CreationTime") | |||
.HasColumnType("datetime2"); | |||
b.Property<string>("Data") | |||
.IsRequired() | |||
.HasMaxLength(50000) | |||
.HasColumnType("nvarchar(max)"); | |||
b.Property<string>("Description") | |||
.HasMaxLength(200) | |||
.HasColumnType("nvarchar(200)"); | |||
b.Property<string>("DeviceCode") | |||
.IsRequired() | |||
.HasMaxLength(200) | |||
.HasColumnType("nvarchar(200)"); | |||
b.Property<DateTime?>("Expiration") | |||
.IsRequired() | |||
.HasColumnType("datetime2"); | |||
b.Property<string>("SessionId") | |||
.HasMaxLength(100) | |||
.HasColumnType("nvarchar(100)"); | |||
b.Property<string>("SubjectId") | |||
.HasMaxLength(200) | |||
.HasColumnType("nvarchar(200)"); | |||
b.HasKey("UserCode"); | |||
b.HasIndex("DeviceCode") | |||
.IsUnique(); | |||
b.HasIndex("Expiration"); | |||
b.ToTable("DeviceCodes", (string)null); | |||
}); | |||
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.Key", b => | |||
{ | |||
b.Property<string>("Id") | |||
.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)"); | |||
b.Property<bool>("DataProtected") | |||
.HasColumnType("bit"); | |||
b.Property<bool>("IsX509Certificate") | |||
.HasColumnType("bit"); | |||
b.Property<string>("Use") | |||
.HasColumnType("nvarchar(450)"); | |||
b.Property<int>("Version") | |||
.HasColumnType("int"); | |||
b.HasKey("Id"); | |||
b.HasIndex("Use"); | |||
b.ToTable("Keys", (string)null); | |||
}); | |||
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", b => | |||
{ | |||
b.Property<long>("Id") | |||
.ValueGeneratedOnAdd() | |||
.HasColumnType("bigint"); | |||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"), 1L, 1); | |||
b.Property<string>("ClientId") | |||
.IsRequired() | |||
.HasMaxLength(200) | |||
.HasColumnType("nvarchar(200)"); | |||
b.Property<DateTime?>("ConsumedTime") | |||
.HasColumnType("datetime2"); | |||
b.Property<DateTime>("CreationTime") | |||
.HasColumnType("datetime2"); | |||
b.Property<string>("Data") | |||
.IsRequired() | |||
.HasMaxLength(50000) | |||
.HasColumnType("nvarchar(max)"); | |||
b.Property<string>("Description") | |||
.HasMaxLength(200) | |||
.HasColumnType("nvarchar(200)"); | |||
b.Property<DateTime?>("Expiration") | |||
.HasColumnType("datetime2"); | |||
b.Property<string>("Key") | |||
.HasMaxLength(200) | |||
.HasColumnType("nvarchar(200)"); | |||
b.Property<string>("SessionId") | |||
.HasMaxLength(100) | |||
.HasColumnType("nvarchar(100)"); | |||
b.Property<string>("SubjectId") | |||
.HasMaxLength(200) | |||
.HasColumnType("nvarchar(200)"); | |||
b.Property<string>("Type") | |||
.IsRequired() | |||
.HasMaxLength(50) | |||
.HasColumnType("nvarchar(50)"); | |||
b.HasKey("Id"); | |||
b.HasIndex("ConsumedTime"); | |||
b.HasIndex("Expiration"); | |||
b.HasIndex("Key") | |||
.IsUnique() | |||
.HasFilter("[Key] IS NOT NULL"); | |||
b.HasIndex("SubjectId", "ClientId", "Type"); | |||
b.HasIndex("SubjectId", "SessionId", "Type"); | |||
b.ToTable("PersistedGrants", (string)null); | |||
}); | |||
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ServerSideSession", b => | |||
{ | |||
b.Property<int>("Id") | |||
.ValueGeneratedOnAdd() | |||
.HasColumnType("int"); | |||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1); | |||
b.Property<DateTime>("Created") | |||
.HasColumnType("datetime2"); | |||
b.Property<string>("Data") | |||
.IsRequired() | |||
.HasColumnType("nvarchar(max)"); | |||
b.Property<string>("DisplayName") | |||
.HasMaxLength(100) | |||
.HasColumnType("nvarchar(100)"); | |||
b.Property<DateTime?>("Expires") | |||
.HasColumnType("datetime2"); | |||
b.Property<string>("Key") | |||
.IsRequired() | |||
.HasMaxLength(100) | |||
.HasColumnType("nvarchar(100)"); | |||
b.Property<DateTime>("Renewed") | |||
.HasColumnType("datetime2"); | |||
b.Property<string>("Scheme") | |||
.IsRequired() | |||
.HasMaxLength(100) | |||
.HasColumnType("nvarchar(100)"); | |||
b.Property<string>("SessionId") | |||
.HasMaxLength(100) | |||
.HasColumnType("nvarchar(100)"); | |||
b.Property<string>("SubjectId") | |||
.IsRequired() | |||
.HasMaxLength(100) | |||
.HasColumnType("nvarchar(100)"); | |||
b.HasKey("Id"); | |||
b.HasIndex("DisplayName"); | |||
b.HasIndex("Expires"); | |||
b.HasIndex("Key") | |||
.IsUnique(); | |||
b.HasIndex("SessionId"); | |||
b.HasIndex("SubjectId"); | |||
b.ToTable("ServerSideSessions", (string)null); | |||
}); | |||
#pragma warning restore 612, 618 | |||
} | |||
} | |||
} |
@ -0,0 +1,177 @@ | |||
using System; | |||
using Microsoft.EntityFrameworkCore.Migrations; | |||
#nullable disable | |||
namespace Identity.API.Migrations.PersistedGrantDb | |||
{ | |||
public partial class Grants : Migration | |||
{ | |||
protected override void Up(MigrationBuilder migrationBuilder) | |||
{ | |||
migrationBuilder.CreateTable( | |||
name: "DeviceCodes", | |||
columns: table => new | |||
{ | |||
UserCode = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false), | |||
DeviceCode = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false), | |||
SubjectId = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true), | |||
SessionId = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true), | |||
ClientId = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false), | |||
Description = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true), | |||
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), | |||
Expiration = table.Column<DateTime>(type: "datetime2", nullable: false), | |||
Data = table.Column<string>(type: "nvarchar(max)", maxLength: 50000, nullable: false) | |||
}, | |||
constraints: table => | |||
{ | |||
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)", 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)", nullable: false) | |||
}, | |||
constraints: table => | |||
{ | |||
table.PrimaryKey("PK_Keys", x => x.Id); | |||
}); | |||
migrationBuilder.CreateTable( | |||
name: "PersistedGrants", | |||
columns: table => new | |||
{ | |||
Id = table.Column<long>(type: "bigint", nullable: false) | |||
.Annotation("SqlServer:Identity", "1, 1"), | |||
Key = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true), | |||
Type = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false), | |||
SubjectId = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true), | |||
SessionId = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true), | |||
ClientId = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false), | |||
Description = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true), | |||
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), | |||
Expiration = table.Column<DateTime>(type: "datetime2", nullable: true), | |||
ConsumedTime = table.Column<DateTime>(type: "datetime2", nullable: true), | |||
Data = table.Column<string>(type: "nvarchar(max)", maxLength: 50000, nullable: false) | |||
}, | |||
constraints: table => | |||
{ | |||
table.PrimaryKey("PK_PersistedGrants", x => x.Id); | |||
}); | |||
migrationBuilder.CreateTable( | |||
name: "ServerSideSessions", | |||
columns: table => new | |||
{ | |||
Id = table.Column<int>(type: "int", nullable: false) | |||
.Annotation("SqlServer:Identity", "1, 1"), | |||
Key = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false), | |||
Scheme = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false), | |||
SubjectId = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false), | |||
SessionId = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true), | |||
DisplayName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true), | |||
Created = table.Column<DateTime>(type: "datetime2", nullable: false), | |||
Renewed = table.Column<DateTime>(type: "datetime2", nullable: false), | |||
Expires = table.Column<DateTime>(type: "datetime2", nullable: true), | |||
Data = table.Column<string>(type: "nvarchar(max)", nullable: false) | |||
}, | |||
constraints: table => | |||
{ | |||
table.PrimaryKey("PK_ServerSideSessions", x => x.Id); | |||
}); | |||
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_Key", | |||
table: "PersistedGrants", | |||
column: "Key", | |||
unique: true, | |||
filter: "[Key] IS NOT NULL"); | |||
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" }); | |||
migrationBuilder.CreateIndex( | |||
name: "IX_ServerSideSessions_DisplayName", | |||
table: "ServerSideSessions", | |||
column: "DisplayName"); | |||
migrationBuilder.CreateIndex( | |||
name: "IX_ServerSideSessions_Expires", | |||
table: "ServerSideSessions", | |||
column: "Expires"); | |||
migrationBuilder.CreateIndex( | |||
name: "IX_ServerSideSessions_Key", | |||
table: "ServerSideSessions", | |||
column: "Key", | |||
unique: true); | |||
migrationBuilder.CreateIndex( | |||
name: "IX_ServerSideSessions_SessionId", | |||
table: "ServerSideSessions", | |||
column: "SessionId"); | |||
migrationBuilder.CreateIndex( | |||
name: "IX_ServerSideSessions_SubjectId", | |||
table: "ServerSideSessions", | |||
column: "SubjectId"); | |||
} | |||
protected override void Down(MigrationBuilder migrationBuilder) | |||
{ | |||
migrationBuilder.DropTable( | |||
name: "DeviceCodes"); | |||
migrationBuilder.DropTable( | |||
name: "Keys"); | |||
migrationBuilder.DropTable( | |||
name: "PersistedGrants"); | |||
migrationBuilder.DropTable( | |||
name: "ServerSideSessions"); | |||
} | |||
} | |||
} |
@ -1,10 +0,0 @@ | |||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels | |||
{ | |||
public record ConsentInputModel | |||
{ | |||
public string Button { get; init; } | |||
public IEnumerable<string> ScopesConsented { get; init; } | |||
public bool RememberConsent { get; init; } | |||
public string ReturnUrl { get; init; } | |||
} | |||
} |
@ -1,61 +0,0 @@ | |||
using IdentityServer4.Models; | |||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels | |||
{ | |||
public record ConsentViewModel : ConsentInputModel | |||
{ | |||
public ConsentViewModel(ConsentInputModel model, string returnUrl, AuthorizationRequest request, Client client, Resources resources) | |||
{ | |||
RememberConsent = model?.RememberConsent ?? true; | |||
ScopesConsented = model?.ScopesConsented ?? Enumerable.Empty<string>(); | |||
ReturnUrl = returnUrl; | |||
ClientName = client.ClientName; | |||
ClientUrl = client.ClientUri; | |||
ClientLogoUrl = client.LogoUri; | |||
AllowRememberConsent = client.AllowRememberConsent; | |||
IdentityScopes = resources.IdentityResources.Select(x => new ScopeViewModel(x, ScopesConsented.Contains(x.Name) || model == null)).ToArray(); | |||
ResourceScopes = resources.ApiResources.SelectMany(x => x.Scopes).Select(x => new ScopeViewModel(x, ScopesConsented.Contains(x.Name) || model == null)).ToArray(); | |||
} | |||
public string ClientName { get; init; } | |||
public string ClientUrl { get; init; } | |||
public string ClientLogoUrl { get; init; } | |||
public bool AllowRememberConsent { get; init; } | |||
public IEnumerable<ScopeViewModel> IdentityScopes { get; init; } | |||
public IEnumerable<ScopeViewModel> ResourceScopes { get; init; } | |||
} | |||
public record ScopeViewModel | |||
{ | |||
public ScopeViewModel(Scope scope, bool check) | |||
{ | |||
Name = scope.Name; | |||
DisplayName = scope.DisplayName; | |||
Description = scope.Description; | |||
Emphasize = scope.Emphasize; | |||
Required = scope.Required; | |||
Checked = check || scope.Required; | |||
} | |||
public ScopeViewModel(IdentityResource identity, bool check) | |||
{ | |||
Name = identity.Name; | |||
DisplayName = identity.DisplayName; | |||
Description = identity.Description; | |||
Emphasize = identity.Emphasize; | |||
Required = identity.Required; | |||
Checked = check || identity.Required; | |||
} | |||
public string Name { get; init; } | |||
public string DisplayName { get; init; } | |||
public string Description { get; init; } | |||
public bool Emphasize { get; init; } | |||
public bool Required { get; init; } | |||
public bool Checked { get; init; } | |||
} | |||
} |
@ -0,0 +1,7 @@ | |||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels | |||
{ | |||
public class RedirectViewModel | |||
{ | |||
public string RedirectUrl { get; set; } | |||
} | |||
} |
@ -0,0 +1,13 @@ | |||
using System.Collections.Generic; | |||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ConsentViewModels | |||
{ | |||
public class ConsentInputModel | |||
{ | |||
public string Button { get; set; } | |||
public IEnumerable<string> ScopesConsented { get; set; } | |||
public bool RememberConsent { get; set; } | |||
public string ReturnUrl { get; set; } | |||
public string Description { get; set; } | |||
} | |||
} |
@ -0,0 +1,12 @@ | |||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ConsentViewModels | |||
{ | |||
public class ConsentOptions | |||
{ | |||
public static bool EnableOfflineAccess = true; | |||
public static string OfflineAccessDisplayName = "Offline Access"; | |||
public static string OfflineAccessDescription = "Access to your applications and resources, even when you are offline"; | |||
public static readonly string MustChooseOneErrorMessage = "You must pick at least one permission"; | |||
public static readonly string InvalidSelectionErrorMessage = "Invalid selection"; | |||
} | |||
} |
@ -0,0 +1,15 @@ | |||
using System.Collections.Generic; | |||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ConsentViewModels | |||
{ | |||
public class ConsentViewModel : ConsentInputModel | |||
{ | |||
public string ClientName { get; set; } | |||
public string ClientUrl { get; set; } | |||
public string ClientLogoUrl { get; set; } | |||
public bool AllowRememberConsent { get; set; } | |||
public IEnumerable<ScopeViewModel> IdentityScopes { get; set; } | |||
public IEnumerable<ScopeViewModel> ApiScopes { get; set; } | |||
} | |||
} |
@ -0,0 +1,17 @@ | |||
using Duende.IdentityServer.Models; | |||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ConsentViewModels | |||
{ | |||
public class ProcessConsentResult | |||
{ | |||
public bool IsRedirect => RedirectUri != null; | |||
public string RedirectUri { get; set; } | |||
public Client Client { get; set; } | |||
public bool ShowView => ViewModel != null; | |||
public ConsentViewModel ViewModel { get; set; } | |||
public bool HasValidationError => ValidationError != null; | |||
public string ValidationError { get; set; } | |||
} | |||
} |
@ -0,0 +1,12 @@ | |||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ConsentViewModels | |||
{ | |||
public class ScopeViewModel | |||
{ | |||
public string Value { get; set; } | |||
public string DisplayName { get; set; } | |||
public string Description { get; set; } | |||
public bool Emphasize { get; set; } | |||
public bool Required { get; set; } | |||
public bool Checked { get; set; } | |||
} | |||
} |
@ -1,82 +1,104 @@ | |||
@model Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels.ConsentViewModel | |||
@model Microsoft.eShopOnContainers.Services.Identity.API.Models.ConsentViewModels.ConsentViewModel | |||
<div class="container page-consent"> | |||
<div class="row page-header"> | |||
<div class="col-sm-10"> | |||
@if (Model.ClientLogoUrl != null) | |||
{ | |||
<div class="client-logo"><img src="@Model.ClientLogoUrl"></div> | |||
} | |||
<h1> | |||
@Model.ClientName | |||
<small>is requesting your permission</small> | |||
</h1> | |||
</div> | |||
<div class="page-consent"> | |||
<div class="lead"> | |||
@if (Model.ClientLogoUrl != null) | |||
{ | |||
<div class="client-logo"><img src="@Model.ClientLogoUrl"></div> | |||
} | |||
<h1> | |||
@Model.ClientName | |||
<small class="text-muted">is requesting your permission</small> | |||
</h1> | |||
<p>Uncheck the permissions you do not wish to grant.</p> | |||
</div> | |||
<div class="row"> | |||
<div class="col-sm-8"> | |||
<partial name="_ValidationSummary"/> | |||
<form asp-action="Index" class="consent-form"> | |||
<input type="hidden" asp-for="ReturnUrl" /> | |||
<partial name="_ValidationSummary" /> | |||
</div> | |||
</div> | |||
<div>Uncheck the permissions you do not wish to grant.</div> | |||
<form asp-action="Index"> | |||
<input type="hidden" asp-for="ReturnUrl" /> | |||
<div class="row"> | |||
<div class="col-sm-8"> | |||
@if (Model.IdentityScopes.Any()) | |||
{ | |||
<div class="panel panel-default consent-buttons"> | |||
<div class="panel-heading"> | |||
<span class="glyphicon glyphicon-user"></span> | |||
Personal Information | |||
<div class="form-group"> | |||
<div class="card"> | |||
<div class="card-header"> | |||
<span class="glyphicon glyphicon-user"></span> | |||
Personal Information | |||
</div> | |||
<ul class="list-group list-group-flush"> | |||
@foreach (var scope in Model.IdentityScopes) | |||
{ | |||
<partial name="_ScopeListItem" model="@scope" /> | |||
} | |||
</ul> | |||
</div> | |||
<ul class="list-group"> | |||
@foreach (var scope in Model.IdentityScopes) | |||
{ | |||
<partial name="_ScopeListItem" model="scope"/> | |||
} | |||
</ul> | |||
</div> | |||
} | |||
@if (Model.ResourceScopes.Any()) | |||
@if (Model.ApiScopes.Any()) | |||
{ | |||
<div class="panel panel-default"> | |||
<div class="panel-heading"> | |||
<span class="glyphicon glyphicon-tasks"></span> | |||
Application Access | |||
<div class="form-group"> | |||
<div class="card"> | |||
<div class="card-header"> | |||
<span class="glyphicon glyphicon-tasks"></span> | |||
Application Access | |||
</div> | |||
<ul class="list-group list-group-flush"> | |||
@foreach (var scope in Model.ApiScopes) | |||
{ | |||
<partial name="_ScopeListItem" model="scope" /> | |||
} | |||
</ul> | |||
</div> | |||
<ul class="list-group"> | |||
@foreach (var scope in Model.ResourceScopes) | |||
{ | |||
<partial name="_ScopeListItem" model="scope"/> | |||
} | |||
</ul> | |||
</div> | |||
} | |||
<div class="form-group"> | |||
<div class="card"> | |||
<div class="card-header"> | |||
<span class="glyphicon glyphicon-tasks"></span> | |||
Description | |||
</div> | |||
<div class="card-body"> | |||
<input class="form-control" placeholder="Description or name of device" asp-for="Description" autofocus> | |||
</div> | |||
</div> | |||
</div> | |||
@if (Model.AllowRememberConsent) | |||
{ | |||
<div class="consent-remember"> | |||
<label> | |||
<input class="consent-scopecheck" asp-for="RememberConsent" /> | |||
<strong>Remember My Decision</strong> | |||
</label> | |||
<div class="form-group"> | |||
<div class="form-check"> | |||
<input class="form-check-input" asp-for="RememberConsent"> | |||
<label class="form-check-label" asp-for="RememberConsent"> | |||
<strong>Remember My Decision</strong> | |||
</label> | |||
</div> | |||
</div> | |||
} | |||
</div> | |||
</div> | |||
<div class="consent-buttons"> | |||
<button name="button" value="yes" class="btn btn-primary" autofocus>Yes, Allow</button> | |||
<button name="button" value="no" class="btn">No, Do Not Allow</button> | |||
@if (Model.ClientUrl != null) | |||
{ | |||
<a class="pull-right btn btn-default" target="_blank" href="@Model.ClientUrl"> | |||
<span class="glyphicon glyphicon-info-sign"></span> | |||
<strong>@Model.ClientName</strong> | |||
</a> | |||
} | |||
</div> | |||
</form> | |||
<div class="row"> | |||
<div class="col-sm-4"> | |||
<button name="button" value="yes" class="btn btn-primary" autofocus>Yes, Allow</button> | |||
<button name="button" value="no" class="btn btn-secondary">No, Do Not Allow</button> | |||
</div> | |||
<div class="col-sm-4 col-lg-auto"> | |||
@if (Model.ClientUrl != null) | |||
{ | |||
<a class="btn btn-outline-info" href="@Model.ClientUrl"> | |||
<span class="glyphicon glyphicon-info-sign"></span> | |||
<strong>@Model.ClientName</strong> | |||
</a> | |||
} | |||
</div> | |||
</div> | |||
</div> | |||
</form> | |||
</div> |