up
Some checks failed
Build Test Deploy / build-test (push) Has been cancelled
Build Test Deploy / authority-container (push) Has been cancelled
Build Test Deploy / docs (push) Has been cancelled
Build Test Deploy / deploy (push) Has been cancelled
Docs CI / lint-and-preview (push) Has been cancelled

This commit is contained in:
root
2025-10-10 06:53:40 +00:00
parent 3aed135fb5
commit df5984d07e
1081 changed files with 97764 additions and 61389 deletions

View File

@@ -0,0 +1,32 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Authors>Ablera</Authors>
<Company>Ablera</Company>
<Product>Serdica</Product>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.5" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.5" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.5" />
<PackageReference Include="OpenIddict.EntityFrameworkCore" Version="6.3.0" />
<PackageReference Include="Oracle.EntityFrameworkCore" Version="9.23.80" />
<PackageReference Include="Oracle.ManagedDataAccess.Core" Version="23.8.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../Ablera.Serdica.DBModels.Oidc/Ablera.Serdica.DBModels.Oidc.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Migrations\" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,281 @@
// <auto-generated />
using System;
using Ablera.Serdica.DBModels.Oidc;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Oracle.EntityFrameworkCore.Metadata;
#nullable disable
namespace Ablera.Serdica.DBModels.Oidc.Migrations.Migrations
{
[DbContext(typeof(OidcDbContext))]
[Migration("20250416153520_InitialOpenIddictMigration")]
partial class InitialOpenIddictMigration
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.13")
.HasAnnotation("Proxies:ChangeTracking", false)
.HasAnnotation("Proxies:CheckEquality", false)
.HasAnnotation("Proxies:LazyLoading", true)
.HasAnnotation("Relational:MaxIdentifierLength", 128);
OracleModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreApplication", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("NVARCHAR2(450)");
b.Property<string>("ApplicationType")
.HasMaxLength(50)
.HasColumnType("NVARCHAR2(50)");
b.Property<string>("ClientId")
.HasMaxLength(100)
.HasColumnType("NVARCHAR2(100)");
b.Property<string>("ClientSecret")
.HasMaxLength(256)
.HasColumnType("NVARCHAR2(256)");
b.Property<string>("ClientType")
.HasMaxLength(50)
.HasColumnType("NVARCHAR2(50)");
b.Property<string>("ConcurrencyToken")
.IsConcurrencyToken()
.HasMaxLength(50)
.HasColumnType("NVARCHAR2(50)");
b.Property<string>("ConsentType")
.HasMaxLength(50)
.HasColumnType("NVARCHAR2(50)");
b.Property<string>("DisplayName")
.HasColumnType("NVARCHAR2(2000)");
b.Property<string>("DisplayNames")
.HasColumnType("NVARCHAR2(2000)");
b.Property<string>("JsonWebKeySet")
.HasColumnType("NVARCHAR2(2000)");
b.Property<string>("Permissions")
.HasColumnType("NVARCHAR2(2000)");
b.Property<string>("PostLogoutRedirectUris")
.HasColumnType("NVARCHAR2(2000)");
b.Property<string>("Properties")
.HasColumnType("NVARCHAR2(2000)");
b.Property<string>("RedirectUris")
.HasColumnType("NVARCHAR2(2000)");
b.Property<string>("Requirements")
.HasColumnType("NVARCHAR2(2000)");
b.Property<string>("Settings")
.HasColumnType("NVARCHAR2(2000)");
b.HasKey("Id");
b.HasIndex("ClientId")
.IsUnique()
.HasFilter("\"ClientId\" IS NOT NULL");
b.ToTable("OIDC_APPLICATIONS", "SRD_SYS");
});
modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreAuthorization", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("NVARCHAR2(450)");
b.Property<string>("ApplicationId")
.HasColumnType("NVARCHAR2(450)");
b.Property<string>("ConcurrencyToken")
.IsConcurrencyToken()
.HasMaxLength(50)
.HasColumnType("NVARCHAR2(50)");
b.Property<DateTime?>("CreationDate")
.HasColumnType("TIMESTAMP(7)");
b.Property<string>("Properties")
.HasColumnType("NVARCHAR2(2000)");
b.Property<string>("Scopes")
.HasColumnType("NVARCHAR2(2000)");
b.Property<string>("Status")
.HasMaxLength(50)
.HasColumnType("NVARCHAR2(50)");
b.Property<string>("Subject")
.HasMaxLength(400)
.HasColumnType("NVARCHAR2(400)");
b.Property<string>("Type")
.HasMaxLength(50)
.HasColumnType("NVARCHAR2(50)");
b.HasKey("Id");
b.HasIndex("ApplicationId", "Status", "Subject", "Type");
b.ToTable("OIDC_AUTHORIZATIONS", "SRD_SYS");
});
modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreScope", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("NVARCHAR2(450)");
b.Property<string>("ConcurrencyToken")
.IsConcurrencyToken()
.HasMaxLength(50)
.HasColumnType("NVARCHAR2(50)");
b.Property<string>("Description")
.HasColumnType("NVARCHAR2(2000)");
b.Property<string>("Descriptions")
.HasColumnType("NVARCHAR2(2000)");
b.Property<string>("DisplayName")
.HasColumnType("NVARCHAR2(2000)");
b.Property<string>("DisplayNames")
.HasColumnType("NVARCHAR2(2000)");
b.Property<string>("Name")
.HasMaxLength(200)
.HasColumnType("NVARCHAR2(200)");
b.Property<string>("Properties")
.HasColumnType("NVARCHAR2(2000)");
b.Property<string>("Resources")
.HasColumnType("NVARCHAR2(2000)");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique()
.HasFilter("\"Name\" IS NOT NULL");
b.ToTable("OIDC_SCOPES", "SRD_SYS");
});
modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreToken", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("NVARCHAR2(450)");
b.Property<string>("ApplicationId")
.HasColumnType("NVARCHAR2(450)");
b.Property<string>("AuthorizationId")
.HasColumnType("NVARCHAR2(450)");
b.Property<string>("ConcurrencyToken")
.IsConcurrencyToken()
.HasMaxLength(50)
.HasColumnType("NVARCHAR2(50)");
b.Property<DateTime?>("CreationDate")
.HasColumnType("TIMESTAMP(7)");
b.Property<DateTime?>("ExpirationDate")
.HasColumnType("TIMESTAMP(7)");
b.Property<string>("Payload")
.HasColumnType("NVARCHAR2(2000)");
b.Property<string>("Properties")
.HasColumnType("NVARCHAR2(2000)");
b.Property<DateTime?>("RedemptionDate")
.HasColumnType("TIMESTAMP(7)");
b.Property<string>("ReferenceId")
.HasMaxLength(100)
.HasColumnType("NVARCHAR2(100)");
b.Property<string>("Status")
.HasMaxLength(50)
.HasColumnType("NVARCHAR2(50)");
b.Property<string>("Subject")
.HasMaxLength(400)
.HasColumnType("NVARCHAR2(400)");
b.Property<string>("Type")
.HasMaxLength(50)
.HasColumnType("NVARCHAR2(50)");
b.HasKey("Id");
b.HasIndex("AuthorizationId");
b.HasIndex("ReferenceId")
.IsUnique()
.HasFilter("\"ReferenceId\" IS NOT NULL");
b.HasIndex("ApplicationId", "Status", "Subject", "Type");
b.ToTable("OIDC_TOKENS", "SRD_SYS");
});
modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreAuthorization", b =>
{
b.HasOne("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreApplication", "Application")
.WithMany("Authorizations")
.HasForeignKey("ApplicationId");
b.Navigation("Application");
});
modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreToken", b =>
{
b.HasOne("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreApplication", "Application")
.WithMany("Tokens")
.HasForeignKey("ApplicationId");
b.HasOne("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreAuthorization", "Authorization")
.WithMany("Tokens")
.HasForeignKey("AuthorizationId");
b.Navigation("Application");
b.Navigation("Authorization");
});
modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreApplication", b =>
{
b.Navigation("Authorizations");
b.Navigation("Tokens");
});
modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreAuthorization", b =>
{
b.Navigation("Tokens");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,189 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Ablera.Serdica.DBModels.Oidc.Migrations.Migrations
{
/// <inheritdoc />
public partial class InitialOpenIddictMigration : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.EnsureSchema(
name: "SRD_SYS");
migrationBuilder.CreateTable(
name: "OIDC_APPLICATIONS",
schema: "SRD_SYS",
columns: table => new
{
Id = table.Column<string>(type: "NVARCHAR2(450)", nullable: false),
ApplicationType = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: true),
ClientId = table.Column<string>(type: "NVARCHAR2(100)", maxLength: 100, nullable: true),
ClientSecret = table.Column<string>(type: "NVARCHAR2(256)", maxLength: 256, nullable: true),
ClientType = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: true),
ConcurrencyToken = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: true),
ConsentType = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: true),
DisplayName = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true),
DisplayNames = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true),
JsonWebKeySet = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true),
Permissions = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true),
PostLogoutRedirectUris = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true),
Properties = table.Column<string>(type: "NVARCHAR2(4000)", nullable: true),
RedirectUris = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true),
Requirements = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true),
Settings = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_OIDC_APPLICATIONS", x => x.Id);
});
migrationBuilder.CreateTable(
name: "OIDC_SCOPES",
schema: "SRD_SYS",
columns: table => new
{
Id = table.Column<string>(type: "NVARCHAR2(450)", nullable: false),
ConcurrencyToken = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: true),
Description = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true),
Descriptions = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true),
DisplayName = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true),
DisplayNames = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true),
Name = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: true),
Properties = table.Column<string>(type: "NVARCHAR2(4000)", nullable: true),
Resources = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_OIDC_SCOPES", x => x.Id);
});
migrationBuilder.CreateTable(
name: "OIDC_AUTHORIZATIONS",
schema: "SRD_SYS",
columns: table => new
{
Id = table.Column<string>(type: "NVARCHAR2(450)", nullable: false),
ApplicationId = table.Column<string>(type: "NVARCHAR2(450)", nullable: true),
ConcurrencyToken = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: true),
CreationDate = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true),
Properties = table.Column<string>(type: "NVARCHAR2(4000)", nullable: true),
Scopes = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true),
Status = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: true),
Subject = table.Column<string>(type: "NVARCHAR2(400)", maxLength: 400, nullable: true),
Type = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_OIDC_AUTHORIZATIONS", x => x.Id);
table.ForeignKey(
name: "FK_OIDC_AUTHORIZATIONS_OIDC_APPLICATIONS_ApplicationId",
column: x => x.ApplicationId,
principalSchema: "SRD_SYS",
principalTable: "OIDC_APPLICATIONS",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "OIDC_TOKENS",
schema: "SRD_SYS",
columns: table => new
{
Id = table.Column<string>(type: "NVARCHAR2(450)", nullable: false),
ApplicationId = table.Column<string>(type: "NVARCHAR2(450)", nullable: true),
AuthorizationId = table.Column<string>(type: "NVARCHAR2(450)", nullable: true),
ConcurrencyToken = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: true),
CreationDate = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true),
ExpirationDate = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true),
Payload = table.Column<string>(type: "CLOB", nullable: true),
Properties = table.Column<string>(type: "VARCHAR2(4000)", nullable: true),
RedemptionDate = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true),
ReferenceId = table.Column<string>(type: "NVARCHAR2(100)", maxLength: 100, nullable: true),
Status = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: true),
Subject = table.Column<string>(type: "NVARCHAR2(400)", maxLength: 400, nullable: true),
Type = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_OIDC_TOKENS", x => x.Id);
table.ForeignKey(
name: "FK_OIDC_TOKENS_OIDC_APPLICATIONS_ApplicationId",
column: x => x.ApplicationId,
principalSchema: "SRD_SYS",
principalTable: "OIDC_APPLICATIONS",
principalColumn: "Id");
table.ForeignKey(
name: "FK_OIDC_TOKENS_OIDC_AUTHORIZATIONS_AuthorizationId",
column: x => x.AuthorizationId,
principalSchema: "SRD_SYS",
principalTable: "OIDC_AUTHORIZATIONS",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_OIDC_APPLICATIONS_ClientId",
schema: "SRD_SYS",
table: "OIDC_APPLICATIONS",
column: "ClientId",
unique: true,
filter: "\"ClientId\" IS NOT NULL");
migrationBuilder.CreateIndex(
name: "IX_OIDC_AUTHORIZATIONS_ApplicationId_Status_Subject_Type",
schema: "SRD_SYS",
table: "OIDC_AUTHORIZATIONS",
columns: new[] { "ApplicationId", "Status", "Subject", "Type" });
migrationBuilder.CreateIndex(
name: "IX_OIDC_SCOPES_Name",
schema: "SRD_SYS",
table: "OIDC_SCOPES",
column: "Name",
unique: true,
filter: "\"Name\" IS NOT NULL");
migrationBuilder.CreateIndex(
name: "IX_OIDC_TOKENS_ApplicationId_Status_Subject_Type",
schema: "SRD_SYS",
table: "OIDC_TOKENS",
columns: new[] { "ApplicationId", "Status", "Subject", "Type" });
migrationBuilder.CreateIndex(
name: "IX_OIDC_TOKENS_AuthorizationId",
schema: "SRD_SYS",
table: "OIDC_TOKENS",
column: "AuthorizationId");
migrationBuilder.CreateIndex(
name: "IX_OIDC_TOKENS_ReferenceId",
schema: "SRD_SYS",
table: "OIDC_TOKENS",
column: "ReferenceId",
unique: true,
filter: "\"ReferenceId\" IS NOT NULL");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "OIDC_SCOPES",
schema: "SRD_SYS");
migrationBuilder.DropTable(
name: "OIDC_TOKENS",
schema: "SRD_SYS");
migrationBuilder.DropTable(
name: "OIDC_AUTHORIZATIONS",
schema: "SRD_SYS");
migrationBuilder.DropTable(
name: "OIDC_APPLICATIONS",
schema: "SRD_SYS");
}
}
}

