Add project files.

This commit is contained in:
Khwezi Mngoma
2026-06-05 22:07:25 +02:00
parent 59ea7de742
commit 437e8c5c08
978 changed files with 151911 additions and 0 deletions
@@ -0,0 +1,266 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts;
#nullable disable
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.AdminConfiguration
{
[DbContext(typeof(AdminConfigurationDbContext))]
[Migration("20251216091509_AdminConfigurationUpdate")]
partial class AdminConfigurationUpdate
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.10")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Skoruba.Duende.IdentityServer.Admin.EntityFramework.Admin.Storage.Entities.ConfigurationRule", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Configuration")
.HasMaxLength(2000)
.HasColumnType("character varying(2000)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("FixDescription")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<bool>("IsEnabled")
.HasColumnType("boolean");
b.Property<int>("IssueType")
.HasColumnType("integer");
b.Property<string>("MessageTemplate")
.HasMaxLength(500)
.HasColumnType("character varying(500)");
b.Property<int>("ResourceType")
.HasColumnType("integer");
b.Property<int>("RuleType")
.HasColumnType("integer");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("RuleType")
.IsUnique();
b.ToTable("ConfigurationRules");
b.HasData(
new
{
Id = 1,
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to Client Details → Advanced tab → Grant Types, remove 'implicit' and add 'authorization_code' instead.",
IsEnabled = true,
IssueType = 2,
MessageTemplate = "Client uses obsolete implicit grant flow",
ResourceType = 0,
RuleType = 0
},
new
{
Id = 2,
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to Client Details → Advanced tab → Grant Types, remove 'password' and add 'authorization_code' or 'client_credentials' instead.",
IsEnabled = true,
IssueType = 2,
MessageTemplate = "Client uses obsolete password grant flow",
ResourceType = 0,
RuleType = 1
},
new
{
Id = 3,
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to Client Details → Advanced tab → Authentication, scroll down and enable 'Require Proof Key for Code Exchange (PKCE)' toggle.",
IsEnabled = true,
IssueType = 0,
MessageTemplate = "Client uses authorization code flow without PKCE",
ResourceType = 0,
RuleType = 2
},
new
{
Id = 4,
Configuration = "{\"minScopes\": 1}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to Client Details → Resources tab → Allowed Scopes section and add at least one scope from the available list.",
IsEnabled = true,
IssueType = 2,
MessageTemplate = "Client '{clientName}' has {actualCount} allowed scope(s), but requires at least {requiredCount}",
ResourceType = 0,
RuleType = 4
},
new
{
Id = 5,
Configuration = "{\"minScopes\": 1}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to API Resource Details → Scopes section and add at least one scope to this API Resource.",
IsEnabled = true,
IssueType = 2,
MessageTemplate = "API Resource '{resourceName}' has {actualCount} scope(s), but requires at least {requiredCount}",
ResourceType = 2,
RuleType = 10
},
new
{
Id = 6,
Configuration = "{\"allowLocalhost\": true}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to Client Details → URLs tab → Redirect URIs section and update all HTTP URIs to use HTTPS protocol.",
IsEnabled = false,
IssueType = 2,
MessageTemplate = "Client has {count} non-HTTPS redirect URI(s): {uris}",
ResourceType = 0,
RuleType = 3
},
new
{
Id = 7,
Configuration = "{\"maxLifetimeSeconds\": 3600}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to Client Details → Advanced tab → Token, find 'Access Token Lifetime' field and reduce the value to {maxLifetime} seconds or less.",
IsEnabled = false,
IssueType = 0,
MessageTemplate = "Access token lifetime {actualLifetime}s exceeds maximum {maxLifetime}s",
ResourceType = 0,
RuleType = 5
},
new
{
Id = 8,
Configuration = "{\"maxLifetimeSeconds\": 2592000}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to Client Details → Advanced tab → Token, find 'Refresh Token Lifetime' field and reduce the value to {maxLifetime} seconds or less.",
IsEnabled = false,
IssueType = 0,
MessageTemplate = "Client '{clientName}' refresh token lifetime {actualLifetime}s exceeds maximum {maxLifetime}s",
ResourceType = 0,
RuleType = 6
},
new
{
Id = 9,
Configuration = "{\"prefixes\": [\"scope_\"]}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to API Scope Details → Basic Information section and rename the scope to start with one of the required prefixes: {allowedPrefixes}.",
IsEnabled = false,
IssueType = 0,
MessageTemplate = "API Scope '{actualName}' must start with one of: {allowedPrefixes}",
ResourceType = 3,
RuleType = 7
},
new
{
Id = 10,
Configuration = "{\"forbiddenStrings\": [\"test\", \"temp\", \"debug\"]}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to API Scope Details → Basic Information section and rename the scope to remove forbidden strings from the name.",
IsEnabled = false,
IssueType = 0,
MessageTemplate = "API Scope '{scopeName}' contains forbidden string(s): {forbiddenStrings}",
ResourceType = 3,
RuleType = 8
},
new
{
Id = 11,
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to API Scope Details → Basic Information section and add a user-friendly Display Name.",
IsEnabled = false,
IssueType = 1,
MessageTemplate = "API Scope is missing a display name",
ResourceType = 3,
RuleType = 9
},
new
{
Id = 12,
Configuration = "{\"prefixes\": [\"api.\"]}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to API Resource Details → Basic Information section and rename the resource to follow the naming convention.",
IsEnabled = false,
IssueType = 0,
MessageTemplate = "API Resource '{actualName}' must start with one of: {allowedPrefixes}",
ResourceType = 2,
RuleType = 11
},
new
{
Id = 13,
Configuration = "{\"requiredResources\": [\"openid\", \"profile\"]}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to Identity Resource Details → Basic Information section and enable the 'Enabled' toggle.",
IsEnabled = false,
IssueType = 0,
MessageTemplate = "Required identity resource '{resourceName}' ({displayName}) is disabled",
ResourceType = 1,
RuleType = 12
},
new
{
Id = 14,
Configuration = "{\"prefixes\": [\"custom.\"], \"excludeStandard\": true}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to Identity Resource Details → Basic Information section and rename the resource to follow the naming convention.",
IsEnabled = false,
IssueType = 0,
MessageTemplate = "Identity Resource '{actualName}' must start with one of: {allowedPrefixes}",
ResourceType = 1,
RuleType = 13
},
new
{
Id = 15,
Configuration = "{\"excludeScopes\": [\"openid\", \"profile\", \"email\", \"address\", \"phone\", \"offline_access\"]}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "This API Scope '{scopeName}' is not used by any clients or API resources. Consider removing it from API Scopes list or assigning it to relevant clients/resources.",
IsEnabled = false,
IssueType = 1,
MessageTemplate = "API Scope '{scopeName}'{displayNameSuffix} is not used by any clients or API resources",
ResourceType = 3,
RuleType = 14
},
new
{
Id = 16,
Configuration = "{\"warningDays\": 30, \"includeAlreadyExpired\": true}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to Client Details → Advanced tab → Authentication → Secrets section, remove the expired secret and add a new one with proper expiration date.",
IsEnabled = false,
IssueType = 0,
MessageTemplate = "Client '{clientName}' has a secret ({secretType}) that {status} in {daysUntilExpiry} day(s) on {expirationDate}",
ResourceType = 0,
RuleType = 15
});
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,75 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.AdminConfiguration
{
/// <inheritdoc />
public partial class AdminConfigurationUpdate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ConfigurationRules",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
RuleType = table.Column<int>(type: "integer", nullable: false),
ResourceType = table.Column<int>(type: "integer", nullable: false),
IssueType = table.Column<int>(type: "integer", nullable: false),
IsEnabled = table.Column<bool>(type: "boolean", nullable: false),
Configuration = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: true),
MessageTemplate = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: true),
FixDescription = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true),
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ConfigurationRules", x => x.Id);
});
migrationBuilder.InsertData(
table: "ConfigurationRules",
columns: new[] { "Id", "Configuration", "CreatedAt", "FixDescription", "IsEnabled", "IssueType", "MessageTemplate", "ResourceType", "RuleType", "UpdatedAt" },
values: new object[,]
{
{ 1, null, new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Navigate to Client Details → Advanced tab → Grant Types, remove 'implicit' and add 'authorization_code' instead.", true, 2, "Client uses obsolete implicit grant flow", 0, 0, null },
{ 2, null, new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Navigate to Client Details → Advanced tab → Grant Types, remove 'password' and add 'authorization_code' or 'client_credentials' instead.", true, 2, "Client uses obsolete password grant flow", 0, 1, null },
{ 3, null, new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Navigate to Client Details → Advanced tab → Authentication, scroll down and enable 'Require Proof Key for Code Exchange (PKCE)' toggle.", true, 0, "Client uses authorization code flow without PKCE", 0, 2, null },
{ 4, "{\"minScopes\": 1}", new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Navigate to Client Details → Resources tab → Allowed Scopes section and add at least one scope from the available list.", true, 2, "Client '{clientName}' has {actualCount} allowed scope(s), but requires at least {requiredCount}", 0, 4, null },
{ 5, "{\"minScopes\": 1}", new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Navigate to API Resource Details → Scopes section and add at least one scope to this API Resource.", true, 2, "API Resource '{resourceName}' has {actualCount} scope(s), but requires at least {requiredCount}", 2, 10, null },
{ 6, "{\"allowLocalhost\": true}", new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Navigate to Client Details → URLs tab → Redirect URIs section and update all HTTP URIs to use HTTPS protocol.", false, 2, "Client has {count} non-HTTPS redirect URI(s): {uris}", 0, 3, null },
{ 7, "{\"maxLifetimeSeconds\": 3600}", new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Navigate to Client Details → Advanced tab → Token, find 'Access Token Lifetime' field and reduce the value to {maxLifetime} seconds or less.", false, 0, "Access token lifetime {actualLifetime}s exceeds maximum {maxLifetime}s", 0, 5, null },
{ 8, "{\"maxLifetimeSeconds\": 2592000}", new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Navigate to Client Details → Advanced tab → Token, find 'Refresh Token Lifetime' field and reduce the value to {maxLifetime} seconds or less.", false, 0, "Client '{clientName}' refresh token lifetime {actualLifetime}s exceeds maximum {maxLifetime}s", 0, 6, null },
{ 9, "{\"prefixes\": [\"scope_\"]}", new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Navigate to API Scope Details → Basic Information section and rename the scope to start with one of the required prefixes: {allowedPrefixes}.", false, 0, "API Scope '{actualName}' must start with one of: {allowedPrefixes}", 3, 7, null },
{ 10, "{\"forbiddenStrings\": [\"test\", \"temp\", \"debug\"]}", new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Navigate to API Scope Details → Basic Information section and rename the scope to remove forbidden strings from the name.", false, 0, "API Scope '{scopeName}' contains forbidden string(s): {forbiddenStrings}", 3, 8, null },
{ 11, null, new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Navigate to API Scope Details → Basic Information section and add a user-friendly Display Name.", false, 1, "API Scope is missing a display name", 3, 9, null },
{ 12, "{\"prefixes\": [\"api.\"]}", new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Navigate to API Resource Details → Basic Information section and rename the resource to follow the naming convention.", false, 0, "API Resource '{actualName}' must start with one of: {allowedPrefixes}", 2, 11, null },
{ 13, "{\"requiredResources\": [\"openid\", \"profile\"]}", new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Navigate to Identity Resource Details → Basic Information section and enable the 'Enabled' toggle.", false, 0, "Required identity resource '{resourceName}' ({displayName}) is disabled", 1, 12, null },
{ 14, "{\"prefixes\": [\"custom.\"], \"excludeStandard\": true}", new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Navigate to Identity Resource Details → Basic Information section and rename the resource to follow the naming convention.", false, 0, "Identity Resource '{actualName}' must start with one of: {allowedPrefixes}", 1, 13, null },
{ 15, "{\"excludeScopes\": [\"openid\", \"profile\", \"email\", \"address\", \"phone\", \"offline_access\"]}", new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "This API Scope '{scopeName}' is not used by any clients or API resources. Consider removing it from API Scopes list or assigning it to relevant clients/resources.", false, 1, "API Scope '{scopeName}'{displayNameSuffix} is not used by any clients or API resources", 3, 14, null },
{ 16, "{\"warningDays\": 30, \"includeAlreadyExpired\": true}", new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "Navigate to Client Details → Advanced tab → Authentication → Secrets section, remove the expired secret and add a new one with proper expiration date.", false, 0, "Client '{clientName}' has a secret ({secretType}) that {status} in {daysUntilExpiry} day(s) on {expirationDate}", 0, 15, null }
});
migrationBuilder.CreateIndex(
name: "IX_ConfigurationRules_RuleType",
table: "ConfigurationRules",
column: "RuleType",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ConfigurationRules");
}
}
}
@@ -0,0 +1,266 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts;
#nullable disable
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.AdminConfiguration
{
[DbContext(typeof(AdminConfigurationDbContext))]
[Migration("20260131083709_UpdateConfigurationRuleTimestamps")]
partial class UpdateConfigurationRuleTimestamps
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.10")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Skoruba.Duende.IdentityServer.Admin.EntityFramework.Admin.Storage.Entities.ConfigurationRule", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Configuration")
.HasMaxLength(2000)
.HasColumnType("character varying(2000)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("FixDescription")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<bool>("IsEnabled")
.HasColumnType("boolean");
b.Property<int>("IssueType")
.HasColumnType("integer");
b.Property<string>("MessageTemplate")
.HasMaxLength(500)
.HasColumnType("character varying(500)");
b.Property<int>("ResourceType")
.HasColumnType("integer");
b.Property<int>("RuleType")
.HasColumnType("integer");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp without time zone");
b.HasKey("Id");
b.HasIndex("RuleType")
.IsUnique();
b.ToTable("ConfigurationRules");
b.HasData(
new
{
Id = 1,
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to Client Details → Advanced tab → Grant Types, remove 'implicit' and add 'authorization_code' instead.",
IsEnabled = true,
IssueType = 2,
MessageTemplate = "Client uses obsolete implicit grant flow",
ResourceType = 0,
RuleType = 0
},
new
{
Id = 2,
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to Client Details → Advanced tab → Grant Types, remove 'password' and add 'authorization_code' or 'client_credentials' instead.",
IsEnabled = true,
IssueType = 2,
MessageTemplate = "Client uses obsolete password grant flow",
ResourceType = 0,
RuleType = 1
},
new
{
Id = 3,
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to Client Details → Advanced tab → Authentication, scroll down and enable 'Require Proof Key for Code Exchange (PKCE)' toggle.",
IsEnabled = true,
IssueType = 0,
MessageTemplate = "Client uses authorization code flow without PKCE",
ResourceType = 0,
RuleType = 2
},
new
{
Id = 4,
Configuration = "{\"minScopes\": 1}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to Client Details → Resources tab → Allowed Scopes section and add at least one scope from the available list.",
IsEnabled = true,
IssueType = 2,
MessageTemplate = "Client '{clientName}' has {actualCount} allowed scope(s), but requires at least {requiredCount}",
ResourceType = 0,
RuleType = 4
},
new
{
Id = 5,
Configuration = "{\"minScopes\": 1}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to API Resource Details → Scopes section and add at least one scope to this API Resource.",
IsEnabled = true,
IssueType = 2,
MessageTemplate = "API Resource '{resourceName}' has {actualCount} scope(s), but requires at least {requiredCount}",
ResourceType = 2,
RuleType = 10
},
new
{
Id = 6,
Configuration = "{\"allowLocalhost\": true}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to Client Details → URLs tab → Redirect URIs section and update all HTTP URIs to use HTTPS protocol.",
IsEnabled = false,
IssueType = 2,
MessageTemplate = "Client has {count} non-HTTPS redirect URI(s): {uris}",
ResourceType = 0,
RuleType = 3
},
new
{
Id = 7,
Configuration = "{\"maxLifetimeSeconds\": 3600}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to Client Details → Advanced tab → Token, find 'Access Token Lifetime' field and reduce the value to {maxLifetime} seconds or less.",
IsEnabled = false,
IssueType = 0,
MessageTemplate = "Access token lifetime {actualLifetime}s exceeds maximum {maxLifetime}s",
ResourceType = 0,
RuleType = 5
},
new
{
Id = 8,
Configuration = "{\"maxLifetimeSeconds\": 2592000}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to Client Details → Advanced tab → Token, find 'Refresh Token Lifetime' field and reduce the value to {maxLifetime} seconds or less.",
IsEnabled = false,
IssueType = 0,
MessageTemplate = "Client '{clientName}' refresh token lifetime {actualLifetime}s exceeds maximum {maxLifetime}s",
ResourceType = 0,
RuleType = 6
},
new
{
Id = 9,
Configuration = "{\"prefixes\": [\"scope_\"]}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to API Scope Details → Basic Information section and rename the scope to start with one of the required prefixes: {allowedPrefixes}.",
IsEnabled = false,
IssueType = 0,
MessageTemplate = "API Scope '{actualName}' must start with one of: {allowedPrefixes}",
ResourceType = 3,
RuleType = 7
},
new
{
Id = 10,
Configuration = "{\"forbiddenStrings\": [\"test\", \"temp\", \"debug\"]}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to API Scope Details → Basic Information section and rename the scope to remove forbidden strings from the name.",
IsEnabled = false,
IssueType = 0,
MessageTemplate = "API Scope '{scopeName}' contains forbidden string(s): {forbiddenStrings}",
ResourceType = 3,
RuleType = 8
},
new
{
Id = 11,
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to API Scope Details → Basic Information section and add a user-friendly Display Name.",
IsEnabled = false,
IssueType = 1,
MessageTemplate = "API Scope is missing a display name",
ResourceType = 3,
RuleType = 9
},
new
{
Id = 12,
Configuration = "{\"prefixes\": [\"api.\"]}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to API Resource Details → Basic Information section and rename the resource to follow the naming convention.",
IsEnabled = false,
IssueType = 0,
MessageTemplate = "API Resource '{actualName}' must start with one of: {allowedPrefixes}",
ResourceType = 2,
RuleType = 11
},
new
{
Id = 13,
Configuration = "{\"requiredResources\": [\"openid\", \"profile\"]}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to Identity Resource Details → Basic Information section and enable the 'Enabled' toggle.",
IsEnabled = false,
IssueType = 0,
MessageTemplate = "Required identity resource '{resourceName}' ({displayName}) is disabled",
ResourceType = 1,
RuleType = 12
},
new
{
Id = 14,
Configuration = "{\"prefixes\": [\"custom.\"], \"excludeStandard\": true}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to Identity Resource Details → Basic Information section and rename the resource to follow the naming convention.",
IsEnabled = false,
IssueType = 0,
MessageTemplate = "Identity Resource '{actualName}' must start with one of: {allowedPrefixes}",
ResourceType = 1,
RuleType = 13
},
new
{
Id = 15,
Configuration = "{\"excludeScopes\": [\"openid\", \"profile\", \"email\", \"address\", \"phone\", \"offline_access\"]}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "This API Scope '{scopeName}' is not used by any clients or API resources. Consider removing it from API Scopes list or assigning it to relevant clients/resources.",
IsEnabled = false,
IssueType = 1,
MessageTemplate = "API Scope '{scopeName}'{displayNameSuffix} is not used by any clients or API resources",
ResourceType = 3,
RuleType = 14
},
new
{
Id = 16,
Configuration = "{\"warningDays\": 30, \"includeAlreadyExpired\": true}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to Client Details → Advanced tab → Authentication → Secrets section, remove the expired secret and add a new one with proper expiration date.",
IsEnabled = false,
IssueType = 0,
MessageTemplate = "Client '{clientName}' has a secret ({secretType}) that {status} in {daysUntilExpiry} day(s) on {expirationDate}",
ResourceType = 0,
RuleType = 15
});
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,53 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.AdminConfiguration
{
/// <inheritdoc />
public partial class UpdateConfigurationRuleTimestamps : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<DateTime>(
name: "UpdatedAt",
table: "ConfigurationRules",
type: "timestamp without time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "CreatedAt",
table: "ConfigurationRules",
type: "timestamp without time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp with time zone");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<DateTime>(
name: "UpdatedAt",
table: "ConfigurationRules",
type: "timestamp with time zone",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "CreatedAt",
table: "ConfigurationRules",
type: "timestamp with time zone",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone");
}
}
}
@@ -0,0 +1,263 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts;
#nullable disable
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.AdminConfiguration
{
[DbContext(typeof(AdminConfigurationDbContext))]
partial class AdminConfigurationDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.10")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Skoruba.Duende.IdentityServer.Admin.EntityFramework.Admin.Storage.Entities.ConfigurationRule", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Configuration")
.HasMaxLength(2000)
.HasColumnType("character varying(2000)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp without time zone");
b.Property<string>("FixDescription")
.HasMaxLength(1000)
.HasColumnType("character varying(1000)");
b.Property<bool>("IsEnabled")
.HasColumnType("boolean");
b.Property<int>("IssueType")
.HasColumnType("integer");
b.Property<string>("MessageTemplate")
.HasMaxLength(500)
.HasColumnType("character varying(500)");
b.Property<int>("ResourceType")
.HasColumnType("integer");
b.Property<int>("RuleType")
.HasColumnType("integer");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp without time zone");
b.HasKey("Id");
b.HasIndex("RuleType")
.IsUnique();
b.ToTable("ConfigurationRules");
b.HasData(
new
{
Id = 1,
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to Client Details → Advanced tab → Grant Types, remove 'implicit' and add 'authorization_code' instead.",
IsEnabled = true,
IssueType = 2,
MessageTemplate = "Client uses obsolete implicit grant flow",
ResourceType = 0,
RuleType = 0
},
new
{
Id = 2,
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to Client Details → Advanced tab → Grant Types, remove 'password' and add 'authorization_code' or 'client_credentials' instead.",
IsEnabled = true,
IssueType = 2,
MessageTemplate = "Client uses obsolete password grant flow",
ResourceType = 0,
RuleType = 1
},
new
{
Id = 3,
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to Client Details → Advanced tab → Authentication, scroll down and enable 'Require Proof Key for Code Exchange (PKCE)' toggle.",
IsEnabled = true,
IssueType = 0,
MessageTemplate = "Client uses authorization code flow without PKCE",
ResourceType = 0,
RuleType = 2
},
new
{
Id = 4,
Configuration = "{\"minScopes\": 1}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to Client Details → Resources tab → Allowed Scopes section and add at least one scope from the available list.",
IsEnabled = true,
IssueType = 2,
MessageTemplate = "Client '{clientName}' has {actualCount} allowed scope(s), but requires at least {requiredCount}",
ResourceType = 0,
RuleType = 4
},
new
{
Id = 5,
Configuration = "{\"minScopes\": 1}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to API Resource Details → Scopes section and add at least one scope to this API Resource.",
IsEnabled = true,
IssueType = 2,
MessageTemplate = "API Resource '{resourceName}' has {actualCount} scope(s), but requires at least {requiredCount}",
ResourceType = 2,
RuleType = 10
},
new
{
Id = 6,
Configuration = "{\"allowLocalhost\": true}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to Client Details → URLs tab → Redirect URIs section and update all HTTP URIs to use HTTPS protocol.",
IsEnabled = false,
IssueType = 2,
MessageTemplate = "Client has {count} non-HTTPS redirect URI(s): {uris}",
ResourceType = 0,
RuleType = 3
},
new
{
Id = 7,
Configuration = "{\"maxLifetimeSeconds\": 3600}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to Client Details → Advanced tab → Token, find 'Access Token Lifetime' field and reduce the value to {maxLifetime} seconds or less.",
IsEnabled = false,
IssueType = 0,
MessageTemplate = "Access token lifetime {actualLifetime}s exceeds maximum {maxLifetime}s",
ResourceType = 0,
RuleType = 5
},
new
{
Id = 8,
Configuration = "{\"maxLifetimeSeconds\": 2592000}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to Client Details → Advanced tab → Token, find 'Refresh Token Lifetime' field and reduce the value to {maxLifetime} seconds or less.",
IsEnabled = false,
IssueType = 0,
MessageTemplate = "Client '{clientName}' refresh token lifetime {actualLifetime}s exceeds maximum {maxLifetime}s",
ResourceType = 0,
RuleType = 6
},
new
{
Id = 9,
Configuration = "{\"prefixes\": [\"scope_\"]}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to API Scope Details → Basic Information section and rename the scope to start with one of the required prefixes: {allowedPrefixes}.",
IsEnabled = false,
IssueType = 0,
MessageTemplate = "API Scope '{actualName}' must start with one of: {allowedPrefixes}",
ResourceType = 3,
RuleType = 7
},
new
{
Id = 10,
Configuration = "{\"forbiddenStrings\": [\"test\", \"temp\", \"debug\"]}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to API Scope Details → Basic Information section and rename the scope to remove forbidden strings from the name.",
IsEnabled = false,
IssueType = 0,
MessageTemplate = "API Scope '{scopeName}' contains forbidden string(s): {forbiddenStrings}",
ResourceType = 3,
RuleType = 8
},
new
{
Id = 11,
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to API Scope Details → Basic Information section and add a user-friendly Display Name.",
IsEnabled = false,
IssueType = 1,
MessageTemplate = "API Scope is missing a display name",
ResourceType = 3,
RuleType = 9
},
new
{
Id = 12,
Configuration = "{\"prefixes\": [\"api.\"]}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to API Resource Details → Basic Information section and rename the resource to follow the naming convention.",
IsEnabled = false,
IssueType = 0,
MessageTemplate = "API Resource '{actualName}' must start with one of: {allowedPrefixes}",
ResourceType = 2,
RuleType = 11
},
new
{
Id = 13,
Configuration = "{\"requiredResources\": [\"openid\", \"profile\"]}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to Identity Resource Details → Basic Information section and enable the 'Enabled' toggle.",
IsEnabled = false,
IssueType = 0,
MessageTemplate = "Required identity resource '{resourceName}' ({displayName}) is disabled",
ResourceType = 1,
RuleType = 12
},
new
{
Id = 14,
Configuration = "{\"prefixes\": [\"custom.\"], \"excludeStandard\": true}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to Identity Resource Details → Basic Information section and rename the resource to follow the naming convention.",
IsEnabled = false,
IssueType = 0,
MessageTemplate = "Identity Resource '{actualName}' must start with one of: {allowedPrefixes}",
ResourceType = 1,
RuleType = 13
},
new
{
Id = 15,
Configuration = "{\"excludeScopes\": [\"openid\", \"profile\", \"email\", \"address\", \"phone\", \"offline_access\"]}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "This API Scope '{scopeName}' is not used by any clients or API resources. Consider removing it from API Scopes list or assigning it to relevant clients/resources.",
IsEnabled = false,
IssueType = 1,
MessageTemplate = "API Scope '{scopeName}'{displayNameSuffix} is not used by any clients or API resources",
ResourceType = 3,
RuleType = 14
},
new
{
Id = 16,
Configuration = "{\"warningDays\": 30, \"includeAlreadyExpired\": true}",
CreatedAt = new DateTime(2024, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
FixDescription = "Navigate to Client Details → Advanced tab → Authentication → Secrets section, remove the expired secret and add a new one with proper expiration date.",
IsEnabled = false,
IssueType = 0,
MessageTemplate = "Client '{clientName}' has a secret ({secretType}) that {status} in {daysUntilExpiry} day(s) on {expirationDate}",
ResourceType = 0,
RuleType = 15
});
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,68 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts;
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.AuditLogging
{
[DbContext(typeof(AdminAuditLogDbContext))]
[Migration("20191120100220_DbInit")]
partial class DbInit
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "3.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("Skoruba.AuditLogging.EntityFramework.Entities.AuditLog", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Action")
.HasColumnType("text");
b.Property<string>("Category")
.HasColumnType("text");
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Data")
.HasColumnType("text");
b.Property<string>("Event")
.HasColumnType("text");
b.Property<string>("Source")
.HasColumnType("text");
b.Property<string>("SubjectAdditionalData")
.HasColumnType("text");
b.Property<string>("SubjectIdentifier")
.HasColumnType("text");
b.Property<string>("SubjectName")
.HasColumnType("text");
b.Property<string>("SubjectType")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("AuditLog");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,40 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.AuditLogging
{
public partial class DbInit : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AuditLog",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Event = table.Column<string>(nullable: true),
Source = table.Column<string>(nullable: true),
Category = table.Column<string>(nullable: true),
SubjectIdentifier = table.Column<string>(nullable: true),
SubjectName = table.Column<string>(nullable: true),
SubjectType = table.Column<string>(nullable: true),
SubjectAdditionalData = table.Column<string>(nullable: true),
Action = table.Column<string>(nullable: true),
Data = table.Column<string>(nullable: true),
Created = table.Column<DateTime>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AuditLog", x => x.Id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AuditLog");
}
}
}
@@ -0,0 +1,68 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts;
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.AuditLogging
{
[DbContext(typeof(AdminAuditLogDbContext))]
[Migration("20200419130247_ChangeAuditLogToLong")]
partial class ChangeAuditLogToLong
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "3.1.1")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("Skoruba.AuditLogging.EntityFramework.Entities.AuditLog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Action")
.HasColumnType("text");
b.Property<string>("Category")
.HasColumnType("text");
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Data")
.HasColumnType("text");
b.Property<string>("Event")
.HasColumnType("text");
b.Property<string>("Source")
.HasColumnType("text");
b.Property<string>("SubjectAdditionalData")
.HasColumnType("text");
b.Property<string>("SubjectIdentifier")
.HasColumnType("text");
b.Property<string>("SubjectName")
.HasColumnType("text");
b.Property<string>("SubjectType")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("AuditLog");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,41 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.AuditLogging
{
public partial class ChangeAuditLogToLong : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey("PK_AuditLog", "AuditLog");
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "AuditLog",
nullable: false,
oldClrType: typeof(int),
oldType: "integer")
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
migrationBuilder.AddPrimaryKey("PK_AuditLog", "AuditLog", "Id");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey("PK_AuditLog", "AuditLog");
migrationBuilder.AlterColumn<int>(
name: "Id",
table: "AuditLog",
type: "integer",
nullable: false,
oldClrType: typeof(long))
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
migrationBuilder.AddPrimaryKey("PK_AuditLog", "AuditLog", "Id");
}
}
}
@@ -0,0 +1,66 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts;
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.AuditLogging
{
[DbContext(typeof(AdminAuditLogDbContext))]
partial class AdminAuditLogDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "3.1.1")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("Skoruba.AuditLogging.EntityFramework.Entities.AuditLog", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Action")
.HasColumnType("text");
b.Property<string>("Category")
.HasColumnType("text");
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Data")
.HasColumnType("text");
b.Property<string>("Event")
.HasColumnType("text");
b.Property<string>("Source")
.HasColumnType("text");
b.Property<string>("SubjectAdditionalData")
.HasColumnType("text");
b.Property<string>("SubjectIdentifier")
.HasColumnType("text");
b.Property<string>("SubjectName")
.HasColumnType("text");
b.Property<string>("SubjectType")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("AuditLog");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,43 @@
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts;
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.DataProtection
{
[DbContext(typeof(IdentityServerDataProtectionDbContext))]
[Migration("20200419131536_AddDataProtection")]
partial class AddDataProtection
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "3.1.1")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("FriendlyName")
.HasColumnType("text");
b.Property<string>("Xml")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("DataProtectionKeys");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,31 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.DataProtection
{
public partial class AddDataProtection : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "DataProtectionKeys",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
FriendlyName = table.Column<string>(nullable: true),
Xml = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_DataProtectionKeys", x => x.Id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "DataProtectionKeys");
}
}
}
@@ -0,0 +1,41 @@
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts;
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.DataProtection
{
[DbContext(typeof(IdentityServerDataProtectionDbContext))]
partial class IdentityServerDataProtectionDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "3.1.1")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("FriendlyName")
.HasColumnType("text");
b.Property<string>("Xml")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("DataProtectionKeys");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,271 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts;
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.Identity
{
[DbContext(typeof(AdminIdentityDbContext))]
[Migration("20191120100035_DbInit")]
partial class DbInit
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "3.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentity", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<int>("AccessFailedCount")
.HasColumnType("integer");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Email")
.HasColumnType("character varying(256)")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed")
.HasColumnType("boolean");
b.Property<bool>("LockoutEnabled")
.HasColumnType("boolean");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("timestamp with time zone");
b.Property<string>("NormalizedEmail")
.HasColumnType("character varying(256)")
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.HasColumnType("character varying(256)")
.HasMaxLength(256);
b.Property<string>("PasswordHash")
.HasColumnType("text");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("boolean");
b.Property<string>("SecurityStamp")
.HasColumnType("text");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("boolean");
b.Property<string>("UserName")
.HasColumnType("character varying(256)")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasName("UserNameIndex");
b.ToTable("Users");
});
modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("character varying(256)")
.HasMaxLength(256);
b.Property<string>("NormalizedName")
.HasColumnType("character varying(256)")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasName("RoleNameIndex");
b.ToTable("Roles");
});
modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityRoleClaim", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("RoleClaims");
});
modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityUserClaim", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("UserClaims");
});
modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityUserLogin", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("text");
b.Property<string>("ProviderKey")
.HasColumnType("text");
b.Property<string>("ProviderDisplayName")
.HasColumnType("text");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("text");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("UserLogins");
});
modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityUserRole", b =>
{
b.Property<string>("UserId")
.HasColumnType("text");
b.Property<string>("RoleId")
.HasColumnType("text");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("UserRoles");
});
modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityUserToken", b =>
{
b.Property<string>("UserId")
.HasColumnType("text");
b.Property<string>("LoginProvider")
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("text");
b.Property<string>("Value")
.HasColumnType("text");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("UserTokens");
});
modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityRoleClaim", b =>
{
b.HasOne("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityUserClaim", b =>
{
b.HasOne("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentity", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityUserLogin", b =>
{
b.HasOne("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentity", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityUserRole", b =>
{
b.HasOne("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentity", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityUserToken", b =>
{
b.HasOne("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentity", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,218 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.Identity
{
public partial class DbInit : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Roles",
columns: table => new
{
Id = table.Column<string>(nullable: false),
Name = table.Column<string>(maxLength: 256, nullable: true),
NormalizedName = table.Column<string>(maxLength: 256, nullable: true),
ConcurrencyStamp = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Roles", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Users",
columns: table => new
{
Id = table.Column<string>(nullable: false),
UserName = table.Column<string>(maxLength: 256, nullable: true),
NormalizedUserName = table.Column<string>(maxLength: 256, nullable: true),
Email = table.Column<string>(maxLength: 256, nullable: true),
NormalizedEmail = table.Column<string>(maxLength: 256, nullable: true),
EmailConfirmed = table.Column<bool>(nullable: false),
PasswordHash = table.Column<string>(nullable: true),
SecurityStamp = table.Column<string>(nullable: true),
ConcurrencyStamp = table.Column<string>(nullable: true),
PhoneNumber = table.Column<string>(nullable: true),
PhoneNumberConfirmed = table.Column<bool>(nullable: false),
TwoFactorEnabled = table.Column<bool>(nullable: false),
LockoutEnd = table.Column<DateTimeOffset>(nullable: true),
LockoutEnabled = table.Column<bool>(nullable: false),
AccessFailedCount = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.Id);
});
migrationBuilder.CreateTable(
name: "RoleClaims",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
RoleId = table.Column<string>(nullable: false),
ClaimType = table.Column<string>(nullable: true),
ClaimValue = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_RoleClaims", x => x.Id);
table.ForeignKey(
name: "FK_RoleClaims_Roles_RoleId",
column: x => x.RoleId,
principalTable: "Roles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "UserClaims",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
UserId = table.Column<string>(nullable: false),
ClaimType = table.Column<string>(nullable: true),
ClaimValue = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_UserClaims", x => x.Id);
table.ForeignKey(
name: "FK_UserClaims_Users_UserId",
column: x => x.UserId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "UserLogins",
columns: table => new
{
LoginProvider = table.Column<string>(nullable: false),
ProviderKey = table.Column<string>(nullable: false),
ProviderDisplayName = table.Column<string>(nullable: true),
UserId = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_UserLogins", x => new { x.LoginProvider, x.ProviderKey });
table.ForeignKey(
name: "FK_UserLogins_Users_UserId",
column: x => x.UserId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "UserRoles",
columns: table => new
{
UserId = table.Column<string>(nullable: false),
RoleId = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_UserRoles", x => new { x.UserId, x.RoleId });
table.ForeignKey(
name: "FK_UserRoles_Roles_RoleId",
column: x => x.RoleId,
principalTable: "Roles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_UserRoles_Users_UserId",
column: x => x.UserId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "UserTokens",
columns: table => new
{
UserId = table.Column<string>(nullable: false),
LoginProvider = table.Column<string>(nullable: false),
Name = table.Column<string>(nullable: false),
Value = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_UserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
table.ForeignKey(
name: "FK_UserTokens_Users_UserId",
column: x => x.UserId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_RoleClaims_RoleId",
table: "RoleClaims",
column: "RoleId");
migrationBuilder.CreateIndex(
name: "RoleNameIndex",
table: "Roles",
column: "NormalizedName",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_UserClaims_UserId",
table: "UserClaims",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_UserLogins_UserId",
table: "UserLogins",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_UserRoles_RoleId",
table: "UserRoles",
column: "RoleId");
migrationBuilder.CreateIndex(
name: "EmailIndex",
table: "Users",
column: "NormalizedEmail");
migrationBuilder.CreateIndex(
name: "UserNameIndex",
table: "Users",
column: "NormalizedUserName",
unique: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "RoleClaims");
migrationBuilder.DropTable(
name: "UserClaims");
migrationBuilder.DropTable(
name: "UserLogins");
migrationBuilder.DropTable(
name: "UserRoles");
migrationBuilder.DropTable(
name: "UserTokens");
migrationBuilder.DropTable(
name: "Roles");
migrationBuilder.DropTable(
name: "Users");
}
}
}
@@ -0,0 +1,46 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Infrastructure;
using LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts;
#nullable disable
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.Identity
{
[DbContext(typeof(AdminIdentityDbContext))]
[Migration("20260223162100_AddUserPasskeys")]
public partial class AddUserPasskeys : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "UserPasskeys",
columns: table => new
{
CredentialId = table.Column<byte[]>(type: "bytea", maxLength: 1024, nullable: false),
UserId = table.Column<string>(type: "text", nullable: false),
Data = table.Column<string>(type: "jsonb", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_UserPasskeys", x => x.CredentialId);
table.ForeignKey(
name: "FK_UserPasskeys_Users_UserId",
column: x => x.UserId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_UserPasskeys_UserId",
table: "UserPasskeys",
column: "UserId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "UserPasskeys");
}
}
}
@@ -0,0 +1,347 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts;
#nullable disable
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.Identity
{
[DbContext(typeof(AdminIdentityDbContext))]
partial class AdminIdentityDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.2")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityPasskey", b =>
{
b.Property<byte[]>("CredentialId")
.HasMaxLength(1024)
.HasColumnType("bytea");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("text");
b.HasKey("CredentialId");
b.HasIndex("UserId");
b.ToTable("UserPasskeys", (string)null);
});
modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentity", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<int>("AccessFailedCount")
.HasColumnType("integer");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("boolean");
b.Property<bool>("LockoutEnabled")
.HasColumnType("boolean");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("timestamp with time zone");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("PasswordHash")
.HasColumnType("text");
b.Property<string>("PhoneNumber")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("boolean");
b.Property<string>("SecurityStamp")
.HasColumnType("text");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("boolean");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("Users", (string)null);
});
modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("Roles", (string)null);
});
modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityRoleClaim", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("RoleClaims", (string)null);
});
modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityUserClaim", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("UserClaims", (string)null);
});
modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityUserLogin", b =>
{
b.Property<string>("LoginProvider")
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property<string>("ProviderKey")
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property<string>("ProviderDisplayName")
.HasColumnType("text");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("text");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("UserLogins", (string)null);
});
modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityUserRole", b =>
{
b.Property<string>("UserId")
.HasColumnType("text");
b.Property<string>("RoleId")
.HasColumnType("text");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("UserRoles", (string)null);
});
modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityUserToken", b =>
{
b.Property<string>("UserId")
.HasColumnType("text");
b.Property<string>("LoginProvider")
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property<string>("Name")
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property<string>("Value")
.HasColumnType("text");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("UserTokens", (string)null);
});
modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityPasskey", b =>
{
b.HasOne("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentity", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsOne("Microsoft.AspNetCore.Identity.IdentityPasskeyData", "Data", b1 =>
{
b1.Property<byte[]>("UserIdentityPasskeyCredentialId");
b1.Property<byte[]>("AttestationObject")
.IsRequired();
b1.Property<byte[]>("ClientDataJson")
.IsRequired();
b1.Property<DateTimeOffset>("CreatedAt");
b1.Property<bool>("IsBackedUp");
b1.Property<bool>("IsBackupEligible");
b1.Property<bool>("IsUserVerified");
b1.Property<string>("Name");
b1.Property<byte[]>("PublicKey")
.IsRequired();
b1.Property<long>("SignCount");
b1.PrimitiveCollection<string>("Transports");
b1.HasKey("UserIdentityPasskeyCredentialId");
b1.ToTable("UserPasskeys");
b1
.ToJson("Data")
.HasColumnType("jsonb");
b1.WithOwner()
.HasForeignKey("UserIdentityPasskeyCredentialId");
});
b.Navigation("Data")
.IsRequired();
});
modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityRoleClaim", b =>
{
b.HasOne("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityUserClaim", b =>
{
b.HasOne("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentity", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityUserLogin", b =>
{
b.HasOne("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentity", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityUserRole", b =>
{
b.HasOne("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentity", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityUserToken", b =>
{
b.HasOne("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentity", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,835 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts;
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.IdentityServerConfiguration
{
[DbContext(typeof(IdentityServerConfigurationDbContext))]
[Migration("20191120100129_DbInit")]
partial class DbInit
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "3.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiResource", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasColumnType("character varying(1000)")
.HasMaxLength(1000);
b.Property<string>("DisplayName")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<bool>("Enabled")
.HasColumnType("boolean");
b.Property<DateTime?>("LastAccessed")
.HasColumnType("timestamp without time zone");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<bool>("NonEditable")
.HasColumnType("boolean");
b.Property<DateTime?>("Updated")
.HasColumnType("timestamp without time zone");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("ApiResources");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiResourceClaim", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiResourceId")
.HasColumnType("integer");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("ApiResourceId");
b.ToTable("ApiClaims");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiResourceProperty", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiResourceId")
.HasColumnType("integer");
b.Property<string>("Key")
.IsRequired()
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("ApiResourceId");
b.ToTable("ApiProperties");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiScope", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiResourceId")
.HasColumnType("integer");
b.Property<string>("Description")
.HasColumnType("character varying(1000)")
.HasMaxLength(1000);
b.Property<string>("DisplayName")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<bool>("Emphasize")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<bool>("Required")
.HasColumnType("boolean");
b.Property<bool>("ShowInDiscoveryDocument")
.HasColumnType("boolean");
b.HasKey("Id");
b.HasIndex("ApiResourceId");
b.HasIndex("Name")
.IsUnique();
b.ToTable("ApiScopes");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiScopeClaim", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiScopeId")
.HasColumnType("integer");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("ApiScopeId");
b.ToTable("ApiScopeClaims");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiSecret", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiResourceId")
.HasColumnType("integer");
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasColumnType("character varying(1000)")
.HasMaxLength(1000);
b.Property<DateTime?>("Expiration")
.HasColumnType("timestamp without time zone");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("character varying(4000)")
.HasMaxLength(4000);
b.HasKey("Id");
b.HasIndex("ApiResourceId");
b.ToTable("ApiSecrets");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.Client", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("AbsoluteRefreshTokenLifetime")
.HasColumnType("integer");
b.Property<int>("AccessTokenLifetime")
.HasColumnType("integer");
b.Property<int>("AccessTokenType")
.HasColumnType("integer");
b.Property<bool>("AllowAccessTokensViaBrowser")
.HasColumnType("boolean");
b.Property<bool>("AllowOfflineAccess")
.HasColumnType("boolean");
b.Property<bool>("AllowPlainTextPkce")
.HasColumnType("boolean");
b.Property<bool>("AllowRememberConsent")
.HasColumnType("boolean");
b.Property<bool>("AlwaysIncludeUserClaimsInIdToken")
.HasColumnType("boolean");
b.Property<bool>("AlwaysSendClientClaims")
.HasColumnType("boolean");
b.Property<int>("AuthorizationCodeLifetime")
.HasColumnType("integer");
b.Property<bool>("BackChannelLogoutSessionRequired")
.HasColumnType("boolean");
b.Property<string>("BackChannelLogoutUri")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.Property<string>("ClientClaimsPrefix")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<string>("ClientId")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<string>("ClientName")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<string>("ClientUri")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.Property<int?>("ConsentLifetime")
.HasColumnType("integer");
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasColumnType("character varying(1000)")
.HasMaxLength(1000);
b.Property<int>("DeviceCodeLifetime")
.HasColumnType("integer");
b.Property<bool>("EnableLocalLogin")
.HasColumnType("boolean");
b.Property<bool>("Enabled")
.HasColumnType("boolean");
b.Property<bool>("FrontChannelLogoutSessionRequired")
.HasColumnType("boolean");
b.Property<string>("FrontChannelLogoutUri")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.Property<int>("IdentityTokenLifetime")
.HasColumnType("integer");
b.Property<bool>("IncludeJwtId")
.HasColumnType("boolean");
b.Property<DateTime?>("LastAccessed")
.HasColumnType("timestamp without time zone");
b.Property<string>("LogoUri")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.Property<bool>("NonEditable")
.HasColumnType("boolean");
b.Property<string>("PairWiseSubjectSalt")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<string>("ProtocolType")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<int>("RefreshTokenExpiration")
.HasColumnType("integer");
b.Property<int>("RefreshTokenUsage")
.HasColumnType("integer");
b.Property<bool>("RequireClientSecret")
.HasColumnType("boolean");
b.Property<bool>("RequireConsent")
.HasColumnType("boolean");
b.Property<bool>("RequirePkce")
.HasColumnType("boolean");
b.Property<int>("SlidingRefreshTokenLifetime")
.HasColumnType("integer");
b.Property<bool>("UpdateAccessTokenClaimsOnRefresh")
.HasColumnType("boolean");
b.Property<DateTime?>("Updated")
.HasColumnType("timestamp without time zone");
b.Property<string>("UserCodeType")
.HasColumnType("character varying(100)")
.HasMaxLength(100);
b.Property<int?>("UserSsoLifetime")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ClientId")
.IsUnique();
b.ToTable("Clients");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientClaim", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientClaims");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientCorsOrigin", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("Origin")
.IsRequired()
.HasColumnType("character varying(150)")
.HasMaxLength(150);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientCorsOrigins");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientGrantType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("GrantType")
.IsRequired()
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientGrantTypes");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientIdPRestriction", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("Provider")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientIdPRestrictions");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientPostLogoutRedirectUri", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("PostLogoutRedirectUri")
.IsRequired()
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientPostLogoutRedirectUris");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientProperty", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("Key")
.IsRequired()
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientProperties");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientRedirectUri", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("RedirectUri")
.IsRequired()
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientRedirectUris");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientScope", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("Scope")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientScopes");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientSecret", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.Property<DateTime?>("Expiration")
.HasColumnType("timestamp without time zone");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("character varying(4000)")
.HasMaxLength(4000);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientSecrets");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.IdentityClaim", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("IdentityResourceId")
.HasColumnType("integer");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("IdentityResourceId");
b.ToTable("IdentityClaims");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.IdentityResource", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasColumnType("character varying(1000)")
.HasMaxLength(1000);
b.Property<string>("DisplayName")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<bool>("Emphasize")
.HasColumnType("boolean");
b.Property<bool>("Enabled")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<bool>("NonEditable")
.HasColumnType("boolean");
b.Property<bool>("Required")
.HasColumnType("boolean");
b.Property<bool>("ShowInDiscoveryDocument")
.HasColumnType("boolean");
b.Property<DateTime?>("Updated")
.HasColumnType("timestamp without time zone");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("IdentityResources");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.IdentityResourceProperty", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("IdentityResourceId")
.HasColumnType("integer");
b.Property<string>("Key")
.IsRequired()
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("IdentityResourceId");
b.ToTable("IdentityProperties");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiResourceClaim", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.ApiResource", "ApiResource")
.WithMany("UserClaims")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiResourceProperty", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.ApiResource", "ApiResource")
.WithMany("Properties")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiScope", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.ApiResource", "ApiResource")
.WithMany("Scopes")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiScopeClaim", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.ApiScope", "ApiScope")
.WithMany("UserClaims")
.HasForeignKey("ApiScopeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiSecret", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.ApiResource", "ApiResource")
.WithMany("Secrets")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientClaim", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.Client", "Client")
.WithMany("Claims")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientCorsOrigin", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.Client", "Client")
.WithMany("AllowedCorsOrigins")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientGrantType", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.Client", "Client")
.WithMany("AllowedGrantTypes")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientIdPRestriction", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.Client", "Client")
.WithMany("IdentityProviderRestrictions")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientPostLogoutRedirectUri", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.Client", "Client")
.WithMany("PostLogoutRedirectUris")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientProperty", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.Client", "Client")
.WithMany("Properties")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientRedirectUri", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.Client", "Client")
.WithMany("RedirectUris")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientScope", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.Client", "Client")
.WithMany("AllowedScopes")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientSecret", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.Client", "Client")
.WithMany("ClientSecrets")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.IdentityClaim", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.IdentityResource", "IdentityResource")
.WithMany("UserClaims")
.HasForeignKey("IdentityResourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.IdentityResourceProperty", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.IdentityResource", "IdentityResource")
.WithMany("Properties")
.HasForeignKey("IdentityResourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,608 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.IdentityServerConfiguration
{
public partial class DbInit : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ApiResources",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Enabled = table.Column<bool>(nullable: false),
Name = table.Column<string>(maxLength: 200, nullable: false),
DisplayName = table.Column<string>(maxLength: 200, nullable: true),
Description = table.Column<string>(maxLength: 1000, nullable: true),
Created = table.Column<DateTime>(nullable: false),
Updated = table.Column<DateTime>(nullable: true),
LastAccessed = table.Column<DateTime>(nullable: true),
NonEditable = table.Column<bool>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ApiResources", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Clients",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Enabled = table.Column<bool>(nullable: false),
ClientId = table.Column<string>(maxLength: 200, nullable: false),
ProtocolType = table.Column<string>(maxLength: 200, nullable: false),
RequireClientSecret = table.Column<bool>(nullable: false),
ClientName = table.Column<string>(maxLength: 200, nullable: true),
Description = table.Column<string>(maxLength: 1000, nullable: true),
ClientUri = table.Column<string>(maxLength: 2000, nullable: true),
LogoUri = table.Column<string>(maxLength: 2000, nullable: true),
RequireConsent = table.Column<bool>(nullable: false),
AllowRememberConsent = table.Column<bool>(nullable: false),
AlwaysIncludeUserClaimsInIdToken = table.Column<bool>(nullable: false),
RequirePkce = table.Column<bool>(nullable: false),
AllowPlainTextPkce = table.Column<bool>(nullable: false),
AllowAccessTokensViaBrowser = table.Column<bool>(nullable: false),
FrontChannelLogoutUri = table.Column<string>(maxLength: 2000, nullable: true),
FrontChannelLogoutSessionRequired = table.Column<bool>(nullable: false),
BackChannelLogoutUri = table.Column<string>(maxLength: 2000, nullable: true),
BackChannelLogoutSessionRequired = table.Column<bool>(nullable: false),
AllowOfflineAccess = table.Column<bool>(nullable: false),
IdentityTokenLifetime = table.Column<int>(nullable: false),
AccessTokenLifetime = table.Column<int>(nullable: false),
AuthorizationCodeLifetime = table.Column<int>(nullable: false),
ConsentLifetime = table.Column<int>(nullable: true),
AbsoluteRefreshTokenLifetime = table.Column<int>(nullable: false),
SlidingRefreshTokenLifetime = table.Column<int>(nullable: false),
RefreshTokenUsage = table.Column<int>(nullable: false),
UpdateAccessTokenClaimsOnRefresh = table.Column<bool>(nullable: false),
RefreshTokenExpiration = table.Column<int>(nullable: false),
AccessTokenType = table.Column<int>(nullable: false),
EnableLocalLogin = table.Column<bool>(nullable: false),
IncludeJwtId = table.Column<bool>(nullable: false),
AlwaysSendClientClaims = table.Column<bool>(nullable: false),
ClientClaimsPrefix = table.Column<string>(maxLength: 200, nullable: true),
PairWiseSubjectSalt = table.Column<string>(maxLength: 200, nullable: true),
Created = table.Column<DateTime>(nullable: false),
Updated = table.Column<DateTime>(nullable: true),
LastAccessed = table.Column<DateTime>(nullable: true),
UserSsoLifetime = table.Column<int>(nullable: true),
UserCodeType = table.Column<string>(maxLength: 100, nullable: true),
DeviceCodeLifetime = table.Column<int>(nullable: false),
NonEditable = table.Column<bool>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Clients", x => x.Id);
});
migrationBuilder.CreateTable(
name: "IdentityResources",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Enabled = table.Column<bool>(nullable: false),
Name = table.Column<string>(maxLength: 200, nullable: false),
DisplayName = table.Column<string>(maxLength: 200, nullable: true),
Description = table.Column<string>(maxLength: 1000, nullable: true),
Required = table.Column<bool>(nullable: false),
Emphasize = table.Column<bool>(nullable: false),
ShowInDiscoveryDocument = table.Column<bool>(nullable: false),
Created = table.Column<DateTime>(nullable: false),
Updated = table.Column<DateTime>(nullable: true),
NonEditable = table.Column<bool>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityResources", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ApiClaims",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Type = table.Column<string>(maxLength: 200, nullable: false),
ApiResourceId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ApiClaims", x => x.Id);
table.ForeignKey(
name: "FK_ApiClaims_ApiResources_ApiResourceId",
column: x => x.ApiResourceId,
principalTable: "ApiResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ApiProperties",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Key = table.Column<string>(maxLength: 250, nullable: false),
Value = table.Column<string>(maxLength: 2000, nullable: false),
ApiResourceId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ApiProperties", x => x.Id);
table.ForeignKey(
name: "FK_ApiProperties_ApiResources_ApiResourceId",
column: x => x.ApiResourceId,
principalTable: "ApiResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ApiScopes",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(maxLength: 200, nullable: false),
DisplayName = table.Column<string>(maxLength: 200, nullable: true),
Description = table.Column<string>(maxLength: 1000, nullable: true),
Required = table.Column<bool>(nullable: false),
Emphasize = table.Column<bool>(nullable: false),
ShowInDiscoveryDocument = table.Column<bool>(nullable: false),
ApiResourceId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ApiScopes", x => x.Id);
table.ForeignKey(
name: "FK_ApiScopes_ApiResources_ApiResourceId",
column: x => x.ApiResourceId,
principalTable: "ApiResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ApiSecrets",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Description = table.Column<string>(maxLength: 1000, nullable: true),
Value = table.Column<string>(maxLength: 4000, nullable: false),
Expiration = table.Column<DateTime>(nullable: true),
Type = table.Column<string>(maxLength: 250, nullable: false),
Created = table.Column<DateTime>(nullable: false),
ApiResourceId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ApiSecrets", x => x.Id);
table.ForeignKey(
name: "FK_ApiSecrets_ApiResources_ApiResourceId",
column: x => x.ApiResourceId,
principalTable: "ApiResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClientClaims",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Type = table.Column<string>(maxLength: 250, nullable: false),
Value = table.Column<string>(maxLength: 250, nullable: false),
ClientId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClientClaims", x => x.Id);
table.ForeignKey(
name: "FK_ClientClaims_Clients_ClientId",
column: x => x.ClientId,
principalTable: "Clients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClientCorsOrigins",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Origin = table.Column<string>(maxLength: 150, nullable: false),
ClientId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClientCorsOrigins", x => x.Id);
table.ForeignKey(
name: "FK_ClientCorsOrigins_Clients_ClientId",
column: x => x.ClientId,
principalTable: "Clients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClientGrantTypes",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
GrantType = table.Column<string>(maxLength: 250, nullable: false),
ClientId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClientGrantTypes", x => x.Id);
table.ForeignKey(
name: "FK_ClientGrantTypes_Clients_ClientId",
column: x => x.ClientId,
principalTable: "Clients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClientIdPRestrictions",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Provider = table.Column<string>(maxLength: 200, nullable: false),
ClientId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClientIdPRestrictions", x => x.Id);
table.ForeignKey(
name: "FK_ClientIdPRestrictions_Clients_ClientId",
column: x => x.ClientId,
principalTable: "Clients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClientPostLogoutRedirectUris",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
PostLogoutRedirectUri = table.Column<string>(maxLength: 2000, nullable: false),
ClientId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClientPostLogoutRedirectUris", x => x.Id);
table.ForeignKey(
name: "FK_ClientPostLogoutRedirectUris_Clients_ClientId",
column: x => x.ClientId,
principalTable: "Clients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClientProperties",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Key = table.Column<string>(maxLength: 250, nullable: false),
Value = table.Column<string>(maxLength: 2000, nullable: false),
ClientId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClientProperties", x => x.Id);
table.ForeignKey(
name: "FK_ClientProperties_Clients_ClientId",
column: x => x.ClientId,
principalTable: "Clients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClientRedirectUris",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
RedirectUri = table.Column<string>(maxLength: 2000, nullable: false),
ClientId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClientRedirectUris", x => x.Id);
table.ForeignKey(
name: "FK_ClientRedirectUris_Clients_ClientId",
column: x => x.ClientId,
principalTable: "Clients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClientScopes",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Scope = table.Column<string>(maxLength: 200, nullable: false),
ClientId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClientScopes", x => x.Id);
table.ForeignKey(
name: "FK_ClientScopes_Clients_ClientId",
column: x => x.ClientId,
principalTable: "Clients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ClientSecrets",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Description = table.Column<string>(maxLength: 2000, nullable: true),
Value = table.Column<string>(maxLength: 4000, nullable: false),
Expiration = table.Column<DateTime>(nullable: true),
Type = table.Column<string>(maxLength: 250, nullable: false),
Created = table.Column<DateTime>(nullable: false),
ClientId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ClientSecrets", x => x.Id);
table.ForeignKey(
name: "FK_ClientSecrets_Clients_ClientId",
column: x => x.ClientId,
principalTable: "Clients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "IdentityClaims",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Type = table.Column<string>(maxLength: 200, nullable: false),
IdentityResourceId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityClaims", x => x.Id);
table.ForeignKey(
name: "FK_IdentityClaims_IdentityResources_IdentityResourceId",
column: x => x.IdentityResourceId,
principalTable: "IdentityResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "IdentityProperties",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Key = table.Column<string>(maxLength: 250, nullable: false),
Value = table.Column<string>(maxLength: 2000, nullable: false),
IdentityResourceId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityProperties", x => x.Id);
table.ForeignKey(
name: "FK_IdentityProperties_IdentityResources_IdentityResourceId",
column: x => x.IdentityResourceId,
principalTable: "IdentityResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ApiScopeClaims",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Type = table.Column<string>(maxLength: 200, nullable: false),
ApiScopeId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ApiScopeClaims", x => x.Id);
table.ForeignKey(
name: "FK_ApiScopeClaims_ApiScopes_ApiScopeId",
column: x => x.ApiScopeId,
principalTable: "ApiScopes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_ApiClaims_ApiResourceId",
table: "ApiClaims",
column: "ApiResourceId");
migrationBuilder.CreateIndex(
name: "IX_ApiProperties_ApiResourceId",
table: "ApiProperties",
column: "ApiResourceId");
migrationBuilder.CreateIndex(
name: "IX_ApiResources_Name",
table: "ApiResources",
column: "Name",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ApiScopeClaims_ApiScopeId",
table: "ApiScopeClaims",
column: "ApiScopeId");
migrationBuilder.CreateIndex(
name: "IX_ApiScopes_ApiResourceId",
table: "ApiScopes",
column: "ApiResourceId");
migrationBuilder.CreateIndex(
name: "IX_ApiScopes_Name",
table: "ApiScopes",
column: "Name",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ApiSecrets_ApiResourceId",
table: "ApiSecrets",
column: "ApiResourceId");
migrationBuilder.CreateIndex(
name: "IX_ClientClaims_ClientId",
table: "ClientClaims",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_ClientCorsOrigins_ClientId",
table: "ClientCorsOrigins",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_ClientGrantTypes_ClientId",
table: "ClientGrantTypes",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_ClientIdPRestrictions_ClientId",
table: "ClientIdPRestrictions",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_ClientPostLogoutRedirectUris_ClientId",
table: "ClientPostLogoutRedirectUris",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_ClientProperties_ClientId",
table: "ClientProperties",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_ClientRedirectUris_ClientId",
table: "ClientRedirectUris",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_Clients_ClientId",
table: "Clients",
column: "ClientId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ClientScopes_ClientId",
table: "ClientScopes",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_ClientSecrets_ClientId",
table: "ClientSecrets",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_IdentityClaims_IdentityResourceId",
table: "IdentityClaims",
column: "IdentityResourceId");
migrationBuilder.CreateIndex(
name: "IX_IdentityProperties_IdentityResourceId",
table: "IdentityProperties",
column: "IdentityResourceId");
migrationBuilder.CreateIndex(
name: "IX_IdentityResources_Name",
table: "IdentityResources",
column: "Name",
unique: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ApiClaims");
migrationBuilder.DropTable(
name: "ApiProperties");
migrationBuilder.DropTable(
name: "ApiScopeClaims");
migrationBuilder.DropTable(
name: "ApiSecrets");
migrationBuilder.DropTable(
name: "ClientClaims");
migrationBuilder.DropTable(
name: "ClientCorsOrigins");
migrationBuilder.DropTable(
name: "ClientGrantTypes");
migrationBuilder.DropTable(
name: "ClientIdPRestrictions");
migrationBuilder.DropTable(
name: "ClientPostLogoutRedirectUris");
migrationBuilder.DropTable(
name: "ClientProperties");
migrationBuilder.DropTable(
name: "ClientRedirectUris");
migrationBuilder.DropTable(
name: "ClientScopes");
migrationBuilder.DropTable(
name: "ClientSecrets");
migrationBuilder.DropTable(
name: "IdentityClaims");
migrationBuilder.DropTable(
name: "IdentityProperties");
migrationBuilder.DropTable(
name: "ApiScopes");
migrationBuilder.DropTable(
name: "Clients");
migrationBuilder.DropTable(
name: "IdentityResources");
migrationBuilder.DropTable(
name: "ApiResources");
}
}
}
@@ -0,0 +1,905 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts;
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.IdentityServerConfiguration
{
[DbContext(typeof(IdentityServerConfigurationDbContext))]
[Migration("20201108170812_UpdateIdentityServerToVersion4")]
partial class UpdateIdentityServerToVersion4
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "3.1.9")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiResource", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("AllowedAccessTokenSigningAlgorithms")
.HasColumnType("character varying(100)")
.HasMaxLength(100);
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasColumnType("character varying(1000)")
.HasMaxLength(1000);
b.Property<string>("DisplayName")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<bool>("Enabled")
.HasColumnType("boolean");
b.Property<DateTime?>("LastAccessed")
.HasColumnType("timestamp without time zone");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<bool>("NonEditable")
.HasColumnType("boolean");
b.Property<bool>("ShowInDiscoveryDocument")
.HasColumnType("boolean");
b.Property<DateTime?>("Updated")
.HasColumnType("timestamp without time zone");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("ApiResources");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiResourceClaim", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiResourceId")
.HasColumnType("integer");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("ApiResourceId");
b.ToTable("ApiResourceClaims");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiResourceProperty", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiResourceId")
.HasColumnType("integer");
b.Property<string>("Key")
.IsRequired()
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("ApiResourceId");
b.ToTable("ApiResourceProperties");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiResourceScope", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiResourceId")
.HasColumnType("integer");
b.Property<string>("Scope")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("ApiResourceId");
b.ToTable("ApiResourceScopes");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiResourceSecret", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiResourceId")
.HasColumnType("integer");
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasColumnType("character varying(1000)")
.HasMaxLength(1000);
b.Property<DateTime?>("Expiration")
.HasColumnType("timestamp without time zone");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("character varying(4000)")
.HasMaxLength(4000);
b.HasKey("Id");
b.HasIndex("ApiResourceId");
b.ToTable("ApiResourceSecrets");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiScope", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Description")
.HasColumnType("character varying(1000)")
.HasMaxLength(1000);
b.Property<string>("DisplayName")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<bool>("Emphasize")
.HasColumnType("boolean");
b.Property<bool>("Enabled")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<bool>("Required")
.HasColumnType("boolean");
b.Property<bool>("ShowInDiscoveryDocument")
.HasColumnType("boolean");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("ApiScopes");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiScopeClaim", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ScopeId")
.HasColumnType("integer");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("ScopeId");
b.ToTable("ApiScopeClaims");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiScopeProperty", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Key")
.IsRequired()
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.Property<int>("ScopeId")
.HasColumnType("integer");
b.Property<string>("Value")
.IsRequired()
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("ScopeId");
b.ToTable("ApiScopeProperties");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.Client", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("AbsoluteRefreshTokenLifetime")
.HasColumnType("integer");
b.Property<int>("AccessTokenLifetime")
.HasColumnType("integer");
b.Property<int>("AccessTokenType")
.HasColumnType("integer");
b.Property<bool>("AllowAccessTokensViaBrowser")
.HasColumnType("boolean");
b.Property<bool>("AllowOfflineAccess")
.HasColumnType("boolean");
b.Property<bool>("AllowPlainTextPkce")
.HasColumnType("boolean");
b.Property<bool>("AllowRememberConsent")
.HasColumnType("boolean");
b.Property<string>("AllowedIdentityTokenSigningAlgorithms")
.HasColumnType("character varying(100)")
.HasMaxLength(100);
b.Property<bool>("AlwaysIncludeUserClaimsInIdToken")
.HasColumnType("boolean");
b.Property<bool>("AlwaysSendClientClaims")
.HasColumnType("boolean");
b.Property<int>("AuthorizationCodeLifetime")
.HasColumnType("integer");
b.Property<bool>("BackChannelLogoutSessionRequired")
.HasColumnType("boolean");
b.Property<string>("BackChannelLogoutUri")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.Property<string>("ClientClaimsPrefix")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<string>("ClientId")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<string>("ClientName")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<string>("ClientUri")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.Property<int?>("ConsentLifetime")
.HasColumnType("integer");
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasColumnType("character varying(1000)")
.HasMaxLength(1000);
b.Property<int>("DeviceCodeLifetime")
.HasColumnType("integer");
b.Property<bool>("EnableLocalLogin")
.HasColumnType("boolean");
b.Property<bool>("Enabled")
.HasColumnType("boolean");
b.Property<bool>("FrontChannelLogoutSessionRequired")
.HasColumnType("boolean");
b.Property<string>("FrontChannelLogoutUri")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.Property<int>("IdentityTokenLifetime")
.HasColumnType("integer");
b.Property<bool>("IncludeJwtId")
.HasColumnType("boolean");
b.Property<DateTime?>("LastAccessed")
.HasColumnType("timestamp without time zone");
b.Property<string>("LogoUri")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.Property<bool>("NonEditable")
.HasColumnType("boolean");
b.Property<string>("PairWiseSubjectSalt")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<string>("ProtocolType")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<int>("RefreshTokenExpiration")
.HasColumnType("integer");
b.Property<int>("RefreshTokenUsage")
.HasColumnType("integer");
b.Property<bool>("RequireClientSecret")
.HasColumnType("boolean");
b.Property<bool>("RequireConsent")
.HasColumnType("boolean");
b.Property<bool>("RequirePkce")
.HasColumnType("boolean");
b.Property<bool>("RequireRequestObject")
.HasColumnType("boolean");
b.Property<int>("SlidingRefreshTokenLifetime")
.HasColumnType("integer");
b.Property<bool>("UpdateAccessTokenClaimsOnRefresh")
.HasColumnType("boolean");
b.Property<DateTime?>("Updated")
.HasColumnType("timestamp without time zone");
b.Property<string>("UserCodeType")
.HasColumnType("character varying(100)")
.HasMaxLength(100);
b.Property<int?>("UserSsoLifetime")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ClientId")
.IsUnique();
b.ToTable("Clients");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientClaim", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientClaims");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientCorsOrigin", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("Origin")
.IsRequired()
.HasColumnType("character varying(150)")
.HasMaxLength(150);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientCorsOrigins");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientGrantType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("GrantType")
.IsRequired()
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientGrantTypes");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientIdPRestriction", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("Provider")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientIdPRestrictions");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientPostLogoutRedirectUri", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("PostLogoutRedirectUri")
.IsRequired()
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientPostLogoutRedirectUris");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientProperty", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("Key")
.IsRequired()
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientProperties");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientRedirectUri", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("RedirectUri")
.IsRequired()
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientRedirectUris");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientScope", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("Scope")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientScopes");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientSecret", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.Property<DateTime?>("Expiration")
.HasColumnType("timestamp without time zone");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("character varying(4000)")
.HasMaxLength(4000);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientSecrets");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.IdentityResource", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasColumnType("character varying(1000)")
.HasMaxLength(1000);
b.Property<string>("DisplayName")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<bool>("Emphasize")
.HasColumnType("boolean");
b.Property<bool>("Enabled")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<bool>("NonEditable")
.HasColumnType("boolean");
b.Property<bool>("Required")
.HasColumnType("boolean");
b.Property<bool>("ShowInDiscoveryDocument")
.HasColumnType("boolean");
b.Property<DateTime?>("Updated")
.HasColumnType("timestamp without time zone");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("IdentityResources");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.IdentityResourceClaim", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("IdentityResourceId")
.HasColumnType("integer");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("IdentityResourceId");
b.ToTable("IdentityResourceClaims");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.IdentityResourceProperty", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("IdentityResourceId")
.HasColumnType("integer");
b.Property<string>("Key")
.IsRequired()
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("IdentityResourceId");
b.ToTable("IdentityResourceProperties");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiResourceClaim", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.ApiResource", "ApiResource")
.WithMany("UserClaims")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiResourceProperty", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.ApiResource", "ApiResource")
.WithMany("Properties")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiResourceScope", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.ApiResource", "ApiResource")
.WithMany("Scopes")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiResourceSecret", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.ApiResource", "ApiResource")
.WithMany("Secrets")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiScopeClaim", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.ApiScope", "Scope")
.WithMany("UserClaims")
.HasForeignKey("ScopeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiScopeProperty", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.ApiScope", "Scope")
.WithMany("Properties")
.HasForeignKey("ScopeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientClaim", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.Client", "Client")
.WithMany("Claims")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientCorsOrigin", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.Client", "Client")
.WithMany("AllowedCorsOrigins")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientGrantType", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.Client", "Client")
.WithMany("AllowedGrantTypes")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientIdPRestriction", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.Client", "Client")
.WithMany("IdentityProviderRestrictions")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientPostLogoutRedirectUri", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.Client", "Client")
.WithMany("PostLogoutRedirectUris")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientProperty", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.Client", "Client")
.WithMany("Properties")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientRedirectUri", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.Client", "Client")
.WithMany("RedirectUris")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientScope", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.Client", "Client")
.WithMany("AllowedScopes")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientSecret", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.Client", "Client")
.WithMany("ClientSecrets")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.IdentityResourceClaim", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.IdentityResource", "IdentityResource")
.WithMany("UserClaims")
.HasForeignKey("IdentityResourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.IdentityResourceProperty", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.IdentityResource", "IdentityResource")
.WithMany("Properties")
.HasForeignKey("IdentityResourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,563 @@
// Original SQL scripts for database migration come from: https://github.com/RockSolidKnowledge/IdentityServer4.Migration.Scripts/blob/master/Postgres/ConfigurationDbContext.sql
// Modified by Jan Škoruba
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.IdentityServerConfiguration
{
public partial class UpdateIdentityServerToVersion4 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ApiClaims_ApiResources_ApiResourceId",
table: "ApiClaims");
migrationBuilder.DropForeignKey(
name: "FK_ApiProperties_ApiResources_ApiResourceId",
table: "ApiProperties");
migrationBuilder.DropForeignKey(
name: "FK_ApiScopeClaims_ApiScopes_ApiScopeId",
table: "ApiScopeClaims");
migrationBuilder.DropForeignKey(
name: "FK_ApiScopes_ApiResources_ApiResourceId",
table: "ApiScopes");
migrationBuilder.DropForeignKey(
name: "FK_IdentityProperties_IdentityResources_IdentityResourceId",
table: "IdentityProperties");
migrationBuilder.DropIndex(
name: "IX_ApiScopes_ApiResourceId",
table: "ApiScopes");
migrationBuilder.DropIndex(
name: "IX_ApiScopeClaims_ApiScopeId",
table: "ApiScopeClaims");
migrationBuilder.DropPrimaryKey(
name: "PK_IdentityProperties",
table: "IdentityProperties");
migrationBuilder.DropPrimaryKey(
name: "PK_ApiProperties",
table: "ApiProperties");
migrationBuilder.DropPrimaryKey(
name: "PK_ApiClaims",
table: "ApiClaims");
migrationBuilder.RenameTable(
name: "IdentityProperties",
newName: "IdentityResourceProperties");
migrationBuilder.RenameTable(
name: "ApiProperties",
newName: "ApiResourceProperties");
migrationBuilder.RenameTable(
name: "ApiClaims",
newName: "ApiResourceClaims");
migrationBuilder.RenameIndex(
name: "IX_IdentityProperties_IdentityResourceId",
table: "IdentityResourceProperties",
newName: "IX_IdentityResourceProperties_IdentityResourceId");
migrationBuilder.RenameIndex(
name: "IX_ApiProperties_ApiResourceId",
table: "ApiResourceProperties",
newName: "IX_ApiResourceProperties_ApiResourceId");
migrationBuilder.RenameIndex(
name: "IX_ApiClaims_ApiResourceId",
table: "ApiResourceClaims",
newName: "IX_ApiResourceClaims_ApiResourceId");
migrationBuilder.AddColumn<string>(
name: "AllowedIdentityTokenSigningAlgorithms",
table: "Clients",
maxLength: 100,
nullable: true);
migrationBuilder.AddColumn<bool>(
name: "RequireRequestObject",
table: "Clients",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "Enabled",
table: "ApiScopes",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<int>(
name: "ScopeId",
table: "ApiScopeClaims",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<string>(
name: "AllowedAccessTokenSigningAlgorithms",
table: "ApiResources",
maxLength: 100,
nullable: true);
migrationBuilder.AddColumn<bool>(
name: "ShowInDiscoveryDocument",
table: "ApiResources",
nullable: false,
defaultValue: false);
migrationBuilder.AddPrimaryKey(
name: "PK_IdentityResourceProperties",
table: "IdentityResourceProperties",
column: "Id");
migrationBuilder.AddPrimaryKey(
name: "PK_ApiResourceProperties",
table: "ApiResourceProperties",
column: "Id");
migrationBuilder.AddPrimaryKey(
name: "PK_ApiResourceClaims",
table: "ApiResourceClaims",
column: "Id");
migrationBuilder.CreateTable(
name: "ApiResourceScopes",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Scope = table.Column<string>(maxLength: 200, nullable: false),
ApiResourceId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ApiResourceScopes", x => x.Id);
table.ForeignKey(
name: "FK_ApiResourceScopes_ApiResources_ApiResourceId",
column: x => x.ApiResourceId,
principalTable: "ApiResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ApiResourceSecrets",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Description = table.Column<string>(maxLength: 1000, nullable: true),
Value = table.Column<string>(maxLength: 4000, nullable: false),
Expiration = table.Column<DateTime>(nullable: true),
Type = table.Column<string>(maxLength: 250, nullable: false),
Created = table.Column<DateTime>(nullable: false),
ApiResourceId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ApiResourceSecrets", x => x.Id);
table.ForeignKey(
name: "FK_ApiResourceSecrets_ApiResources_ApiResourceId",
column: x => x.ApiResourceId,
principalTable: "ApiResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ApiScopeProperties",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Key = table.Column<string>(maxLength: 250, nullable: false),
Value = table.Column<string>(maxLength: 2000, nullable: false),
ScopeId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ApiScopeProperties", x => x.Id);
table.ForeignKey(
name: "FK_ApiScopeProperties_ApiScopes_ScopeId",
column: x => x.ScopeId,
principalTable: "ApiScopes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "IdentityResourceClaims",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Type = table.Column<string>(maxLength: 200, nullable: false),
IdentityResourceId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityResourceClaims", x => x.Id);
table.ForeignKey(
name: "FK_IdentityResourceClaims_IdentityResources_IdentityResourceId",
column: x => x.IdentityResourceId,
principalTable: "IdentityResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_ApiScopeClaims_ScopeId",
table: "ApiScopeClaims",
column: "ScopeId");
migrationBuilder.CreateIndex(
name: "IX_ApiResourceScopes_ApiResourceId",
table: "ApiResourceScopes",
column: "ApiResourceId");
migrationBuilder.CreateIndex(
name: "IX_ApiResourceSecrets_ApiResourceId",
table: "ApiResourceSecrets",
column: "ApiResourceId");
migrationBuilder.CreateIndex(
name: "IX_ApiScopeProperties_ScopeId",
table: "ApiScopeProperties",
column: "ScopeId");
migrationBuilder.CreateIndex(
name: "IX_IdentityResourceClaims_IdentityResourceId",
table: "IdentityResourceClaims",
column: "IdentityResourceId");
migrationBuilder.AddForeignKey(
name: "FK_ApiResourceClaims_ApiResources_ApiResourceId",
table: "ApiResourceClaims",
column: "ApiResourceId",
principalTable: "ApiResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
// migrate data
migrationBuilder.Sql(@"INSERT INTO ""ApiResourceSecrets""
(""Id"", ""Description"", ""Value"", ""Expiration"", ""Type"", ""Created"", ""ApiResourceId"")
SELECT
""Id"", ""Description"", ""Value"", ""Expiration"", ""Type"", ""Created"", ""ApiResourceId""
FROM ""ApiSecrets"";");
migrationBuilder.Sql(@"INSERT INTO ""IdentityResourceClaims""
(""Id"", ""Type"", ""IdentityResourceId"")
SELECT
""Id"", ""Type"", ""IdentityResourceId""
FROM ""IdentityClaims"";");
migrationBuilder.Sql(@"INSERT INTO ""ApiResourceScopes""
(""Scope"", ""ApiResourceId"")
SELECT
""Name"", ""ApiResourceId""
FROM ""ApiScopes"";");
migrationBuilder.Sql(@"UPDATE ""ApiScopeClaims"" SET ""ScopeId"" = ""ApiScopeId"";");
migrationBuilder.Sql(@"UPDATE ""ApiScopes"" SET ""Enabled"" = TRUE;");
migrationBuilder.DropTable(
name: "ApiSecrets");
migrationBuilder.DropTable(
name: "IdentityClaims");
migrationBuilder.DropColumn(
name: "ApiResourceId",
table: "ApiScopes");
migrationBuilder.DropColumn(
name: "ApiScopeId",
table: "ApiScopeClaims");
migrationBuilder.AddForeignKey(
name: "FK_ApiResourceProperties_ApiResources_ApiResourceId",
table: "ApiResourceProperties",
column: "ApiResourceId",
principalTable: "ApiResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_ApiScopeClaims_ApiScopes_ScopeId",
table: "ApiScopeClaims",
column: "ScopeId",
principalTable: "ApiScopes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityResourceProperties_IdentityResources_IdentityResour~",
table: "IdentityResourceProperties",
column: "IdentityResourceId",
principalTable: "IdentityResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ApiResourceClaims_ApiResources_ApiResourceId",
table: "ApiResourceClaims");
migrationBuilder.DropForeignKey(
name: "FK_ApiResourceProperties_ApiResources_ApiResourceId",
table: "ApiResourceProperties");
migrationBuilder.DropForeignKey(
name: "FK_ApiScopeClaims_ApiScopes_ScopeId",
table: "ApiScopeClaims");
migrationBuilder.DropForeignKey(
name: "FK_IdentityResourceProperties_IdentityResources_IdentityResour~",
table: "IdentityResourceProperties");
migrationBuilder.DropIndex(
name: "IX_ApiScopeClaims_ScopeId",
table: "ApiScopeClaims");
migrationBuilder.DropPrimaryKey(
name: "PK_IdentityResourceProperties",
table: "IdentityResourceProperties");
migrationBuilder.DropPrimaryKey(
name: "PK_ApiResourceProperties",
table: "ApiResourceProperties");
migrationBuilder.DropPrimaryKey(
name: "PK_ApiResourceClaims",
table: "ApiResourceClaims");
migrationBuilder.RenameTable(
name: "IdentityResourceProperties",
newName: "IdentityProperties");
migrationBuilder.RenameTable(
name: "ApiResourceProperties",
newName: "ApiProperties");
migrationBuilder.RenameTable(
name: "ApiResourceClaims",
newName: "ApiClaims");
migrationBuilder.RenameIndex(
name: "IX_IdentityResourceProperties_IdentityResourceId",
table: "IdentityProperties",
newName: "IX_IdentityProperties_IdentityResourceId");
migrationBuilder.RenameIndex(
name: "IX_ApiResourceProperties_ApiResourceId",
table: "ApiProperties",
newName: "IX_ApiProperties_ApiResourceId");
migrationBuilder.RenameIndex(
name: "IX_ApiResourceClaims_ApiResourceId",
table: "ApiClaims",
newName: "IX_ApiClaims_ApiResourceId");
migrationBuilder.AddColumn<int>(
name: "ApiResourceId",
table: "ApiScopes",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "ApiScopeId",
table: "ApiScopeClaims",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddPrimaryKey(
name: "PK_IdentityProperties",
table: "IdentityProperties",
column: "Id");
migrationBuilder.AddPrimaryKey(
name: "PK_ApiProperties",
table: "ApiProperties",
column: "Id");
migrationBuilder.AddPrimaryKey(
name: "PK_ApiClaims",
table: "ApiClaims",
column: "Id");
migrationBuilder.CreateTable(
name: "ApiSecrets",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ApiResourceId = table.Column<int>(type: "integer", nullable: false),
Created = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
Description = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true),
Expiration = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
Type = table.Column<string>(type: "character varying(250)", maxLength: 250, nullable: false),
Value = table.Column<string>(type: "character varying(4000)", maxLength: 4000, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ApiSecrets", x => x.Id);
table.ForeignKey(
name: "FK_ApiSecrets_ApiResources_ApiResourceId",
column: x => x.ApiResourceId,
principalTable: "ApiResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "IdentityClaims",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
IdentityResourceId = table.Column<int>(type: "integer", nullable: false),
Type = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityClaims", x => x.Id);
table.ForeignKey(
name: "FK_IdentityClaims_IdentityResources_IdentityResourceId",
column: x => x.IdentityResourceId,
principalTable: "IdentityResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_ApiScopes_ApiResourceId",
table: "ApiScopes",
column: "ApiResourceId");
migrationBuilder.CreateIndex(
name: "IX_ApiScopeClaims_ApiScopeId",
table: "ApiScopeClaims",
column: "ApiScopeId");
migrationBuilder.CreateIndex(
name: "IX_ApiSecrets_ApiResourceId",
table: "ApiSecrets",
column: "ApiResourceId");
migrationBuilder.CreateIndex(
name: "IX_IdentityClaims_IdentityResourceId",
table: "IdentityClaims",
column: "IdentityResourceId");
migrationBuilder.AddForeignKey(
name: "FK_ApiClaims_ApiResources_ApiResourceId",
table: "ApiClaims",
column: "ApiResourceId",
principalTable: "ApiResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_ApiProperties_ApiResources_ApiResourceId",
table: "ApiProperties",
column: "ApiResourceId",
principalTable: "ApiResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
// Rollback data back
migrationBuilder.Sql(@"INSERT INTO ""ApiSecrets""
(""Id"", ""Description"", ""Value"", ""Expiration"", ""Type"", ""Created"", ""ApiResourceId"")
SELECT ""Id"", ""Description"", ""Value"", ""Expiration"", ""Type"", ""Created"", ""ApiResourceId""
FROM ""ApiResourceSecrets"";");
migrationBuilder.Sql(@"INSERT INTO ""IdentityClaims""
(""Id"", ""Type"", ""IdentityResourceId"")
SELECT
""Id"", ""Type"", ""IdentityResourceId""
FROM ""IdentityResourceClaims"";");
migrationBuilder.Sql(@"UPDATE ""ApiScopes"" asp
SET ""ApiResourceId"" = arc.""ApiResourceId""
FROM ""ApiResourceScopes"" arc
WHERE arc.""Id"" = asp.""Id"";");
migrationBuilder.Sql(@"UPDATE ""ApiScopeClaims"" SET ""ApiScopeId"" = ""ScopeId"";");
migrationBuilder.DropTable(
name: "ApiResourceScopes");
migrationBuilder.DropTable(
name: "ApiResourceSecrets");
migrationBuilder.DropTable(
name: "ApiScopeProperties");
migrationBuilder.DropTable(
name: "IdentityResourceClaims");
migrationBuilder.DropColumn(
name: "AllowedIdentityTokenSigningAlgorithms",
table: "Clients");
migrationBuilder.DropColumn(
name: "RequireRequestObject",
table: "Clients");
migrationBuilder.DropColumn(
name: "Enabled",
table: "ApiScopes");
migrationBuilder.DropColumn(
name: "ScopeId",
table: "ApiScopeClaims");
migrationBuilder.DropColumn(
name: "AllowedAccessTokenSigningAlgorithms",
table: "ApiResources");
migrationBuilder.DropColumn(
name: "ShowInDiscoveryDocument",
table: "ApiResources");
migrationBuilder.AddForeignKey(
name: "FK_ApiScopeClaims_ApiScopes_ApiScopeId",
table: "ApiScopeClaims",
column: "ApiScopeId",
principalTable: "ApiScopes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_ApiScopes_ApiResources_ApiResourceId",
table: "ApiScopes",
column: "ApiResourceId",
principalTable: "ApiResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityProperties_IdentityResources_IdentityResourceId",
table: "IdentityProperties",
column: "IdentityResourceId",
principalTable: "IdentityResources",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}
@@ -0,0 +1,908 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts;
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.IdentityServerConfiguration
{
[DbContext(typeof(IdentityServerConfigurationDbContext))]
[Migration("20210310153645_AddRequireResourceIndicator")]
partial class AddRequireResourceIndicator
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "3.1.9")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiResource", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("AllowedAccessTokenSigningAlgorithms")
.HasColumnType("character varying(100)")
.HasMaxLength(100);
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasColumnType("character varying(1000)")
.HasMaxLength(1000);
b.Property<string>("DisplayName")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<bool>("Enabled")
.HasColumnType("boolean");
b.Property<DateTime?>("LastAccessed")
.HasColumnType("timestamp without time zone");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<bool>("NonEditable")
.HasColumnType("boolean");
b.Property<bool>("RequireResourceIndicator")
.HasColumnType("boolean");
b.Property<bool>("ShowInDiscoveryDocument")
.HasColumnType("boolean");
b.Property<DateTime?>("Updated")
.HasColumnType("timestamp without time zone");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("ApiResources");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiResourceClaim", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiResourceId")
.HasColumnType("integer");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("ApiResourceId");
b.ToTable("ApiResourceClaims");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiResourceProperty", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiResourceId")
.HasColumnType("integer");
b.Property<string>("Key")
.IsRequired()
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("ApiResourceId");
b.ToTable("ApiResourceProperties");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiResourceScope", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiResourceId")
.HasColumnType("integer");
b.Property<string>("Scope")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("ApiResourceId");
b.ToTable("ApiResourceScopes");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiResourceSecret", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ApiResourceId")
.HasColumnType("integer");
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasColumnType("character varying(1000)")
.HasMaxLength(1000);
b.Property<DateTime?>("Expiration")
.HasColumnType("timestamp without time zone");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("character varying(4000)")
.HasMaxLength(4000);
b.HasKey("Id");
b.HasIndex("ApiResourceId");
b.ToTable("ApiResourceSecrets");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiScope", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Description")
.HasColumnType("character varying(1000)")
.HasMaxLength(1000);
b.Property<string>("DisplayName")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<bool>("Emphasize")
.HasColumnType("boolean");
b.Property<bool>("Enabled")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<bool>("Required")
.HasColumnType("boolean");
b.Property<bool>("ShowInDiscoveryDocument")
.HasColumnType("boolean");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("ApiScopes");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiScopeClaim", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ScopeId")
.HasColumnType("integer");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("ScopeId");
b.ToTable("ApiScopeClaims");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiScopeProperty", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Key")
.IsRequired()
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.Property<int>("ScopeId")
.HasColumnType("integer");
b.Property<string>("Value")
.IsRequired()
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("ScopeId");
b.ToTable("ApiScopeProperties");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.Client", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("AbsoluteRefreshTokenLifetime")
.HasColumnType("integer");
b.Property<int>("AccessTokenLifetime")
.HasColumnType("integer");
b.Property<int>("AccessTokenType")
.HasColumnType("integer");
b.Property<bool>("AllowAccessTokensViaBrowser")
.HasColumnType("boolean");
b.Property<bool>("AllowOfflineAccess")
.HasColumnType("boolean");
b.Property<bool>("AllowPlainTextPkce")
.HasColumnType("boolean");
b.Property<bool>("AllowRememberConsent")
.HasColumnType("boolean");
b.Property<string>("AllowedIdentityTokenSigningAlgorithms")
.HasColumnType("character varying(100)")
.HasMaxLength(100);
b.Property<bool>("AlwaysIncludeUserClaimsInIdToken")
.HasColumnType("boolean");
b.Property<bool>("AlwaysSendClientClaims")
.HasColumnType("boolean");
b.Property<int>("AuthorizationCodeLifetime")
.HasColumnType("integer");
b.Property<bool>("BackChannelLogoutSessionRequired")
.HasColumnType("boolean");
b.Property<string>("BackChannelLogoutUri")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.Property<string>("ClientClaimsPrefix")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<string>("ClientId")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<string>("ClientName")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<string>("ClientUri")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.Property<int?>("ConsentLifetime")
.HasColumnType("integer");
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasColumnType("character varying(1000)")
.HasMaxLength(1000);
b.Property<int>("DeviceCodeLifetime")
.HasColumnType("integer");
b.Property<bool>("EnableLocalLogin")
.HasColumnType("boolean");
b.Property<bool>("Enabled")
.HasColumnType("boolean");
b.Property<bool>("FrontChannelLogoutSessionRequired")
.HasColumnType("boolean");
b.Property<string>("FrontChannelLogoutUri")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.Property<int>("IdentityTokenLifetime")
.HasColumnType("integer");
b.Property<bool>("IncludeJwtId")
.HasColumnType("boolean");
b.Property<DateTime?>("LastAccessed")
.HasColumnType("timestamp without time zone");
b.Property<string>("LogoUri")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.Property<bool>("NonEditable")
.HasColumnType("boolean");
b.Property<string>("PairWiseSubjectSalt")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<string>("ProtocolType")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<int>("RefreshTokenExpiration")
.HasColumnType("integer");
b.Property<int>("RefreshTokenUsage")
.HasColumnType("integer");
b.Property<bool>("RequireClientSecret")
.HasColumnType("boolean");
b.Property<bool>("RequireConsent")
.HasColumnType("boolean");
b.Property<bool>("RequirePkce")
.HasColumnType("boolean");
b.Property<bool>("RequireRequestObject")
.HasColumnType("boolean");
b.Property<int>("SlidingRefreshTokenLifetime")
.HasColumnType("integer");
b.Property<bool>("UpdateAccessTokenClaimsOnRefresh")
.HasColumnType("boolean");
b.Property<DateTime?>("Updated")
.HasColumnType("timestamp without time zone");
b.Property<string>("UserCodeType")
.HasColumnType("character varying(100)")
.HasMaxLength(100);
b.Property<int?>("UserSsoLifetime")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ClientId")
.IsUnique();
b.ToTable("Clients");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientClaim", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientClaims");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientCorsOrigin", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("Origin")
.IsRequired()
.HasColumnType("character varying(150)")
.HasMaxLength(150);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientCorsOrigins");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientGrantType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("GrantType")
.IsRequired()
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientGrantTypes");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientIdPRestriction", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("Provider")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientIdPRestrictions");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientPostLogoutRedirectUri", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("PostLogoutRedirectUri")
.IsRequired()
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientPostLogoutRedirectUris");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientProperty", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("Key")
.IsRequired()
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientProperties");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientRedirectUri", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("RedirectUri")
.IsRequired()
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientRedirectUris");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientScope", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<string>("Scope")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientScopes");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientSecret", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.Property<DateTime?>("Expiration")
.HasColumnType("timestamp without time zone");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("character varying(4000)")
.HasMaxLength(4000);
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("ClientSecrets");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.IdentityResource", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Description")
.HasColumnType("character varying(1000)")
.HasMaxLength(1000);
b.Property<string>("DisplayName")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<bool>("Emphasize")
.HasColumnType("boolean");
b.Property<bool>("Enabled")
.HasColumnType("boolean");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<bool>("NonEditable")
.HasColumnType("boolean");
b.Property<bool>("Required")
.HasColumnType("boolean");
b.Property<bool>("ShowInDiscoveryDocument")
.HasColumnType("boolean");
b.Property<DateTime?>("Updated")
.HasColumnType("timestamp without time zone");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("IdentityResources");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.IdentityResourceClaim", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("IdentityResourceId")
.HasColumnType("integer");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.HasKey("Id");
b.HasIndex("IdentityResourceId");
b.ToTable("IdentityResourceClaims");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.IdentityResourceProperty", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("IdentityResourceId")
.HasColumnType("integer");
b.Property<string>("Key")
.IsRequired()
.HasColumnType("character varying(250)")
.HasMaxLength(250);
b.Property<string>("Value")
.IsRequired()
.HasColumnType("character varying(2000)")
.HasMaxLength(2000);
b.HasKey("Id");
b.HasIndex("IdentityResourceId");
b.ToTable("IdentityResourceProperties");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiResourceClaim", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.ApiResource", "ApiResource")
.WithMany("UserClaims")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiResourceProperty", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.ApiResource", "ApiResource")
.WithMany("Properties")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiResourceScope", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.ApiResource", "ApiResource")
.WithMany("Scopes")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiResourceSecret", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.ApiResource", "ApiResource")
.WithMany("Secrets")
.HasForeignKey("ApiResourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiScopeClaim", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.ApiScope", "Scope")
.WithMany("UserClaims")
.HasForeignKey("ScopeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ApiScopeProperty", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.ApiScope", "Scope")
.WithMany("Properties")
.HasForeignKey("ScopeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientClaim", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.Client", "Client")
.WithMany("Claims")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientCorsOrigin", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.Client", "Client")
.WithMany("AllowedCorsOrigins")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientGrantType", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.Client", "Client")
.WithMany("AllowedGrantTypes")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientIdPRestriction", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.Client", "Client")
.WithMany("IdentityProviderRestrictions")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientPostLogoutRedirectUri", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.Client", "Client")
.WithMany("PostLogoutRedirectUris")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientProperty", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.Client", "Client")
.WithMany("Properties")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientRedirectUri", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.Client", "Client")
.WithMany("RedirectUris")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientScope", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.Client", "Client")
.WithMany("AllowedScopes")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ClientSecret", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.Client", "Client")
.WithMany("ClientSecrets")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.IdentityResourceClaim", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.IdentityResource", "IdentityResource")
.WithMany("UserClaims")
.HasForeignKey("IdentityResourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.IdentityResourceProperty", b =>
{
b.HasOne("Duende.IdentityServer.EntityFramework.Entities.IdentityResource", "IdentityResource")
.WithMany("Properties")
.HasForeignKey("IdentityResourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,23 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.IdentityServerConfiguration
{
public partial class AddRequireResourceIndicator : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "RequireResourceIndicator",
table: "ApiResources",
nullable: false,
defaultValue: false);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "RequireResourceIndicator",
table: "ApiResources");
}
}
}
@@ -0,0 +1,34 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.IdentityServerConfiguration
{
public partial class UpdateISKeysIDP : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "IdentityProviders",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Scheme = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
DisplayName = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
Enabled = table.Column<bool>(type: "boolean", nullable: false),
Type = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
Properties = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityProviders", x => x.Id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "IdentityProviders");
}
}
}
@@ -0,0 +1,455 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.IdentityServerConfiguration
{
public partial class UpdateToIS6 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_IdentityResourceProperties_IdentityResourceId",
table: "IdentityResourceProperties");
migrationBuilder.DropIndex(
name: "IX_IdentityResourceClaims_IdentityResourceId",
table: "IdentityResourceClaims");
migrationBuilder.DropIndex(
name: "IX_ClientScopes_ClientId",
table: "ClientScopes");
migrationBuilder.DropIndex(
name: "IX_ClientRedirectUris_ClientId",
table: "ClientRedirectUris");
migrationBuilder.DropIndex(
name: "IX_ClientProperties_ClientId",
table: "ClientProperties");
migrationBuilder.DropIndex(
name: "IX_ClientPostLogoutRedirectUris_ClientId",
table: "ClientPostLogoutRedirectUris");
migrationBuilder.DropIndex(
name: "IX_ClientIdPRestrictions_ClientId",
table: "ClientIdPRestrictions");
migrationBuilder.DropIndex(
name: "IX_ClientGrantTypes_ClientId",
table: "ClientGrantTypes");
migrationBuilder.DropIndex(
name: "IX_ClientCorsOrigins_ClientId",
table: "ClientCorsOrigins");
migrationBuilder.DropIndex(
name: "IX_ClientClaims_ClientId",
table: "ClientClaims");
migrationBuilder.DropIndex(
name: "IX_ApiScopeProperties_ScopeId",
table: "ApiScopeProperties");
migrationBuilder.DropIndex(
name: "IX_ApiScopeClaims_ScopeId",
table: "ApiScopeClaims");
migrationBuilder.DropIndex(
name: "IX_ApiResourceScopes_ApiResourceId",
table: "ApiResourceScopes");
migrationBuilder.DropIndex(
name: "IX_ApiResourceProperties_ApiResourceId",
table: "ApiResourceProperties");
migrationBuilder.DropIndex(
name: "IX_ApiResourceClaims_ApiResourceId",
table: "ApiResourceClaims");
migrationBuilder.AddColumn<DateTime>(
name: "Created",
table: "IdentityProviders",
type: "timestamp without time zone",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<DateTime>(
name: "LastAccessed",
table: "IdentityProviders",
type: "timestamp without time zone",
nullable: true);
migrationBuilder.AddColumn<bool>(
name: "NonEditable",
table: "IdentityProviders",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<DateTime>(
name: "Updated",
table: "IdentityProviders",
type: "timestamp without time zone",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "CibaLifetime",
table: "Clients",
type: "integer",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "PollingInterval",
table: "Clients",
type: "integer",
nullable: true);
migrationBuilder.AlterColumn<string>(
name: "RedirectUri",
table: "ClientRedirectUris",
type: "character varying(400)",
maxLength: 400,
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(2000)",
oldMaxLength: 2000);
migrationBuilder.AlterColumn<string>(
name: "PostLogoutRedirectUri",
table: "ClientPostLogoutRedirectUris",
type: "character varying(400)",
maxLength: 400,
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(2000)",
oldMaxLength: 2000);
migrationBuilder.AddColumn<DateTime>(
name: "Created",
table: "ApiScopes",
type: "timestamp without time zone",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<DateTime>(
name: "LastAccessed",
table: "ApiScopes",
type: "timestamp without time zone",
nullable: true);
migrationBuilder.AddColumn<bool>(
name: "NonEditable",
table: "ApiScopes",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<DateTime>(
name: "Updated",
table: "ApiScopes",
type: "timestamp without time zone",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_IdentityResourceProperties_IdentityResourceId_Key",
table: "IdentityResourceProperties",
columns: new[] { "IdentityResourceId", "Key" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_IdentityResourceClaims_IdentityResourceId_Type",
table: "IdentityResourceClaims",
columns: new[] { "IdentityResourceId", "Type" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_IdentityProviders_Scheme",
table: "IdentityProviders",
column: "Scheme",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ClientScopes_ClientId_Scope",
table: "ClientScopes",
columns: new[] { "ClientId", "Scope" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ClientRedirectUris_ClientId_RedirectUri",
table: "ClientRedirectUris",
columns: new[] { "ClientId", "RedirectUri" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ClientProperties_ClientId_Key",
table: "ClientProperties",
columns: new[] { "ClientId", "Key" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ClientPostLogoutRedirectUris_ClientId_PostLogoutRedirectUri",
table: "ClientPostLogoutRedirectUris",
columns: new[] { "ClientId", "PostLogoutRedirectUri" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ClientIdPRestrictions_ClientId_Provider",
table: "ClientIdPRestrictions",
columns: new[] { "ClientId", "Provider" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ClientGrantTypes_ClientId_GrantType",
table: "ClientGrantTypes",
columns: new[] { "ClientId", "GrantType" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ClientCorsOrigins_ClientId_Origin",
table: "ClientCorsOrigins",
columns: new[] { "ClientId", "Origin" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ClientClaims_ClientId_Type_Value",
table: "ClientClaims",
columns: new[] { "ClientId", "Type", "Value" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ApiScopeProperties_ScopeId_Key",
table: "ApiScopeProperties",
columns: new[] { "ScopeId", "Key" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ApiScopeClaims_ScopeId_Type",
table: "ApiScopeClaims",
columns: new[] { "ScopeId", "Type" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ApiResourceScopes_ApiResourceId_Scope",
table: "ApiResourceScopes",
columns: new[] { "ApiResourceId", "Scope" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ApiResourceProperties_ApiResourceId_Key",
table: "ApiResourceProperties",
columns: new[] { "ApiResourceId", "Key" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ApiResourceClaims_ApiResourceId_Type",
table: "ApiResourceClaims",
columns: new[] { "ApiResourceId", "Type" },
unique: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_IdentityResourceProperties_IdentityResourceId_Key",
table: "IdentityResourceProperties");
migrationBuilder.DropIndex(
name: "IX_IdentityResourceClaims_IdentityResourceId_Type",
table: "IdentityResourceClaims");
migrationBuilder.DropIndex(
name: "IX_IdentityProviders_Scheme",
table: "IdentityProviders");
migrationBuilder.DropIndex(
name: "IX_ClientScopes_ClientId_Scope",
table: "ClientScopes");
migrationBuilder.DropIndex(
name: "IX_ClientRedirectUris_ClientId_RedirectUri",
table: "ClientRedirectUris");
migrationBuilder.DropIndex(
name: "IX_ClientProperties_ClientId_Key",
table: "ClientProperties");
migrationBuilder.DropIndex(
name: "IX_ClientPostLogoutRedirectUris_ClientId_PostLogoutRedirectUri",
table: "ClientPostLogoutRedirectUris");
migrationBuilder.DropIndex(
name: "IX_ClientIdPRestrictions_ClientId_Provider",
table: "ClientIdPRestrictions");
migrationBuilder.DropIndex(
name: "IX_ClientGrantTypes_ClientId_GrantType",
table: "ClientGrantTypes");
migrationBuilder.DropIndex(
name: "IX_ClientCorsOrigins_ClientId_Origin",
table: "ClientCorsOrigins");
migrationBuilder.DropIndex(
name: "IX_ClientClaims_ClientId_Type_Value",
table: "ClientClaims");
migrationBuilder.DropIndex(
name: "IX_ApiScopeProperties_ScopeId_Key",
table: "ApiScopeProperties");
migrationBuilder.DropIndex(
name: "IX_ApiScopeClaims_ScopeId_Type",
table: "ApiScopeClaims");
migrationBuilder.DropIndex(
name: "IX_ApiResourceScopes_ApiResourceId_Scope",
table: "ApiResourceScopes");
migrationBuilder.DropIndex(
name: "IX_ApiResourceProperties_ApiResourceId_Key",
table: "ApiResourceProperties");
migrationBuilder.DropIndex(
name: "IX_ApiResourceClaims_ApiResourceId_Type",
table: "ApiResourceClaims");
migrationBuilder.DropColumn(
name: "Created",
table: "IdentityProviders");
migrationBuilder.DropColumn(
name: "LastAccessed",
table: "IdentityProviders");
migrationBuilder.DropColumn(
name: "NonEditable",
table: "IdentityProviders");
migrationBuilder.DropColumn(
name: "Updated",
table: "IdentityProviders");
migrationBuilder.DropColumn(
name: "CibaLifetime",
table: "Clients");
migrationBuilder.DropColumn(
name: "PollingInterval",
table: "Clients");
migrationBuilder.DropColumn(
name: "Created",
table: "ApiScopes");
migrationBuilder.DropColumn(
name: "LastAccessed",
table: "ApiScopes");
migrationBuilder.DropColumn(
name: "NonEditable",
table: "ApiScopes");
migrationBuilder.DropColumn(
name: "Updated",
table: "ApiScopes");
migrationBuilder.AlterColumn<string>(
name: "RedirectUri",
table: "ClientRedirectUris",
type: "character varying(2000)",
maxLength: 2000,
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(400)",
oldMaxLength: 400);
migrationBuilder.AlterColumn<string>(
name: "PostLogoutRedirectUri",
table: "ClientPostLogoutRedirectUris",
type: "character varying(2000)",
maxLength: 2000,
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(400)",
oldMaxLength: 400);
migrationBuilder.CreateIndex(
name: "IX_IdentityResourceProperties_IdentityResourceId",
table: "IdentityResourceProperties",
column: "IdentityResourceId");
migrationBuilder.CreateIndex(
name: "IX_IdentityResourceClaims_IdentityResourceId",
table: "IdentityResourceClaims",
column: "IdentityResourceId");
migrationBuilder.CreateIndex(
name: "IX_ClientScopes_ClientId",
table: "ClientScopes",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_ClientRedirectUris_ClientId",
table: "ClientRedirectUris",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_ClientProperties_ClientId",
table: "ClientProperties",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_ClientPostLogoutRedirectUris_ClientId",
table: "ClientPostLogoutRedirectUris",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_ClientIdPRestrictions_ClientId",
table: "ClientIdPRestrictions",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_ClientGrantTypes_ClientId",
table: "ClientGrantTypes",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_ClientCorsOrigins_ClientId",
table: "ClientCorsOrigins",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_ClientClaims_ClientId",
table: "ClientClaims",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_ApiScopeProperties_ScopeId",
table: "ApiScopeProperties",
column: "ScopeId");
migrationBuilder.CreateIndex(
name: "IX_ApiScopeClaims_ScopeId",
table: "ApiScopeClaims",
column: "ScopeId");
migrationBuilder.CreateIndex(
name: "IX_ApiResourceScopes_ApiResourceId",
table: "ApiResourceScopes",
column: "ApiResourceId");
migrationBuilder.CreateIndex(
name: "IX_ApiResourceProperties_ApiResourceId",
table: "ApiResourceProperties",
column: "ApiResourceId");
migrationBuilder.CreateIndex(
name: "IX_ApiResourceClaims_ApiResourceId",
table: "ApiResourceClaims",
column: "ApiResourceId");
}
}
}
@@ -0,0 +1,25 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.IdentityServerConfiguration
{
public partial class UpdateToIS61 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "CoordinateLifetimeWithUserSession",
table: "Clients",
type: "boolean",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "CoordinateLifetimeWithUserSession",
table: "Clients");
}
}
}
@@ -0,0 +1,84 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.IdentityServerConfiguration
{
/// <inheritdoc />
public partial class IdentityServerV7 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<TimeSpan>(
name: "DPoPClockSkew",
table: "Clients",
type: "interval",
nullable: false,
defaultValue: new TimeSpan(0, 0, 0, 0, 0));
migrationBuilder.AddColumn<int>(
name: "DPoPValidationMode",
table: "Clients",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<string>(
name: "InitiateLoginUri",
table: "Clients",
type: "character varying(2000)",
maxLength: 2000,
nullable: true);
migrationBuilder.AddColumn<int>(
name: "PushedAuthorizationLifetime",
table: "Clients",
type: "integer",
nullable: true);
migrationBuilder.AddColumn<bool>(
name: "RequireDPoP",
table: "Clients",
type: "boolean",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "RequirePushedAuthorization",
table: "Clients",
type: "boolean",
nullable: false,
defaultValue: false);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "DPoPClockSkew",
table: "Clients");
migrationBuilder.DropColumn(
name: "DPoPValidationMode",
table: "Clients");
migrationBuilder.DropColumn(
name: "InitiateLoginUri",
table: "Clients");
migrationBuilder.DropColumn(
name: "PushedAuthorizationLifetime",
table: "Clients");
migrationBuilder.DropColumn(
name: "RequireDPoP",
table: "Clients");
migrationBuilder.DropColumn(
name: "RequirePushedAuthorization",
table: "Clients");
}
}
}
@@ -0,0 +1,108 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts;
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.IdentityServerGrants
{
[DbContext(typeof(IdentityServerPersistedGrantDbContext))]
[Migration("20191120100155_DbInit")]
partial class DbInit
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "3.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", b =>
{
b.Property<string>("UserCode")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<string>("ClientId")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<DateTime>("CreationTime")
.HasColumnType("timestamp without time zone");
b.Property<string>("Data")
.IsRequired()
.HasColumnType("character varying(50000)")
.HasMaxLength(50000);
b.Property<string>("DeviceCode")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<DateTime?>("Expiration")
.IsRequired()
.HasColumnType("timestamp without time zone");
b.Property<string>("SubjectId")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.HasKey("UserCode");
b.HasIndex("DeviceCode")
.IsUnique();
b.HasIndex("Expiration");
b.ToTable("DeviceCodes");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", b =>
{
b.Property<string>("Key")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<string>("ClientId")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<DateTime>("CreationTime")
.HasColumnType("timestamp without time zone");
b.Property<string>("Data")
.IsRequired()
.HasColumnType("character varying(50000)")
.HasMaxLength(50000);
b.Property<DateTime?>("Expiration")
.HasColumnType("timestamp without time zone");
b.Property<string>("SubjectId")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<string>("Type")
.IsRequired()
.HasColumnType("character varying(50)")
.HasMaxLength(50);
b.HasKey("Key");
b.HasIndex("Expiration");
b.HasIndex("SubjectId", "ClientId", "Type");
b.ToTable("PersistedGrants");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,75 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.IdentityServerGrants
{
public partial class DbInit : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
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: "PersistedGrants",
columns: table => new
{
Key = table.Column<string>(maxLength: 200, nullable: false),
Type = table.Column<string>(maxLength: 50, 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: true),
Data = table.Column<string>(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,129 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts;
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.IdentityServerGrants
{
[DbContext(typeof(IdentityServerPersistedGrantDbContext))]
[Migration("20201108165927_UpdateIdentityServerToVersion4")]
partial class UpdateIdentityServerToVersion4
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "3.1.9")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", b =>
{
b.Property<string>("UserCode")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<string>("ClientId")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<DateTime>("CreationTime")
.HasColumnType("timestamp without time zone");
b.Property<string>("Data")
.IsRequired()
.HasColumnType("character varying(50000)")
.HasMaxLength(50000);
b.Property<string>("Description")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<string>("DeviceCode")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<DateTime?>("Expiration")
.IsRequired()
.HasColumnType("timestamp without time zone");
b.Property<string>("SessionId")
.HasColumnType("character varying(100)")
.HasMaxLength(100);
b.Property<string>("SubjectId")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.HasKey("UserCode");
b.HasIndex("DeviceCode")
.IsUnique();
b.HasIndex("Expiration");
b.ToTable("DeviceCodes");
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.PersistedGrant", b =>
{
b.Property<string>("Key")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<string>("ClientId")
.IsRequired()
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<DateTime?>("ConsumedTime")
.HasColumnType("timestamp without time zone");
b.Property<DateTime>("CreationTime")
.HasColumnType("timestamp without time zone");
b.Property<string>("Data")
.IsRequired()
.HasColumnType("character varying(50000)")
.HasMaxLength(50000);
b.Property<string>("Description")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<DateTime?>("Expiration")
.HasColumnType("timestamp without time zone");
b.Property<string>("SessionId")
.HasColumnType("character varying(100)")
.HasMaxLength(100);
b.Property<string>("SubjectId")
.HasColumnType("character varying(200)")
.HasMaxLength(200);
b.Property<string>("Type")
.IsRequired()
.HasColumnType("character varying(50)")
.HasMaxLength(50);
b.HasKey("Key");
b.HasIndex("Expiration");
b.HasIndex("SubjectId", "ClientId", "Type");
b.HasIndex("SubjectId", "SessionId", "Type");
b.ToTable("PersistedGrants");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,72 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.IdentityServerGrants
{
public partial class UpdateIdentityServerToVersion4 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTime>(
name: "ConsumedTime",
table: "PersistedGrants",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Description",
table: "PersistedGrants",
maxLength: 200,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "SessionId",
table: "PersistedGrants",
maxLength: 100,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Description",
table: "DeviceCodes",
maxLength: 200,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "SessionId",
table: "DeviceCodes",
maxLength: 100,
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_PersistedGrants_SubjectId_SessionId_Type",
table: "PersistedGrants",
columns: new[] { "SubjectId", "SessionId", "Type" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_PersistedGrants_SubjectId_SessionId_Type",
table: "PersistedGrants");
migrationBuilder.DropColumn(
name: "ConsumedTime",
table: "PersistedGrants");
migrationBuilder.DropColumn(
name: "Description",
table: "PersistedGrants");
migrationBuilder.DropColumn(
name: "SessionId",
table: "PersistedGrants");
migrationBuilder.DropColumn(
name: "Description",
table: "DeviceCodes");
migrationBuilder.DropColumn(
name: "SessionId",
table: "DeviceCodes");
}
}
}
@@ -0,0 +1,167 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts;
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.IdentityServerGrants
{
[DbContext(typeof(IdentityServerPersistedGrantDbContext))]
[Migration("20211211153835_UpdateISKeysIDP")]
partial class UpdateISKeysIDP
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Relational:MaxIdentifierLength", 63)
.HasAnnotation("ProductVersion", "5.0.12")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", b =>
{
b.Property<string>("UserCode")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime>("CreationTime")
.HasColumnType("timestamp without time zone");
b.Property<string>("Data")
.IsRequired()
.HasMaxLength(50000)
.HasColumnType("character varying(50000)");
b.Property<string>("Description")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("DeviceCode")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime?>("Expiration")
.IsRequired()
.HasColumnType("timestamp without time zone");
b.Property<string>("SessionId")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("SubjectId")
.HasMaxLength(200)
.HasColumnType("character varying(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()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Data")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("DataProtected")
.HasColumnType("boolean");
b.Property<bool>("IsX509Certificate")
.HasColumnType("boolean");
b.Property<string>("Use")
.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)
.HasColumnType("character varying(200)");
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime?>("ConsumedTime")
.HasColumnType("timestamp without time zone");
b.Property<DateTime>("CreationTime")
.HasColumnType("timestamp without time zone");
b.Property<string>("Data")
.IsRequired()
.HasMaxLength(50000)
.HasColumnType("character varying(50000)");
b.Property<string>("Description")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime?>("Expiration")
.HasColumnType("timestamp without time zone");
b.Property<string>("SessionId")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("SubjectId")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.HasKey("Key");
b.HasIndex("ConsumedTime");
b.HasIndex("Expiration");
b.HasIndex("SubjectId", "ClientId", "Type");
b.HasIndex("SubjectId", "SessionId", "Type");
b.ToTable("PersistedGrants");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,49 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.IdentityServerGrants
{
public partial class UpdateISKeysIDP : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
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: "timestamp without time zone", nullable: false),
Use = table.Column<string>(type: "text", nullable: true),
Algorithm = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
IsX509Certificate = table.Column<bool>(type: "boolean", nullable: false),
DataProtected = table.Column<bool>(type: "boolean", nullable: false),
Data = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Keys", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_PersistedGrants_ConsumedTime",
table: "PersistedGrants",
column: "ConsumedTime");
migrationBuilder.CreateIndex(
name: "IX_Keys_Use",
table: "Keys",
column: "Use");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Keys");
migrationBuilder.DropIndex(
name: "IX_PersistedGrants_ConsumedTime",
table: "PersistedGrants");
}
}
}
@@ -0,0 +1,239 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts;
#nullable disable
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.IdentityServerGrants
{
[DbContext(typeof(IdentityServerPersistedGrantDbContext))]
[Migration("20230119113152_UpdateToIS61")]
partial class UpdateToIS61
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.7")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", b =>
{
b.Property<string>("UserCode")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime>("CreationTime")
.HasColumnType("timestamp without time zone");
b.Property<string>("Data")
.IsRequired()
.HasMaxLength(50000)
.HasColumnType("character varying(50000)");
b.Property<string>("Description")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("DeviceCode")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime?>("Expiration")
.IsRequired()
.HasColumnType("timestamp without time zone");
b.Property<string>("SessionId")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("SubjectId")
.HasMaxLength(200)
.HasColumnType("character varying(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("text");
b.Property<string>("Algorithm")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Data")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("DataProtected")
.HasColumnType("boolean");
b.Property<bool>("IsX509Certificate")
.HasColumnType("boolean");
b.Property<string>("Use")
.HasColumnType("text");
b.Property<int>("Version")
.HasColumnType("integer");
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");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime?>("ConsumedTime")
.HasColumnType("timestamp without time zone");
b.Property<DateTime>("CreationTime")
.HasColumnType("timestamp without time zone");
b.Property<string>("Data")
.IsRequired()
.HasMaxLength(50000)
.HasColumnType("character varying(50000)");
b.Property<string>("Description")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime?>("Expiration")
.HasColumnType("timestamp without time zone");
b.Property<string>("Key")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("SessionId")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("SubjectId")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.HasKey("Id");
b.HasIndex("ConsumedTime");
b.HasIndex("Expiration");
b.HasIndex("Key")
.IsUnique();
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("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Data")
.IsRequired()
.HasColumnType("text");
b.Property<string>("DisplayName")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<DateTime?>("Expires")
.HasColumnType("timestamp without time zone");
b.Property<string>("Key")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<DateTime>("Renewed")
.HasColumnType("timestamp without time zone");
b.Property<string>("Scheme")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("SessionId")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("SubjectId")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(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,129 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.IdentityServerGrants
{
public partial class UpdateToIS61 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_PersistedGrants",
table: "PersistedGrants");
migrationBuilder.AlterColumn<string>(
name: "Key",
table: "PersistedGrants",
type: "character varying(200)",
maxLength: 200,
nullable: true,
oldClrType: typeof(string),
oldType: "character varying(200)",
oldMaxLength: 200);
migrationBuilder.AddColumn<long>(
name: "Id",
table: "PersistedGrants",
type: "bigint",
nullable: false,
defaultValue: 0L)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
migrationBuilder.AddPrimaryKey(
name: "PK_PersistedGrants",
table: "PersistedGrants",
column: "Id");
migrationBuilder.CreateTable(
name: "ServerSideSessions",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Key = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
Scheme = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
SubjectId = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
SessionId = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
DisplayName = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
Created = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
Renewed = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
Expires = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
Data = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ServerSideSessions", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_PersistedGrants_Key",
table: "PersistedGrants",
column: "Key",
unique: true);
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: "ServerSideSessions");
migrationBuilder.DropPrimaryKey(
name: "PK_PersistedGrants",
table: "PersistedGrants");
migrationBuilder.DropIndex(
name: "IX_PersistedGrants_Key",
table: "PersistedGrants");
migrationBuilder.DropColumn(
name: "Id",
table: "PersistedGrants");
migrationBuilder.AlterColumn<string>(
name: "Key",
table: "PersistedGrants",
type: "character varying(200)",
maxLength: 200,
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "character varying(200)",
oldMaxLength: 200,
oldNullable: true);
migrationBuilder.AddPrimaryKey(
name: "PK_PersistedGrants",
table: "PersistedGrants",
column: "Key");
}
}
}
@@ -0,0 +1,270 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts;
#nullable disable
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.IdentityServerGrants
{
[DbContext(typeof(IdentityServerPersistedGrantDbContext))]
[Migration("20240206155424_IdentityServerV7")]
partial class IdentityServerV7
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.1")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", b =>
{
b.Property<string>("UserCode")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime>("CreationTime")
.HasColumnType("timestamp without time zone");
b.Property<string>("Data")
.IsRequired()
.HasMaxLength(50000)
.HasColumnType("character varying(50000)");
b.Property<string>("Description")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("DeviceCode")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime?>("Expiration")
.IsRequired()
.HasColumnType("timestamp without time zone");
b.Property<string>("SessionId")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("SubjectId")
.HasMaxLength(200)
.HasColumnType("character varying(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("text");
b.Property<string>("Algorithm")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Data")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("DataProtected")
.HasColumnType("boolean");
b.Property<bool>("IsX509Certificate")
.HasColumnType("boolean");
b.Property<string>("Use")
.HasColumnType("text");
b.Property<int>("Version")
.HasColumnType("integer");
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");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime?>("ConsumedTime")
.HasColumnType("timestamp without time zone");
b.Property<DateTime>("CreationTime")
.HasColumnType("timestamp without time zone");
b.Property<string>("Data")
.IsRequired()
.HasMaxLength(50000)
.HasColumnType("character varying(50000)");
b.Property<string>("Description")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime?>("Expiration")
.HasColumnType("timestamp without time zone");
b.Property<string>("Key")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("SessionId")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("SubjectId")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.HasKey("Id");
b.HasIndex("ConsumedTime");
b.HasIndex("Expiration");
b.HasIndex("Key")
.IsUnique();
b.HasIndex("SubjectId", "ClientId", "Type");
b.HasIndex("SubjectId", "SessionId", "Type");
b.ToTable("PersistedGrants", (string)null);
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.PushedAuthorizationRequest", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<DateTime>("ExpiresAtUtc")
.HasColumnType("timestamp without time zone");
b.Property<string>("Parameters")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ReferenceValueHash")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.HasKey("Id");
b.HasIndex("ExpiresAtUtc");
b.HasIndex("ReferenceValueHash")
.IsUnique();
b.ToTable("PushedAuthorizationRequests", (string)null);
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ServerSideSession", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Data")
.IsRequired()
.HasColumnType("text");
b.Property<string>("DisplayName")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<DateTime?>("Expires")
.HasColumnType("timestamp without time zone");
b.Property<string>("Key")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<DateTime>("Renewed")
.HasColumnType("timestamp without time zone");
b.Property<string>("Scheme")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("SessionId")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("SubjectId")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(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,73 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.IdentityServerGrants
{
/// <inheritdoc />
public partial class IdentityServerV7 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey("PK_ServerSideSessions", "ServerSideSessions");
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "ServerSideSessions",
type: "bigint",
nullable: false,
oldClrType: typeof(int),
oldType: "integer")
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
migrationBuilder.AddPrimaryKey("PK_ServerSideSessions", "ServerSideSessions", "Id");
migrationBuilder.CreateTable(
name: "PushedAuthorizationRequests",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ReferenceValueHash = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
ExpiresAtUtc = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
Parameters = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PushedAuthorizationRequests", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_PushedAuthorizationRequests_ExpiresAtUtc",
table: "PushedAuthorizationRequests",
column: "ExpiresAtUtc");
migrationBuilder.CreateIndex(
name: "IX_PushedAuthorizationRequests_ReferenceValueHash",
table: "PushedAuthorizationRequests",
column: "ReferenceValueHash",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "PushedAuthorizationRequests");
migrationBuilder.AlterColumn<int>(
name: "Id",
table: "ServerSideSessions",
type: "integer",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.OldAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
}
}
}
@@ -0,0 +1,267 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts;
#nullable disable
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.IdentityServerGrants
{
[DbContext(typeof(IdentityServerPersistedGrantDbContext))]
partial class IdentityServerPersistedGrantDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.1")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.DeviceFlowCodes", b =>
{
b.Property<string>("UserCode")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime>("CreationTime")
.HasColumnType("timestamp without time zone");
b.Property<string>("Data")
.IsRequired()
.HasMaxLength(50000)
.HasColumnType("character varying(50000)");
b.Property<string>("Description")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("DeviceCode")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime?>("Expiration")
.IsRequired()
.HasColumnType("timestamp without time zone");
b.Property<string>("SessionId")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("SubjectId")
.HasMaxLength(200)
.HasColumnType("character varying(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("text");
b.Property<string>("Algorithm")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Data")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("DataProtected")
.HasColumnType("boolean");
b.Property<bool>("IsX509Certificate")
.HasColumnType("boolean");
b.Property<string>("Use")
.HasColumnType("text");
b.Property<int>("Version")
.HasColumnType("integer");
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");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime?>("ConsumedTime")
.HasColumnType("timestamp without time zone");
b.Property<DateTime>("CreationTime")
.HasColumnType("timestamp without time zone");
b.Property<string>("Data")
.IsRequired()
.HasMaxLength(50000)
.HasColumnType("character varying(50000)");
b.Property<string>("Description")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime?>("Expiration")
.HasColumnType("timestamp without time zone");
b.Property<string>("Key")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("SessionId")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("SubjectId")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.HasKey("Id");
b.HasIndex("ConsumedTime");
b.HasIndex("Expiration");
b.HasIndex("Key")
.IsUnique();
b.HasIndex("SubjectId", "ClientId", "Type");
b.HasIndex("SubjectId", "SessionId", "Type");
b.ToTable("PersistedGrants", (string)null);
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.PushedAuthorizationRequest", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<DateTime>("ExpiresAtUtc")
.HasColumnType("timestamp without time zone");
b.Property<string>("Parameters")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ReferenceValueHash")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.HasKey("Id");
b.HasIndex("ExpiresAtUtc");
b.HasIndex("ReferenceValueHash")
.IsUnique();
b.ToTable("PushedAuthorizationRequests", (string)null);
});
modelBuilder.Entity("Duende.IdentityServer.EntityFramework.Entities.ServerSideSession", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<DateTime>("Created")
.HasColumnType("timestamp without time zone");
b.Property<string>("Data")
.IsRequired()
.HasColumnType("text");
b.Property<string>("DisplayName")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<DateTime?>("Expires")
.HasColumnType("timestamp without time zone");
b.Property<string>("Key")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<DateTime>("Renewed")
.HasColumnType("timestamp without time zone");
b.Property<string>("Scheme")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("SessionId")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("SubjectId")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(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,60 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts;
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.Logging
{
[DbContext(typeof(AdminLogDbContext))]
[Migration("20191120100104_DbInit")]
partial class DbInit
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "3.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("Skoruba.Duende.IdentityServer.Admin.EntityFramework.Entities.Log", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Exception")
.HasColumnType("text");
b.Property<string>("Level")
.HasColumnType("character varying(128)")
.HasMaxLength(128);
b.Property<string>("LogEvent")
.HasColumnType("text");
b.Property<string>("Message")
.HasColumnType("text");
b.Property<string>("MessageTemplate")
.HasColumnType("text");
b.Property<string>("Properties")
.HasColumnType("text");
b.Property<DateTimeOffset>("TimeStamp")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.ToTable("Log");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,37 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.Logging
{
public partial class DbInit : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Log",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Message = table.Column<string>(nullable: true),
MessageTemplate = table.Column<string>(nullable: true),
Level = table.Column<string>(maxLength: 128, nullable: true),
TimeStamp = table.Column<DateTimeOffset>(nullable: false),
Exception = table.Column<string>(nullable: true),
LogEvent = table.Column<string>(nullable: true),
Properties = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Log", x => x.Id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Log");
}
}
}
@@ -0,0 +1,58 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts;
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.Logging
{
[DbContext(typeof(AdminLogDbContext))]
partial class AdminLogDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
.HasAnnotation("ProductVersion", "3.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("Skoruba.Duende.IdentityServer.Admin.EntityFramework.Entities.Log", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("Exception")
.HasColumnType("text");
b.Property<string>("Level")
.HasColumnType("character varying(128)")
.HasMaxLength(128);
b.Property<string>("LogEvent")
.HasColumnType("text");
b.Property<string>("Message")
.HasColumnType("text");
b.Property<string>("MessageTemplate")
.HasColumnType("text");
b.Property<string>("Properties")
.HasColumnType("text");
b.Property<DateTimeOffset>("TimeStamp")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.ToTable("Log");
});
#pragma warning restore 612, 618
}
}
}