Add project files.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using Skoruba.Duende.IdentityServer.Admin.EntityFramework.Configuration.Configuration;
|
||||
using SqlMigrationAssembly = LiteCharmsSecurity.Admin.EntityFramework.SqlServer.Helpers.MigrationAssembly;
|
||||
using PostgreSQLMigrationAssembly = LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Helpers.MigrationAssembly;
|
||||
|
||||
namespace LiteCharmsSecurity.Admin.Api.Configuration;
|
||||
|
||||
public static class MigrationAssemblyConfiguration
|
||||
{
|
||||
public static string GetMigrationAssemblyByProvider(DatabaseProviderConfiguration databaseProvider)
|
||||
{
|
||||
return databaseProvider.ProviderType switch
|
||||
{
|
||||
DatabaseProviderType.SqlServer => typeof(SqlMigrationAssembly).GetTypeInfo().Assembly.GetName().Name,
|
||||
DatabaseProviderType.PostgreSQL => typeof(PostgreSQLMigrationAssembly).GetTypeInfo()
|
||||
.Assembly.GetName()
|
||||
.Name,
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using NSwag;
|
||||
using NSwag.Generation.Processors.Security;
|
||||
using Skoruba.Duende.IdentityServer.Admin.UI.Api.Configuration;
|
||||
using Skoruba.Duende.IdentityServer.Admin.UI.Api.Configuration.Authorization;
|
||||
|
||||
namespace LiteCharmsSecurity.Admin.Api.Configuration;
|
||||
|
||||
public static class StartupHelpers
|
||||
{
|
||||
public static void AddSwaggerServices(this IServiceCollection services, AdminApiConfiguration adminApiConfiguration)
|
||||
{
|
||||
services.AddEndpointsApiExplorer();
|
||||
services.AddOpenApiDocument(configure =>
|
||||
{
|
||||
configure.Title = adminApiConfiguration.ApiName;
|
||||
configure.Version = adminApiConfiguration.ApiVersion;
|
||||
|
||||
configure.AddSecurity("OAuth2", new OpenApiSecurityScheme
|
||||
{
|
||||
Type = OpenApiSecuritySchemeType.OAuth2,
|
||||
Flows = new OpenApiOAuthFlows
|
||||
{
|
||||
AuthorizationCode = new OpenApiOAuthFlow
|
||||
{
|
||||
AuthorizationUrl = $"{adminApiConfiguration.IdentityServerBaseUrl}/connect/authorize",
|
||||
TokenUrl = $"{adminApiConfiguration.IdentityServerBaseUrl}/connect/token",
|
||||
Scopes = new Dictionary<string, string>
|
||||
{
|
||||
{ adminApiConfiguration.OidcApiName, adminApiConfiguration.ApiName }
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
configure.OperationProcessors.Add(new AspNetCoreOperationSecurityScopeProcessor("OAuth2"));
|
||||
configure.OperationProcessors.Add(new AuthorizeCheckOperationProcessor(adminApiConfiguration));
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
// Copyright (c) Jan Škoruba. All Rights Reserved.
|
||||
// Licensed under the Apache License, Version 2.0.
|
||||
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Skoruba.Duende.IdentityServer.Admin.EntityFramework.Configuration.Configuration;
|
||||
using LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts;
|
||||
using LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity;
|
||||
using Skoruba.Duende.IdentityServer.Admin.UI.Api.Helpers;
|
||||
using Skoruba.Duende.IdentityServer.Admin.UI.Api.Middlewares;
|
||||
using Skoruba.Duende.IdentityServer.Shared.Configuration.Constants;
|
||||
|
||||
namespace LiteCharmsSecurity.Admin.Api.Configuration.Test
|
||||
{
|
||||
public class StartupTest : Startup
|
||||
{
|
||||
public StartupTest(IWebHostEnvironment env, IConfiguration configuration) : base(env, configuration)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RegisterDbContexts(IServiceCollection services,
|
||||
DatabaseMigrationsConfiguration databaseMigration)
|
||||
{
|
||||
services.RegisterDbContextsStaging<AdminIdentityDbContext, IdentityServerConfigurationDbContext, IdentityServerPersistedGrantDbContext, AdminLogDbContext, AdminAuditLogDbContext, IdentityServerDataProtectionDbContext>();
|
||||
}
|
||||
|
||||
public override void RegisterAuthentication(IServiceCollection services)
|
||||
{
|
||||
services
|
||||
.AddIdentity<UserIdentity, UserIdentityRole>(options =>
|
||||
{
|
||||
Configuration.GetSection(nameof(IdentityOptions)).Bind(options);
|
||||
options.Stores.SchemaVersion = IdentityStoreDefaults.SchemaVersion;
|
||||
options.Stores.MaxLengthForKeys = IdentityStoreDefaults.MaxLengthForKeys;
|
||||
})
|
||||
.AddEntityFrameworkStores<AdminIdentityDbContext>()
|
||||
.AddDefaultTokenProviders();
|
||||
|
||||
services.AddAuthentication(options =>
|
||||
{
|
||||
options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||
options.DefaultSignInScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||
options.DefaultForbidScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||
}).AddCookie(JwtBearerDefaults.AuthenticationScheme);
|
||||
}
|
||||
|
||||
public override void RegisterAuthorization(IServiceCollection services)
|
||||
{
|
||||
services.AddAuthorizationPolicies();
|
||||
}
|
||||
|
||||
public override void UseAuthentication(IApplicationBuilder app)
|
||||
{
|
||||
app.UseAuthentication();
|
||||
app.UseMiddleware<AuthenticatedTestRequestMiddleware>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
|
||||
WORKDIR /app
|
||||
EXPOSE 80
|
||||
EXPOSE 443
|
||||
|
||||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
||||
ARG TARGETARCH
|
||||
WORKDIR /src
|
||||
COPY ["src/LiteCharmsSecurity.Admin.Api/LiteCharmsSecurity.Admin.Api.csproj", "src/LiteCharmsSecurity.Admin.Api/"]
|
||||
COPY ["src/LiteCharmsSecurity.Admin.EntityFramework.Shared/LiteCharmsSecurity.Admin.EntityFramework.Shared.csproj", "src/LiteCharmsSecurity.Admin.EntityFramework.Shared/"]
|
||||
COPY ["src/LiteCharmsSecurity.Admin.EntityFramework.SqlServer/LiteCharmsSecurity.Admin.EntityFramework.SqlServer.csproj", "src/LiteCharmsSecurity.Admin.EntityFramework.SqlServer/"]
|
||||
COPY ["src/LiteCharmsSecurity.Shared/LiteCharmsSecurity.Shared.csproj", "src/LiteCharmsSecurity.Shared/"]
|
||||
COPY ["src/LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL/LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.csproj", "src/LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL/"]
|
||||
RUN dotnet restore -a $TARGETARCH "src/LiteCharmsSecurity.Admin.Api/LiteCharmsSecurity.Admin.Api.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/src/LiteCharmsSecurity.Admin.Api"
|
||||
RUN dotnet build -a $TARGETARCH "LiteCharmsSecurity.Admin.Api.csproj" -c Release -o /app/build
|
||||
|
||||
FROM build AS publish
|
||||
RUN dotnet publish -a $TARGETARCH "LiteCharmsSecurity.Admin.Api.csproj" -c Release --no-restore -o /app/publish
|
||||
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
ENV ASPNETCORE_FORWARDEDHEADERS_ENABLED=true
|
||||
ENTRYPOINT ["dotnet", "LiteCharmsSecurity.Admin.Api.dll"]
|
||||
@@ -0,0 +1,65 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
|
||||
<UserSecretsId>1cc472a2-4e4b-48ce-846b-5219f71fc643</UserSecretsId>
|
||||
<DockerComposeProjectPath>..\..\docker-compose.dcproj</DockerComposeProjectPath>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<DockerfileContext>..\..</DockerfileContext>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL\LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.csproj" />
|
||||
<ProjectReference Include="..\LiteCharmsSecurity.Admin.EntityFramework.SqlServer\LiteCharmsSecurity.Admin.EntityFramework.SqlServer.csproj" />
|
||||
<ProjectReference Include="..\LiteCharmsSecurity.Shared\LiteCharmsSecurity.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="10.0.7">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="NSwag.CodeGeneration" Version="14.7.1" />
|
||||
<PackageReference Include="NSwag.CodeGeneration.TypeScript" Version="14.7.1" />
|
||||
<PackageReference Include="NSwag.Generation" Version="14.7.1" />
|
||||
<PackageReference Include="NSwag.Generation.AspNetCore" Version="14.7.1" />
|
||||
<PackageReference Include="NSwag.Generation.WebApi" Version="14.7.1" />
|
||||
<PackageReference Include="NSwag.AspNetCore" Version="14.7.1" />
|
||||
<PackageReference Include="NSwag.MSBuild" Version="14.7.1">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Skoruba.Duende.IdentityServer.Admin.UI.Api" Version="3.0.0-rc4" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="..\..\.dockerignore">
|
||||
<Link>.dockerignore</Link>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="NSwag" BeforeTargets="AfterBuild" Condition="'$(Configuration)'=='Debug'">
|
||||
<Exec ContinueOnError="true" Command="$(NSwagExe_Net100) run nswag.json /variables:Configuration=$(Configuration)">
|
||||
<Output TaskParameter="ExitCode" PropertyName="NSwagExitCode" />
|
||||
<Output TaskParameter="ConsoleOutput" PropertyName="NSwagOutput" />
|
||||
</Exec>
|
||||
|
||||
<Message Text="$(NSwagOutput)" Condition="'$(NSwagExitCode)' == '0'" Importance="low" />
|
||||
<Error Text="$(NSwagOutput)" Condition="'$(NSwagExitCode)' != '0'" />
|
||||
</Target>
|
||||
|
||||
|
||||
</Project>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
// Copyright (c) Jan Škoruba. All Rights Reserved.
|
||||
// Licensed under the Apache License, Version 2.0.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Serilog;
|
||||
using Skoruba.Duende.IdentityServer.Admin.EntityFramework.Configuration.Configuration;
|
||||
using LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts;
|
||||
using LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity;
|
||||
using LiteCharmsSecurity.Admin.EntityFramework.Shared.Helpers;
|
||||
using Skoruba.Duende.IdentityServer.Shared.Configuration.Helpers;
|
||||
|
||||
namespace LiteCharmsSecurity.Admin.Api
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
private const string SeedArgs = "/seed";
|
||||
private const string MigrateOnlyArgs = "/migrateonly";
|
||||
|
||||
public static async Task Main(string[] args)
|
||||
{
|
||||
var configuration = GetConfiguration(args);
|
||||
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
.ReadFrom.Configuration(configuration)
|
||||
.CreateLogger();
|
||||
try
|
||||
{
|
||||
DockerHelpers.ApplyDockerConfiguration(configuration);
|
||||
|
||||
var host = CreateHostBuilder(args).Build();
|
||||
|
||||
var migrationComplete = await ApplyDbMigrationsWithDataSeedAsync(args, configuration, host);
|
||||
if (await MigrateOnlyOperationAsync(args, host, migrationComplete)) return;
|
||||
|
||||
await host.RunAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Fatal(ex, "Host terminated unexpectedly");
|
||||
}
|
||||
finally
|
||||
{
|
||||
await Log.CloseAndFlushAsync();
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task<bool> MigrateOnlyOperationAsync(string[] args, IHost host, bool migrationComplete)
|
||||
{
|
||||
if (args.All(x => x != MigrateOnlyArgs)) return false;
|
||||
|
||||
await host.StopAsync();
|
||||
|
||||
if (!migrationComplete)
|
||||
{
|
||||
Environment.ExitCode = -1;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static async Task<bool> ApplyDbMigrationsWithDataSeedAsync(string[] args, IConfiguration configuration,
|
||||
IHost host)
|
||||
{
|
||||
var applyDbMigrationWithDataSeedFromProgramArguments = args.Any(x => x == SeedArgs);
|
||||
if (applyDbMigrationWithDataSeedFromProgramArguments) args = args.Except(new[] { SeedArgs }).ToArray();
|
||||
|
||||
var seedConfiguration = configuration.GetSection(nameof(SeedConfiguration)).Get<SeedConfiguration>();
|
||||
var databaseMigrationsConfiguration = configuration.GetSection(nameof(DatabaseMigrationsConfiguration))
|
||||
.Get<DatabaseMigrationsConfiguration>();
|
||||
|
||||
return await DbMigrationHelpers
|
||||
.ApplyDbMigrationsWithDataSeedAsync<IdentityServerConfigurationDbContext, AdminIdentityDbContext,
|
||||
IdentityServerPersistedGrantDbContext, AdminLogDbContext, AdminAuditLogDbContext,
|
||||
IdentityServerDataProtectionDbContext, AdminConfigurationDbContext, UserIdentity, UserIdentityRole>(host,
|
||||
applyDbMigrationWithDataSeedFromProgramArguments, seedConfiguration,
|
||||
databaseMigrationsConfiguration);
|
||||
}
|
||||
|
||||
|
||||
private static IConfiguration GetConfiguration(string[] args)
|
||||
{
|
||||
var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
|
||||
var isDevelopment = environment == Environments.Development;
|
||||
|
||||
var configurationBuilder = new ConfigurationBuilder()
|
||||
.SetBasePath(Directory.GetCurrentDirectory())
|
||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||
.AddJsonFile($"appsettings.{environment}.json", optional: true, reloadOnChange: true)
|
||||
.AddJsonFile("serilog.json", optional: true, reloadOnChange: true)
|
||||
.AddJsonFile($"serilog.{environment}.json", optional: true, reloadOnChange: true);
|
||||
|
||||
if (isDevelopment)
|
||||
{
|
||||
configurationBuilder.AddUserSecrets<Startup>(true);
|
||||
}
|
||||
|
||||
var configuration = configurationBuilder.Build();
|
||||
|
||||
configuration.AddAzureKeyVaultConfiguration(configurationBuilder);
|
||||
|
||||
configurationBuilder.AddCommandLine(args);
|
||||
configurationBuilder.AddEnvironmentVariables();
|
||||
|
||||
return configurationBuilder.Build();
|
||||
}
|
||||
|
||||
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
||||
Host.CreateDefaultBuilder(args)
|
||||
.ConfigureAppConfiguration((hostContext, configApp) =>
|
||||
{
|
||||
var configurationRoot = configApp.Build();
|
||||
|
||||
configApp.AddJsonFile("serilog.json", optional: true, reloadOnChange: true);
|
||||
configApp.AddJsonFile("identitydata.json", optional: true, reloadOnChange: true);
|
||||
configApp.AddJsonFile("identityserverdata.json", optional: true, reloadOnChange: true);
|
||||
|
||||
var env = hostContext.HostingEnvironment;
|
||||
|
||||
configApp.AddJsonFile($"serilog.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
||||
configApp.AddJsonFile($"identitydata.{env.EnvironmentName}.json", optional: true,
|
||||
reloadOnChange: true);
|
||||
configApp.AddJsonFile($"identityserverdata.{env.EnvironmentName}.json", optional: true,
|
||||
reloadOnChange: true);
|
||||
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
configApp.AddUserSecrets<Startup>(true);
|
||||
}
|
||||
|
||||
configurationRoot.AddAzureKeyVaultConfiguration(configApp);
|
||||
|
||||
configApp.AddEnvironmentVariables();
|
||||
configApp.AddCommandLine(args);
|
||||
})
|
||||
.ConfigureWebHostDefaults(webBuilder =>
|
||||
{
|
||||
webBuilder.ConfigureKestrel(options => options.AddServerHeader = false);
|
||||
webBuilder.UseStartup<Startup>();
|
||||
})
|
||||
.UseSerilog((hostContext, loggerConfig) =>
|
||||
{
|
||||
loggerConfig
|
||||
.ReadFrom.Configuration(hostContext.Configuration)
|
||||
.Enrich.WithProperty("ApplicationName", hostContext.HostingEnvironment.ApplicationName);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "https://localhost:44302",
|
||||
"sslPort": 44302
|
||||
}
|
||||
},
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"LiteCharmsSecurity.Admin.Api": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "https://localhost:44302"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
// Copyright (c) Jan Škoruba. All Rights Reserved.
|
||||
// Licensed under the Apache License, Version 2.0.
|
||||
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using HealthChecks.UI.Client;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using NSwag.AspNetCore;
|
||||
using Skoruba.AuditLogging.EntityFramework.Entities;
|
||||
using LiteCharmsSecurity.Admin.Api.Configuration;
|
||||
using Skoruba.Duende.IdentityServer.Admin.EntityFramework.Configuration.Configuration;
|
||||
using LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts;
|
||||
using LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity;
|
||||
using Skoruba.Duende.IdentityServer.Admin.UI.Api.Configuration;
|
||||
using Skoruba.Duende.IdentityServer.Admin.UI.Api.Helpers;
|
||||
using Skoruba.Duende.IdentityServer.Shared.Configuration.Helpers;
|
||||
using LiteCharmsSecurity.Shared.Dtos;
|
||||
using LiteCharmsSecurity.Shared.Dtos.Identity;
|
||||
using StartupHelpers = Skoruba.Duende.IdentityServer.Shared.Configuration.Helpers.StartupHelpers;
|
||||
|
||||
namespace LiteCharmsSecurity.Admin.Api
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
public Startup(IWebHostEnvironment env, IConfiguration configuration)
|
||||
{
|
||||
JwtSecurityTokenHandler.DefaultMapInboundClaims = false;
|
||||
HostingEnvironment = env;
|
||||
Configuration = configuration;
|
||||
}
|
||||
|
||||
public IConfiguration Configuration { get; }
|
||||
|
||||
public IWebHostEnvironment HostingEnvironment { get; }
|
||||
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
var adminApiConfiguration = Configuration.GetSection(nameof(AdminApiConfiguration)).Get<AdminApiConfiguration>();
|
||||
services.AddSingleton(adminApiConfiguration);
|
||||
|
||||
var databaseProviderConfiguration = Configuration.GetSection(nameof(DatabaseProviderConfiguration)).Get<DatabaseProviderConfiguration>();
|
||||
var databaseMigration = StartupHelpers.GetDatabaseMigrationsConfiguration(Configuration, MigrationAssemblyConfiguration.GetMigrationAssemblyByProvider(databaseProviderConfiguration));
|
||||
|
||||
// Add DbContexts
|
||||
RegisterDbContexts(services, databaseMigration);
|
||||
|
||||
// Add email senders which is currently setup for SendGrid and SMTP
|
||||
services.AddEmailSenders(Configuration);
|
||||
|
||||
// Add authentication services
|
||||
RegisterAuthentication(services);
|
||||
|
||||
// Add authorization services
|
||||
RegisterAuthorization(services);
|
||||
|
||||
services.AddIdentityServerAdminApi<AdminIdentityDbContext, IdentityServerConfigurationDbContext, IdentityServerPersistedGrantDbContext, IdentityServerDataProtectionDbContext, AdminLogDbContext, AdminAuditLogDbContext, AdminConfigurationDbContext, AuditLog,
|
||||
IdentityUserDto, IdentityRoleDto, UserIdentity, UserIdentityRole, string, UserIdentityUserClaim, UserIdentityUserRole,
|
||||
UserIdentityUserLogin, UserIdentityRoleClaim, UserIdentityUserToken, UserIdentityPasskey,
|
||||
IdentityUsersDto, IdentityRolesDto, IdentityUserRolesDto,
|
||||
IdentityUserClaimsDto, IdentityUserProviderDto, IdentityUserProvidersDto, IdentityUserChangePasswordDto,
|
||||
IdentityRoleClaimsDto, IdentityUserClaimDto, IdentityRoleClaimDto>(Configuration, adminApiConfiguration);
|
||||
|
||||
services.AddSwaggerServices(adminApiConfiguration);
|
||||
|
||||
services.AddIdSHealthChecks<IdentityServerConfigurationDbContext, IdentityServerPersistedGrantDbContext, AdminIdentityDbContext, AdminLogDbContext, AdminAuditLogDbContext, IdentityServerDataProtectionDbContext>(Configuration, adminApiConfiguration);
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, AdminApiConfiguration adminApiConfiguration)
|
||||
{
|
||||
app.AddForwardHeaders(Configuration);
|
||||
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
}
|
||||
|
||||
app.UseOpenApi();
|
||||
app.UseSwaggerUi(settings =>
|
||||
{
|
||||
settings.OAuth2Client = new OAuth2ClientSettings
|
||||
{
|
||||
ClientId = adminApiConfiguration.OidcSwaggerUIClientId,
|
||||
AppName = adminApiConfiguration.ApiName,
|
||||
UsePkceWithAuthorizationCodeGrant = true,
|
||||
ClientSecret = null
|
||||
};
|
||||
});
|
||||
|
||||
app.UseRouting();
|
||||
UseAuthentication(app);
|
||||
app.UseCors();
|
||||
app.UseAuthorization();
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapControllers();
|
||||
|
||||
endpoints.MapHealthChecks("/health", new HealthCheckOptions
|
||||
{
|
||||
ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public virtual void RegisterDbContexts(IServiceCollection services,
|
||||
DatabaseMigrationsConfiguration databaseMigration)
|
||||
{
|
||||
services.AddDbContexts<AdminIdentityDbContext, IdentityServerConfigurationDbContext, IdentityServerPersistedGrantDbContext, AdminLogDbContext, AdminAuditLogDbContext, IdentityServerDataProtectionDbContext, AdminConfigurationDbContext, AuditLog>(Configuration, databaseMigration);
|
||||
}
|
||||
|
||||
public virtual void RegisterAuthentication(IServiceCollection services)
|
||||
{
|
||||
services.AddApiAuthentication<AdminIdentityDbContext, UserIdentity, UserIdentityRole>(Configuration);
|
||||
}
|
||||
|
||||
public virtual void RegisterAuthorization(IServiceCollection services)
|
||||
{
|
||||
services.AddAuthorizationPolicies();
|
||||
}
|
||||
|
||||
public virtual void UseAuthentication(IApplicationBuilder app)
|
||||
{
|
||||
app.UseAuthentication();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.WebApiClientBase = void 0;
|
||||
class WebApiClientBase {
|
||||
transformOptions(options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const headers = new Headers(options.headers);
|
||||
headers.set("X-ANTI-CSRF", "1");
|
||||
return Object.assign(Object.assign({}, options), { headers });
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.WebApiClientBase = WebApiClientBase;
|
||||
//# sourceMappingURL=base-client.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"base-client.js","sourceRoot":"","sources":["../../src/base-client.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,MAAa,gBAAgB;IACT,gBAAgB,CAAC,OAAoB;;YACjD,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAC7C,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;YAEhC,uCACO,OAAO,KACV,OAAO,IACT;QACN,CAAC;KAAA;CACJ;AAVD,4CAUC"}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.client = void 0;
|
||||
const client = __importStar(require("./client"));
|
||||
exports.client = client;
|
||||
//# sourceMappingURL=index.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmC;AAG/B,wBAAM"}
|
||||
@@ -0,0 +1,19 @@
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
export class WebApiClientBase {
|
||||
transformOptions(options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const headers = new Headers(options.headers);
|
||||
headers.set("X-ANTI-CSRF", "1");
|
||||
return Object.assign(Object.assign({}, options), { headers });
|
||||
});
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=base-client.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"base-client.js","sourceRoot":"","sources":["../../src/base-client.ts"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,OAAO,gBAAgB;IACT,gBAAgB,CAAC,OAAoB;;YACjD,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAC7C,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;YAEhC,uCACO,OAAO,KACV,OAAO,IACT;QACN,CAAC;KAAA;CACJ"}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=dayjs.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"dayjs.js","sourceRoot":"","sources":["../../dayjs.ts"],"names":[],"mappings":""}
|
||||
@@ -0,0 +1,3 @@
|
||||
import * as client from './client';
|
||||
export { client };
|
||||
//# sourceMappingURL=index.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,OAAO,EACH,MAAM,EACT,CAAA"}
|
||||
@@ -0,0 +1,3 @@
|
||||
export declare class WebApiClientBase {
|
||||
protected transformOptions(options: RequestInit): Promise<RequestInit>;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
export {};
|
||||
@@ -0,0 +1,2 @@
|
||||
import * as client from './client';
|
||||
export { client };
|
||||
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"name": "@skoruba/duende.identityserver.admin.api.client",
|
||||
"version": "2.7.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@skoruba/duende.identityserver.admin.api.client",
|
||||
"version": "2.7.0",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"dayjs": "1.11.11",
|
||||
"typescript": "5.1.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tsconfig/recommended": "1.0.2",
|
||||
"@types/node": "20.4.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@tsconfig/recommended": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/recommended/-/recommended-1.0.2.tgz",
|
||||
"integrity": "sha512-dbHBtbWBOjq0/otpopAE02NT2Cm05Qe2JsEKeCf/wjSYbI2hz8nCqnpnOJWHATgjDz4fd3dchs3Wy1gQGjfN6w==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "20.4.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.4.tgz",
|
||||
"integrity": "sha512-CukZhumInROvLq3+b5gLev+vgpsIqC2D0deQr/yS1WnxvmYLlJXZpaQrQiseMY+6xusl79E04UjWoqyr+t1/Ew==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/dayjs": {
|
||||
"version": "1.11.11",
|
||||
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.11.tgz",
|
||||
"integrity": "sha512-okzr3f11N6WuqYtZSvm+F776mB41wRZMhKP+hc34YdW+KmtYYK9iqvHSwo2k9FEH3fhGXvOPV6yz2IcSrfRUDg=="
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.1.6",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz",
|
||||
"integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==",
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.17"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "@skoruba/duende.identityserver.admin.api.client",
|
||||
"version": "3.0.0-rc4",
|
||||
"description": "Lite Charms Security Api Client",
|
||||
"main": "dist/cjs/index.js",
|
||||
"module": "dist/esm/index.js",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "npm run build:esm && npm run build:cjs",
|
||||
"build:esm": "tsc",
|
||||
"build:cjs": "tsc --module CommonJS --outDir dist/cjs"
|
||||
},
|
||||
"author": "Skoruba",
|
||||
"license": "Apache-2.0",
|
||||
"devDependencies": {
|
||||
"@tsconfig/recommended": "1.0.2",
|
||||
"@types/node": "20.4.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"dayjs": "1.11.11",
|
||||
"typescript": "5.1.6"
|
||||
},
|
||||
"types": "dist/types/index.d.ts"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
export class WebApiClientBase {
|
||||
protected async transformOptions(options: RequestInit): Promise<RequestInit> {
|
||||
const headers = new Headers(options.headers);
|
||||
headers.set("X-ANTI-CSRF", "1");
|
||||
|
||||
return {
|
||||
...options,
|
||||
headers,
|
||||
};
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,5 @@
|
||||
import * as client from './client';
|
||||
|
||||
export {
|
||||
client
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"allowJs": true,
|
||||
"declaration": true,
|
||||
"esModuleInterop": true,
|
||||
"jsx": "react-jsx",
|
||||
"lib": ["es5", "es2015", "es2016", "dom", "esnext"],
|
||||
"types": ["node"],
|
||||
"module": "es2015",
|
||||
"moduleResolution": "node",
|
||||
"noImplicitAny": true,
|
||||
"noUnusedLocals": true,
|
||||
"outDir": "./dist/esm", // Output directory for compiled files
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"target": "es6",
|
||||
"declarationDir": "./dist/types", // Output directory for declaration files
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": ["src/**/*.ts"], // Include all TypeScript files in src directory
|
||||
"exclude": ["node_modules", "dist", "src/dayjs.ts"] // Exclude dist, node_modules, and specific file
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
{
|
||||
"DatabaseProviderConfiguration": {
|
||||
"ProviderType": "PostgreSQL"
|
||||
},
|
||||
"ForwardedHeadersConfiguration": {
|
||||
"Enabled": true,
|
||||
"AllowAll": true,
|
||||
"KnownProxies": [],
|
||||
"KnownNetworks": [],
|
||||
"ForwardLimit": 1
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"ConfigurationDbConnection": "Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=wsb7sebwm$BoZ9;application_name=litecharms_security;",
|
||||
"PersistedGrantDbConnection": "Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=wsb7sebwm$BoZ9;application_name=litecharms_security;",
|
||||
"IdentityDbConnection": "Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=wsb7sebwm$BoZ9;application_name=litecharms_security;",
|
||||
"AdminLogDbConnection": "Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=wsb7sebwm$BoZ9;application_name=litecharms_security;",
|
||||
"AdminAuditLogDbConnection": "Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=wsb7sebwm$BoZ9;application_name=litecharms_security;",
|
||||
"DataProtectionDbConnection": "Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=wsb7sebwm$BoZ9;application_name=litecharms_security;",
|
||||
"AdminConfigurationDbConnection": "Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=wsb7sebwm$BoZ9;application_name=litecharms_security;"
|
||||
},
|
||||
"AdminApiConfiguration": {
|
||||
"ApplicationName": "Lite Charms Security UI",
|
||||
"ApiName": "Lite Charms Security Api",
|
||||
"ApiVersion": "v1",
|
||||
"ApiBaseUrl": "https://localhost:44302",
|
||||
"IdentityServerBaseUrl": "https://localhost:44310",
|
||||
"OidcSwaggerUIClientId": "skoruba_identity_admin_api_swaggerui",
|
||||
"OidcApiName": "skoruba_identity_admin_api",
|
||||
"AdministrationRole": "Admin",
|
||||
"RequireHttpsMetadata": false,
|
||||
"CorsAllowAnyOrigin": true,
|
||||
"CorsAllowOrigins": []
|
||||
},
|
||||
"SmtpConfiguration": {
|
||||
"Host": "",
|
||||
"Login": "",
|
||||
"Password": ""
|
||||
},
|
||||
"SendGridConfiguration": {
|
||||
"ApiKey": "",
|
||||
"SourceEmail": "",
|
||||
"SourceName": ""
|
||||
},
|
||||
"AuditLoggingConfiguration": {
|
||||
"Source": "IdentityServer.Admin.Api",
|
||||
"SubjectIdentifierClaim": "sub",
|
||||
"SubjectNameClaim": "name",
|
||||
"ClientIdClaim": "client_id"
|
||||
},
|
||||
"IdentityOptions": {
|
||||
"Password": {
|
||||
"RequiredLength": 8
|
||||
},
|
||||
"User": {
|
||||
"RequireUniqueEmail": true
|
||||
},
|
||||
"SignIn": {
|
||||
"RequireConfirmedAccount": false
|
||||
}
|
||||
},
|
||||
"IdentityTableConfiguration": {
|
||||
"IdentityRoles": "Roles",
|
||||
"IdentityRoleClaims": "RoleClaims",
|
||||
"IdentityUserRoles": "UserRoles",
|
||||
"IdentityUsers": "Users",
|
||||
"IdentityUserLogins": "UserLogins",
|
||||
"IdentityUserClaims": "UserClaims",
|
||||
"IdentityUserTokens": "UserTokens"
|
||||
},
|
||||
"DataProtectionConfiguration": {
|
||||
"ProtectKeysWithAzureKeyVault": false
|
||||
},
|
||||
"AzureKeyVaultConfiguration": {
|
||||
"AzureKeyVaultEndpoint": "",
|
||||
"ClientId": "",
|
||||
"ClientSecret": "",
|
||||
"TenantId": "",
|
||||
"UseClientCredentials": true,
|
||||
"DataProtectionKeyIdentifier": "",
|
||||
"ReadConfigurationFromKeyVault": false
|
||||
},
|
||||
"SeedConfiguration": {
|
||||
"ApplySeed": true
|
||||
},
|
||||
"DatabaseMigrationsConfiguration": {
|
||||
"ApplyDatabaseMigrations": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"IdentityData": {
|
||||
"Roles": [
|
||||
{
|
||||
"Name": "Admin"
|
||||
}
|
||||
],
|
||||
"Users": [
|
||||
{
|
||||
"Username": "admin",
|
||||
"Password": "4w%HPXmwhHjq5A",
|
||||
"Email": "khwezi@litecharms.co.za",
|
||||
"Roles": [
|
||||
"Admin"
|
||||
],
|
||||
"Claims": [
|
||||
{
|
||||
"Type": "name",
|
||||
"Value": "admin"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
{
|
||||
"IdentityServerData": {
|
||||
"IdentityResources": [
|
||||
{
|
||||
"Name": "roles",
|
||||
"Enabled": true,
|
||||
"DisplayName": "Roles",
|
||||
"UserClaims": ["role"]
|
||||
},
|
||||
{
|
||||
"Name": "openid",
|
||||
"Enabled": true,
|
||||
"Required": true,
|
||||
"DisplayName": "Your user identifier",
|
||||
"UserClaims": ["sub"]
|
||||
},
|
||||
{
|
||||
"Name": "profile",
|
||||
"Enabled": true,
|
||||
"DisplayName": "User profile",
|
||||
"Description": "Your user profile information (first name, last name, etc.)",
|
||||
"Emphasize": true,
|
||||
"UserClaims": [
|
||||
"name",
|
||||
"family_name",
|
||||
"given_name",
|
||||
"middle_name",
|
||||
"nickname",
|
||||
"preferred_username",
|
||||
"profile",
|
||||
"picture",
|
||||
"website",
|
||||
"gender",
|
||||
"birthdate",
|
||||
"zoneinfo",
|
||||
"locale",
|
||||
"updated_at"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "email",
|
||||
"Enabled": true,
|
||||
"DisplayName": "Your email address",
|
||||
"Emphasize": true,
|
||||
"UserClaims": ["email", "email_verified"]
|
||||
},
|
||||
{
|
||||
"Name": "address",
|
||||
"Enabled": true,
|
||||
"DisplayName": "Your address",
|
||||
"Emphasize": true,
|
||||
"UserClaims": ["address"]
|
||||
}
|
||||
],
|
||||
"ApiScopes": [
|
||||
{
|
||||
"Name": "skoruba_identity_admin_api",
|
||||
"DisplayName": "skoruba_identity_admin_api",
|
||||
"Required": true,
|
||||
"UserClaims": ["role", "name"]
|
||||
}
|
||||
],
|
||||
"ApiResources": [
|
||||
{
|
||||
"Name": "skoruba_identity_admin_api",
|
||||
"Scopes": ["skoruba_identity_admin_api"]
|
||||
}
|
||||
],
|
||||
"Clients": [
|
||||
{
|
||||
"ClientId": "litecharms-admin-client",
|
||||
"ClientName": "litecharms-admin-client",
|
||||
"ClientUri": "https://localhost:7127",
|
||||
"AllowedGrantTypes": ["authorization_code"],
|
||||
"RequireConsent": false,
|
||||
"RequirePkce": true,
|
||||
"ClientSecrets": [
|
||||
{
|
||||
"Value": "13c0e7ada2a123cfe31e99e5c63e252c"
|
||||
}
|
||||
],
|
||||
"RedirectUris": ["https://localhost:7127/signin-oidc"],
|
||||
"FrontChannelLogoutUri": "https://localhost:7127/signout-oidc",
|
||||
"PostLogoutRedirectUris": [
|
||||
"https://localhost:7127/signout-callback-oidc"
|
||||
],
|
||||
"AllowedCorsOrigins": ["https://localhost:7127"],
|
||||
"AllowOfflineAccess": true,
|
||||
"AllowedScopes": [
|
||||
"openid",
|
||||
"email",
|
||||
"profile",
|
||||
"roles",
|
||||
"skoruba_identity_admin_api"
|
||||
],
|
||||
"RequirePushedAuthorization": true
|
||||
},
|
||||
{
|
||||
"ClientId": "skoruba_identity_admin_api_swaggerui",
|
||||
"ClientName": "skoruba_identity_admin_api_swaggerui",
|
||||
"AllowedGrantTypes": ["authorization_code"],
|
||||
"RequireClientSecret": false,
|
||||
"RequirePkce": true,
|
||||
"RedirectUris": [
|
||||
"https://localhost:44302/swagger/oauth2-redirect.html"
|
||||
],
|
||||
"AllowedScopes": ["skoruba_identity_admin_api"],
|
||||
"AllowedCorsOrigins": ["https://localhost:44302"]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
{
|
||||
"runtime": "Net100",
|
||||
"defaultVariables": null,
|
||||
"documentGenerator": {
|
||||
"aspNetCoreToOpenApi": {
|
||||
"project": "LiteCharmsSecurity.Admin.Api.csproj",
|
||||
"msBuildProjectExtensionsPath": null,
|
||||
"configuration": null,
|
||||
"runtime": "",
|
||||
"targetFramework": "",
|
||||
"noBuild": true,
|
||||
"verbose": true,
|
||||
"workingDirectory": null,
|
||||
"requireParametersWithoutDefault": true,
|
||||
"apiGroupNames": null,
|
||||
"defaultPropertyNameHandling": "CamelCase",
|
||||
"defaultReferenceTypeNullHandling": "Null",
|
||||
"defaultDictionaryValueReferenceTypeNullHandling": "NotNull",
|
||||
"defaultResponseReferenceTypeNullHandling": "NotNull",
|
||||
"defaultEnumHandling": "Integer",
|
||||
"flattenInheritanceHierarchy": false,
|
||||
"generateKnownTypes": true,
|
||||
"generateEnumMappingDescription": false,
|
||||
"generateXmlObjects": false,
|
||||
"generateAbstractProperties": true,
|
||||
"generateAbstractSchemas": true,
|
||||
"ignoreObsoleteProperties": false,
|
||||
"allowReferencesWithProperties": false,
|
||||
"excludedTypeNames": [],
|
||||
"serviceHost": null,
|
||||
"serviceBasePath": null,
|
||||
"serviceSchemes": [],
|
||||
"infoTitle": "Skoruba",
|
||||
"infoDescription": null,
|
||||
"infoVersion": "1.0.0",
|
||||
"documentTemplate": null,
|
||||
"documentProcessorTypes": [],
|
||||
"operationProcessorTypes": [],
|
||||
"typeNameGeneratorType": null,
|
||||
"schemaNameGeneratorType": null,
|
||||
"contractResolverType": null,
|
||||
"serializerSettingsType": null,
|
||||
"useDocumentProvider": false,
|
||||
"documentName": "v1",
|
||||
"aspNetCoreEnvironment": null,
|
||||
"createWebHostBuilderMethod": null,
|
||||
"startupType": null,
|
||||
"allowNullableBodyParameters": true,
|
||||
"output": null,
|
||||
"outputType": "OpenApi3",
|
||||
"newLineBehavior": "Auto",
|
||||
"assemblyPaths": [],
|
||||
"assemblyConfig": null,
|
||||
"referencePaths": [],
|
||||
"useNuGetCache": false
|
||||
}
|
||||
},
|
||||
"codeGenerators": {
|
||||
"openApiToTypeScriptClient": {
|
||||
"className": "{controller}Client",
|
||||
"moduleName": "",
|
||||
"namespace": "",
|
||||
"typeScriptVersion": 4.2,
|
||||
"template": "Fetch",
|
||||
"promiseType": "Promise",
|
||||
"httpClass": "HttpClient",
|
||||
"withCredentials": false,
|
||||
"useSingletonProvider": true,
|
||||
"injectionTokenType": "InjectionToken",
|
||||
"rxJsVersion": 6.0,
|
||||
"dateTimeType": "Date",
|
||||
"nullValue": "Undefined",
|
||||
"generateClientClasses": true,
|
||||
"generateClientInterfaces": true,
|
||||
"generateOptionalParameters": false,
|
||||
"exportTypes": true,
|
||||
"wrapDtoExceptions": false,
|
||||
"exceptionClass": "SwaggerException",
|
||||
"clientBaseClass": "WebApiClientBase",
|
||||
"wrapResponses": false,
|
||||
"wrapResponseMethods": [],
|
||||
"generateResponseClasses": true,
|
||||
"responseClass": "SwaggerResponse",
|
||||
"protectedMethods": [],
|
||||
"configurationClass": null,
|
||||
"useTransformOptionsMethod": true,
|
||||
"useTransformResultMethod": false,
|
||||
"generateDtoTypes": true,
|
||||
"operationGenerationMode": "MultipleClientsFromOperationId",
|
||||
"markOptionalProperties": false,
|
||||
"generateCloneMethod": false,
|
||||
"typeStyle": "Class",
|
||||
"classTypes": [],
|
||||
"extendedClasses": [],
|
||||
"extensionCode": "TypescriptClient/src/base-client.ts",
|
||||
"generateDefaultValues": true,
|
||||
"excludedTypeNames": [],
|
||||
"excludedParameterNames": [],
|
||||
"handleReferences": false,
|
||||
"generateConstructorInterface": true,
|
||||
"convertConstructorInterfaceData": false,
|
||||
"importRequiredTypes": false,
|
||||
"useGetBaseUrlMethod": false,
|
||||
"baseUrlTokenName": "API_BASE_URL",
|
||||
"queryNullValue": "",
|
||||
"inlineNamedDictionaries": false,
|
||||
"inlineNamedAny": false,
|
||||
"templateDirectory": null,
|
||||
"typeNameGeneratorType": null,
|
||||
"propertyNameGeneratorType": null,
|
||||
"enumNameGeneratorType": null,
|
||||
"serviceHost": null,
|
||||
"serviceSchemes": null,
|
||||
"output": "TypescriptClient/src/client.ts"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"Serilog": {
|
||||
"MinimumLevel": {
|
||||
"Default": "Error",
|
||||
"Override": {
|
||||
"Skoruba": "Information"
|
||||
}
|
||||
},
|
||||
"WriteTo": [
|
||||
{
|
||||
"Name": "Console"
|
||||
},
|
||||
{
|
||||
"Name": "File",
|
||||
"Args": {
|
||||
"path": "Log/skoruba_admin.txt",
|
||||
"rollingInterval": "Day"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Name": "MSSqlServer",
|
||||
"Args": {
|
||||
"connectionString": "Server=(localdb)\\mssqllocaldb;Database=IdentityServerAdmin;Trusted_Connection=True;MultipleActiveResultSets=true",
|
||||
"tableName": "Log",
|
||||
"columnOptionsSection": {
|
||||
"addStandardColumns": [ "LogEvent" ],
|
||||
"removeStandardColumns": [ "Properties" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Helpers
|
||||
{
|
||||
public class MigrationAssembly
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Description>Entity Framework layer for the administration of the Duende IdentityServer and Asp.Net Core Identity with PostrgreSQL support</Description>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.7" PrivateAssets="All" />
|
||||
<PackageReference Include="Skoruba.Duende.IdentityServer.Admin.EntityFramework.Admin.Storage" Version="3.0.0-rc4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\LiteCharmsSecurity.Admin.EntityFramework.Shared\LiteCharmsSecurity.Admin.EntityFramework.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+266
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
+75
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
+266
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
+53
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
+263
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
+68
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
+40
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
+68
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
+41
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
+66
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
+43
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
+31
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
+41
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
+271
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
+218
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
+46
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
+347
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
+835
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
+608
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
+905
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
+563
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
+908
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
+23
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
+1020
File diff suppressed because it is too large
Load Diff
+34
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
+1093
File diff suppressed because it is too large
Load Diff
+455
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
+1096
File diff suppressed because it is too large
Load Diff
+25
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
+1116
File diff suppressed because it is too large
Load Diff
+84
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
+1113
File diff suppressed because it is too large
Load Diff
+108
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
+75
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
+129
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
+72
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
+167
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
+49
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
+239
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
+129
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
+270
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
+73
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
+267
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
+60
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
+37
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
+58
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// Copyright (c) Jan Škoruba. All Rights Reserved.
|
||||
// Licensed under the Apache License, Version 2.0.
|
||||
|
||||
namespace LiteCharmsSecurity.Admin.EntityFramework.Shared.Configuration.Schema
|
||||
{
|
||||
public class IdentityTableConfiguration
|
||||
{
|
||||
public string IdentityRoles { get; set; } = "Roles";
|
||||
public string IdentityRoleClaims { get; set; } = "RoleClaims";
|
||||
public string IdentityUserRoles { get; set; } = "UserRoles";
|
||||
public string IdentityUsers { get; set; } = "Users";
|
||||
public string IdentityUserLogins { get; set; } = "UserLogins";
|
||||
public string IdentityUserClaims { get; set; } = "UserClaims";
|
||||
public string IdentityUserTokens { get; set; } = "UserTokens";
|
||||
public string IdentityUserPasskeys { get; set; } = "UserPasskeys";
|
||||
}
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
// Copyright (c) Jan Škoruba. All Rights Reserved.
|
||||
// Licensed under the Apache License, Version 2.0.
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Skoruba.AuditLogging.EntityFramework.DbContexts;
|
||||
using Skoruba.AuditLogging.EntityFramework.Entities;
|
||||
|
||||
namespace LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts
|
||||
{
|
||||
public class AdminAuditLogDbContext : DbContext, IAuditLoggingDbContext<AuditLog>
|
||||
{
|
||||
public AdminAuditLogDbContext(DbContextOptions<AdminAuditLogDbContext> dbContextOptions)
|
||||
: base(dbContextOptions)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Task<int> SaveChangesAsync()
|
||||
{
|
||||
return base.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public DbSet<AuditLog> AuditLog { get; set; }
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
// Copyright (c) Jan Škoruba. All Rights Reserved.
|
||||
// Licensed under the Apache License, Version 2.0.
|
||||
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Skoruba.Duende.IdentityServer.Admin.EntityFramework.Admin.Storage.Interfaces;
|
||||
using Skoruba.Duende.IdentityServer.Admin.EntityFramework.Admin.Storage.Entities;
|
||||
using Skoruba.Duende.IdentityServer.Admin.EntityFramework.Admin.Storage.Helpers;
|
||||
|
||||
namespace LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts;
|
||||
|
||||
public class AdminConfigurationDbContext : DbContext, IAdminConfigurationStoreDbContext
|
||||
{
|
||||
public DbSet<ConfigurationRule> ConfigurationRules { get; set; }
|
||||
|
||||
public AdminConfigurationDbContext(DbContextOptions<AdminConfigurationDbContext> options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
|
||||
ConfigureConfigurationRules(modelBuilder);
|
||||
SeedDefaultRules(modelBuilder);
|
||||
}
|
||||
|
||||
private void ConfigureConfigurationRules(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<ConfigurationRule>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id);
|
||||
entity.Property(e => e.RuleType).IsRequired();
|
||||
entity.Property(e => e.ResourceType).IsRequired();
|
||||
entity.Property(e => e.IssueType).IsRequired();
|
||||
entity.Property(e => e.IsEnabled).IsRequired();
|
||||
entity.Property(e => e.Configuration).HasMaxLength(2000);
|
||||
entity.Property(e => e.MessageTemplate).HasMaxLength(500);
|
||||
entity.Property(e => e.FixDescription).HasMaxLength(1000);
|
||||
entity.Property(e => e.CreatedAt).IsRequired();
|
||||
|
||||
entity.HasIndex(e => e.RuleType).IsUnique();
|
||||
});
|
||||
}
|
||||
|
||||
private void SeedDefaultRules(ModelBuilder modelBuilder)
|
||||
{
|
||||
// Use ConfigurationRuleSeedHelper for consistent seed data across all providers
|
||||
var configurationRules = Skoruba.Duende.IdentityServer.Admin.EntityFramework.Admin.Storage.Helpers.ConfigurationRuleSeedHelper.GetSeedData();
|
||||
|
||||
modelBuilder.Entity<ConfigurationRule>().HasData(configurationRules);
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
// Copyright (c) Jan Škoruba. All Rights Reserved.
|
||||
// Licensed under the Apache License, Version 2.0.
|
||||
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using LiteCharmsSecurity.Admin.EntityFramework.Shared.Configuration.Schema;
|
||||
using LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity;
|
||||
|
||||
namespace LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts
|
||||
{
|
||||
public class AdminIdentityDbContext : IdentityDbContext<UserIdentity, UserIdentityRole, string, UserIdentityUserClaim, UserIdentityUserRole, UserIdentityUserLogin, UserIdentityRoleClaim, UserIdentityUserToken, UserIdentityPasskey>
|
||||
{
|
||||
private readonly IdentityTableConfiguration _schemaConfiguration;
|
||||
|
||||
public AdminIdentityDbContext(DbContextOptions<AdminIdentityDbContext> options, IdentityTableConfiguration schemaConfiguration = null) : base(options)
|
||||
{
|
||||
_schemaConfiguration = schemaConfiguration ?? new IdentityTableConfiguration();
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
{
|
||||
base.OnModelCreating(builder);
|
||||
|
||||
ConfigureIdentityContext(builder);
|
||||
}
|
||||
|
||||
private void ConfigureIdentityContext(ModelBuilder builder)
|
||||
{
|
||||
builder.Entity<UserIdentityRole>().ToTable(_schemaConfiguration.IdentityRoles);
|
||||
builder.Entity<UserIdentityRoleClaim>().ToTable(_schemaConfiguration.IdentityRoleClaims);
|
||||
builder.Entity<UserIdentityUserRole>().ToTable(_schemaConfiguration.IdentityUserRoles);
|
||||
|
||||
builder.Entity<UserIdentity>().ToTable(_schemaConfiguration.IdentityUsers);
|
||||
builder.Entity<UserIdentityUserLogin>().ToTable(_schemaConfiguration.IdentityUserLogins);
|
||||
builder.Entity<UserIdentityUserClaim>().ToTable(_schemaConfiguration.IdentityUserClaims);
|
||||
builder.Entity<UserIdentityUserToken>().ToTable(_schemaConfiguration.IdentityUserTokens);
|
||||
builder.Entity<UserIdentityPasskey>().ToTable(_schemaConfiguration.IdentityUserPasskeys);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
// Copyright (c) Jan Škoruba. All Rights Reserved.
|
||||
// Licensed under the Apache License, Version 2.0.
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Skoruba.Duende.IdentityServer.Admin.EntityFramework.Constants;
|
||||
using Skoruba.Duende.IdentityServer.Admin.EntityFramework.Entities;
|
||||
using Skoruba.Duende.IdentityServer.Admin.EntityFramework.Interfaces;
|
||||
|
||||
namespace LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts
|
||||
{
|
||||
public class AdminLogDbContext : DbContext, IAdminLogDbContext
|
||||
{
|
||||
public DbSet<Log> Logs { get; set; }
|
||||
|
||||
public AdminLogDbContext(DbContextOptions<AdminLogDbContext> options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
{
|
||||
base.OnModelCreating(builder);
|
||||
|
||||
ConfigureLogContext(builder);
|
||||
}
|
||||
|
||||
private void ConfigureLogContext(ModelBuilder builder)
|
||||
{
|
||||
builder.Entity<Log>(log =>
|
||||
{
|
||||
log.ToTable(TableConsts.Logging);
|
||||
log.HasKey(x => x.Id);
|
||||
log.Property(x => x.Level).HasMaxLength(128);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
// Copyright (c) Jan Škoruba. All Rights Reserved.
|
||||
// Licensed under the Apache License, Version 2.0.
|
||||
|
||||
using Duende.IdentityServer.EntityFramework.DbContexts;
|
||||
using Duende.IdentityServer.EntityFramework.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Skoruba.Duende.IdentityServer.Admin.EntityFramework.Interfaces;
|
||||
|
||||
namespace LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts
|
||||
{
|
||||
public class IdentityServerConfigurationDbContext : ConfigurationDbContext<IdentityServerConfigurationDbContext>, IAdminConfigurationDbContext
|
||||
{
|
||||
public IdentityServerConfigurationDbContext(DbContextOptions<IdentityServerConfigurationDbContext> options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
|
||||
public DbSet<ApiResourceProperty> ApiResourceProperties { get; set; }
|
||||
|
||||
public DbSet<IdentityResourceProperty> IdentityResourceProperties { get; set; }
|
||||
|
||||
public DbSet<ApiResourceSecret> ApiSecrets { get; set; }
|
||||
|
||||
public DbSet<ApiScopeClaim> ApiScopeClaims { get; set; }
|
||||
|
||||
public DbSet<IdentityResourceClaim> IdentityClaims { get; set; }
|
||||
|
||||
public DbSet<ApiResourceClaim> ApiResourceClaims { get; set; }
|
||||
|
||||
public DbSet<ClientGrantType> ClientGrantTypes { get; set; }
|
||||
|
||||
public DbSet<ClientScope> ClientScopes { get; set; }
|
||||
|
||||
public DbSet<ClientSecret> ClientSecrets { get; set; }
|
||||
|
||||
public DbSet<ClientPostLogoutRedirectUri> ClientPostLogoutRedirectUris { get; set; }
|
||||
|
||||
public DbSet<ClientIdPRestriction> ClientIdPRestrictions { get; set; }
|
||||
|
||||
public DbSet<ClientRedirectUri> ClientRedirectUris { get; set; }
|
||||
|
||||
public DbSet<ClientClaim> ClientClaims { get; set; }
|
||||
|
||||
public DbSet<ClientProperty> ClientProperties { get; set; }
|
||||
|
||||
public DbSet<ApiScopeProperty> ApiScopeProperties { get; set; }
|
||||
|
||||
public DbSet<ApiResourceScope> ApiResourceScopes { get; set; }
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// Copyright (c) Jan Škoruba. All Rights Reserved.
|
||||
// Licensed under the Apache License, Version 2.0.
|
||||
|
||||
using Microsoft.AspNetCore.DataProtection.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts
|
||||
{
|
||||
public class IdentityServerDataProtectionDbContext : DbContext, IDataProtectionKeyContext
|
||||
{
|
||||
public DbSet<DataProtectionKey> DataProtectionKeys { get; set; }
|
||||
|
||||
public IdentityServerDataProtectionDbContext(DbContextOptions<IdentityServerDataProtectionDbContext> options)
|
||||
: base(options) { }
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// Copyright (c) Jan Škoruba. All Rights Reserved.
|
||||
// Licensed under the Apache License, Version 2.0.
|
||||
|
||||
using Duende.IdentityServer.EntityFramework.DbContexts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Skoruba.Duende.IdentityServer.Admin.EntityFramework.Interfaces;
|
||||
|
||||
namespace LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts
|
||||
{
|
||||
public class IdentityServerPersistedGrantDbContext : PersistedGrantDbContext<IdentityServerPersistedGrantDbContext>, IAdminPersistedGrantDbContext
|
||||
{
|
||||
public IdentityServerPersistedGrantDbContext(DbContextOptions<IdentityServerPersistedGrantDbContext> options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// Copyright (c) Jan Škoruba. All Rights Reserved.
|
||||
// Licensed under the Apache License, Version 2.0.
|
||||
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
namespace LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity
|
||||
{
|
||||
public class UserIdentity : IdentityUser
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// Copyright (c) Jan Škoruba. All Rights Reserved.
|
||||
// Licensed under the Apache License, Version 2.0.
|
||||
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
namespace LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity
|
||||
{
|
||||
public class UserIdentityUserClaim : IdentityUserClaim<string>
|
||||
{
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// Copyright (c) Jan Škoruba. All Rights Reserved.
|
||||
// Licensed under the Apache License, Version 2.0.
|
||||
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
namespace LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity
|
||||
{
|
||||
public class UserIdentityPasskey : IdentityUserPasskey<string>
|
||||
{
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// Copyright (c) Jan Škoruba. All Rights Reserved.
|
||||
// Licensed under the Apache License, Version 2.0.
|
||||
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
namespace LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity
|
||||
{
|
||||
public class UserIdentityRole : IdentityRole
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// Copyright (c) Jan Škoruba. All Rights Reserved.
|
||||
// Licensed under the Apache License, Version 2.0.
|
||||
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
namespace LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity
|
||||
{
|
||||
public class UserIdentityRoleClaim : IdentityRoleClaim<string>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// Copyright (c) Jan Škoruba. All Rights Reserved.
|
||||
// Licensed under the Apache License, Version 2.0.
|
||||
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
namespace LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity
|
||||
{
|
||||
public class UserIdentityUserLogin : IdentityUserLogin<string>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// Copyright (c) Jan Škoruba. All Rights Reserved.
|
||||
// Licensed under the Apache License, Version 2.0.
|
||||
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
namespace LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity
|
||||
{
|
||||
public class UserIdentityUserRole : IdentityUserRole<string>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user