View File

@@ -0,0 +1,278 @@
// <auto-generated />
using System;
using Ablera.Serdica.DBModels.Oidc;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Oracle.EntityFrameworkCore.Metadata;
#nullable disable
namespace Ablera.Serdica.DBModels.Oidc.Migrations.Migrations
{
[DbContext(typeof(OidcDbContext))]
partial class OidcDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.13")
.HasAnnotation("Proxies:ChangeTracking", false)
.HasAnnotation("Proxies:CheckEquality", false)
.HasAnnotation("Proxies:LazyLoading", true)
.HasAnnotation("Relational:MaxIdentifierLength", 128);
OracleModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("OpenIddict.EntityFramewor40004kCore.Models.OpenIddictEntityFrameworkCoreApplication", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("NVARCHAR2(450)");
b.Property<string>("ApplicationType")
.HasMaxLength(50)
.HasColumnType("NVARCHAR2(50)");
b.Property<string>("ClientId")
.HasMaxLength(100)
.HasColumnType("NVARCHAR2(100)");
b.Property<string>("ClientSecret")
.HasMaxLength(256)
.HasColumnType("NVARCHAR2(256)");
b.Property<string>("ClientType")
.HasMaxLength(50)
.HasColumnType("NVARCHAR2(50)");
b.Property<string>("ConcurrencyToken")
.IsConcurrencyToken()
.HasMaxLength(50)
.HasColumnType("NVARCHAR2(50)");
b.Property<string>("ConsentType")
.HasMaxLength(50)
.HasColumnType("NVARCHAR2(50)");
b.Property<string>("DisplayName")
.HasColumnType("VARCHAR2(4000)");
b.Property<string>("DisplayNames")
.HasColumnType("VARCHAR2(4000)");
b.Property<string>("JsonWebKeySet")
.HasColumnType("VARCHAR2(4000)");
b.Property<string>("Permissions")
.HasColumnType("VARCHAR2(4000)");
b.Property<string>("PostLogoutRedirectUris")
.HasColumnType("VARCHAR2(4000)");
b.Property<string>("Properties")
.HasColumnType("VARCHAR2(4000)");
b.Property<string>("RedirectUris")
.HasColumnType("VARCHAR2(4000)");
b.Property<string>("Requirements")
.HasColumnType("VARCHAR2(4000)");
b.Property<string>("Settings")
.HasColumnType("VARCHAR2(4000)");
b.HasKey("Id");
b.HasIndex("ClientId")
.IsUnique()
.HasFilter("\"ClientId\" IS NOT NULL");
b.ToTable("OIDC_APPLICATIONS", "SRD_SYS");
});
modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreAuthorization", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("NVARCHAR2(450)");
b.Property<string>("ApplicationId")
.HasColumnType("NVARCHAR2(450)");
b.Property<string>("ConcurrencyToken")
.IsConcurrencyToken()
.HasMaxLength(50)
.HasColumnType("NVARCHAR2(50)");
b.Property<DateTime?>("CreationDate")
.HasColumnType("TIMESTAMP(7)");
b.Property<string>("Properties")
.HasColumnType("VARCHAR2(4000)");
b.Property<string>("Scopes")
.HasColumnType("VARCHAR2(4000)");
b.Property<string>("Status")
.HasMaxLength(50)
.HasColumnType("NVARCHAR2(50)");
b.Property<string>("Subject")
.HasMaxLength(400)
.HasColumnType("NVARCHAR2(400)");
b.Property<string>("Type")
.HasMaxLength(50)
.HasColumnType("NVARCHAR2(50)");
b.HasKey("Id");
b.HasIndex("ApplicationId", "Status", "Subject", "Type");
b.ToTable("OIDC_AUTHORIZATIONS", "SRD_SYS");
});
modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreScope", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("NVARCHAR2(450)");
b.Property<string>("ConcurrencyToken")
.IsConcurrencyToken()
.HasMaxLength(50)
.HasColumnType("NVARCHAR2(50)");
b.Property<string>("Description")
.HasColumnType("VARCHAR2(4000)");
b.Property<string>("Descriptions")
.HasColumnType("VARCHAR2(4000)");
b.Property<string>("DisplayName")
.HasColumnType("VARCHAR2(4000)");
b.Property<string>("DisplayNames")
.HasColumnType("VARCHAR2(4000)");
b.Property<string>("Name")
.HasMaxLength(200)
.HasColumnType("NVARCHAR2(200)");
b.Property<string>("Properties")
.HasColumnType("VARCHAR2(4000)");
b.Property<string>("Resources")
.HasColumnType("VARCHAR2(4000)");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique()
.HasFilter("\"Name\" IS NOT NULL");
b.ToTable("OIDC_SCOPES", "SRD_SYS");
});
modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreToken", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("NVARCHAR2(450)");
b.Property<string>("ApplicationId")
.HasColumnType("NVARCHAR2(450)");
b.Property<string>("AuthorizationId")
.HasColumnType("NVARCHAR2(450)");
b.Property<string>("ConcurrencyToken")
.IsConcurrencyToken()
.HasMaxLength(50)
.HasColumnType("NVARCHAR2(50)");
b.Property<DateTime?>("CreationDate")
.HasColumnType("TIMESTAMP(7)");
b.Property<DateTime?>("ExpirationDate")
.HasColumnType("TIMESTAMP(7)");
b.Property<string>("Payload")
.HasColumnType("CLOB");
b.Property<string>("Properties")
.HasColumnType("VARCHAR2(4000)");
b.Property<DateTime?>("RedemptionDate")
.HasColumnType("TIMESTAMP(7)");
b.Property<string>("ReferenceId")
.HasMaxLength(100)
.HasColumnType("NVARCHAR2(100)");
b.Property<string>("Status")
.HasMaxLength(50)
.HasColumnType("NVARCHAR2(50)");
b.Property<string>("Subject")
.HasMaxLength(400)
.HasColumnType("NVARCHAR2(400)");
b.Property<string>("Type")
.HasMaxLength(50)
.HasColumnType("NVARCHAR2(50)");
b.HasKey("Id");
b.HasIndex("AuthorizationId");
b.HasIndex("ReferenceId")
.IsUnique()
.HasFilter("\"ReferenceId\" IS NOT NULL");
b.HasIndex("ApplicationId", "Status", "Subject", "Type");
b.ToTable("OIDC_TOKENS", "SRD_SYS");
});
modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreAuthorization", b =>
{
b.HasOne("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreApplication", "Application")
.WithMany("Authorizations")
.HasForeignKey("ApplicationId");
b.Navigation("Application");
});
modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreToken", b =>
{
b.HasOne("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreApplication", "Application")
.WithMany("Tokens")
.HasForeignKey("ApplicationId");
b.HasOne("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreAuthorization", "Authorization")
.WithMany("Tokens")
.HasForeignKey("AuthorizationId");
b.Navigation("Application");
b.Navigation("Authorization");
});
modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreApplication", b =>
{
b.Navigation("Authorizations");
b.Navigation("Tokens");
});
modelBuilder.Entity("OpenIddict.EntityFrameworkCore.Models.OpenIddictEntityFrameworkCoreAuthorization", b =>
{
b.Navigation("Tokens");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Reflection;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Ablera.Serdica.DBModels.Oidc;
namespace Ablera.Serdica.DBModels.Oidc.Migrations;
public class OidcDbContextFactory : IDesignTimeDbContextFactory<OidcDbContext>
{
public OidcDbContext CreateDbContext(string[] args)
{
// Use the current directory as base path (which is typically the startup projects folder)
var basePath = Directory.GetCurrentDirectory();
// Build configuration from appsettings.json in the startup folder
var configuration = new ConfigurationBuilder()
.SetBasePath(basePath)
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.Build();
var connectionString = configuration.GetConnectionString("DefaultConnection");
var optionsBuilder = new DbContextOptionsBuilder<OidcDbContext>();
var migrationsAssembly = typeof(Ablera.Serdica.DBModels.Oidc.Migrations.OidcDbContextFactory).Assembly.GetName().Name;
System.Console.WriteLine($"Using migration assembly name: {migrationsAssembly}");
optionsBuilder.UseOracle(connectionString, b =>
b.MigrationsAssembly(migrationsAssembly))
.UseOpenIddict();
return new OidcDbContext(optionsBuilder.Options);
}
}

View File

@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Authors>Ablera</Authors>
<Company>Ablera</Company>
<Product>Serdica</Product>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.5" />
<PackageReference Include="OpenIddict.EntityFrameworkCore" Version="6.3.0" />
<PackageReference Include="Oracle.EntityFrameworkCore" Version="9.23.80" />
<PackageReference Include="Oracle.ManagedDataAccess.Core" Version="23.8.0" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,78 @@
using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Migrations.Internal;
using Microsoft.Extensions.Configuration;
using OpenIddict.EntityFrameworkCore.Models;
namespace Ablera.Serdica.DBModels.Oidc;
public class OidcDbContext : DbContext
{
public OidcDbContext(DbContextOptions<OidcDbContext> options)
: base(options)
{
}
public virtual DbSet<OpenIddictEntityFrameworkCoreApplication> OpenIddictApplications { get; set; }
public virtual DbSet<OpenIddictEntityFrameworkCoreAuthorization> OpenIddictAuthorizations { get; set; }
public virtual DbSet<OpenIddictEntityFrameworkCoreScope> OpenIddictScopes { get; set; }
public virtual DbSet<OpenIddictEntityFrameworkCoreToken> OpenIddictTokens { get; set; }
protected override void OnModelCreating(ModelBuilder builder)
{
builder.HasAnnotation("Relational:DefaultStringType", "NVARCHAR2(4000)");
base.OnModelCreating(builder);
builder.UseOpenIddict();
// Configure the OpenIddict Applications table.
builder.Entity<OpenIddictEntityFrameworkCoreApplication>(entity =>
{
// Map to table with prefix "OIDC_" in the "SRD_SYS" schema.
entity.ToTable("OIDC_APPLICATIONS", "SRD_SYS");
// Ensure that ClientId is unique.
entity.HasIndex(e => e.ClientId)
.IsUnique();
// Optionally configure column size for ClientSecret (Oracle commonly uses VARCHAR2).
entity.Property(e => e.ClientSecret)
.HasMaxLength(256);
// Additional tuning: you might also constrain DisplayName or ConsentType here.
});
// Configure the OpenIddict Authorizations table.
builder.Entity<OpenIddictEntityFrameworkCoreAuthorization>(entity =>
{
entity.ToTable("OIDC_AUTHORIZATIONS", "SRD_SYS");
});
// Configure the OpenIddict Scopes table.
builder.Entity<OpenIddictEntityFrameworkCoreScope>(entity =>
{
entity.ToTable("OIDC_SCOPES", "SRD_SYS");
// Typically, scopes have a unique name.
entity.HasIndex(e => e.Name)
.IsUnique();
});
// Configure the OpenIddict Tokens table.
builder.Entity<OpenIddictEntityFrameworkCoreToken>(entity =>
{
entity.ToTable("OIDC_TOKENS", "SRD_SYS");
// Create an index on ReferenceId for quick lookups.
entity.HasIndex(e => e.ReferenceId)
.IsUnique();
// Optionally, you can configure the max length for certain token fields.
// For example, if ReferenceId should be a VARCHAR2(100):
entity.Property(e => e.ReferenceId)
.HasMaxLength(100);
});
}
}