55 Commits
Author SHA1 Message Date
khwezi a8f864270d Merge pull request 'Claims' (#29) from claims into master
Reviewed-on: #29
2026-09-02 15:34:56 +02:00
hermes 6fb4f83fc0 Resolved System.Security.Cryptography.Xml CVE 2026-09-02 15:34:31 +02:00
hermes fb3b02d264 Fixed System.Security.Cryptography.Xml CVE 2026-09-02 15:31:56 +02:00
khwezi c426f356f0 Merge pull request 'Reverted nuget package version upgrades' (#28) from claims into master
Reviewed-on: #28
2026-09-02 15:24:31 +02:00
hermes 7732d952e9 Reverted nuget package version upgrades 2026-09-02 15:24:01 +02:00
khwezi 87a36df871 Merge pull request 'Claims' (#27) from claims into master
Reviewed-on: #27
2026-09-02 15:01:23 +02:00
hermes b8537ff7c6 Added custom profile claims injector 2026-09-02 15:00:35 +02:00
hermes 3be84072d3 Updated nuget packages 2026-08-16 11:13:40 +02:00
khwezi 9da44ce346 Merge pull request 'Changed app titles' (#26) from setup into master
Reviewed-on: #26
2026-06-07 13:22:33 +02:00
Khwezi Mngoma 9534cc501f Changed app titles 2026-06-07 13:20:25 +02:00
khwezi c43be94f1a Merge pull request 'Fixed migration' (#25) from setup into master
Reviewed-on: #25
2026-06-06 14:41:03 +02:00
Khwezi Mngoma 7d22dd078c Fixed migration 2026-06-06 14:40:06 +02:00
khwezi 08dc13932c Merge pull request 'Removed version specification in docker compose file' (#24) from setup into master
Reviewed-on: #24
2026-06-06 11:15:00 +02:00
Khwezi Mngoma 59920952c2 Added drift supression to Program.cs 2026-06-06 11:14:29 +02:00
Khwezi Mngoma 5b3c1961ef Removed version specification in docker compose file 2026-06-06 11:10:03 +02:00
khwezi 7337bb9f14 Merge pull request 'Added nexus sourc to docker files' (#23) from setup into master
Reviewed-on: #23
2026-06-06 10:56:00 +02:00
Khwezi Mngoma 1788af60cc Added nexus sourc to docker files 2026-06-06 10:55:37 +02:00
khwezi adae62a673 Merge pull request 'Refactored RegisterDbContexts to ignore pending changes rule' (#22) from setup into master
Reviewed-on: #22
2026-06-06 10:46:40 +02:00
Khwezi Mngoma aa5d689740 Refactored RegisterDbContexts to ignore pending changes rule 2026-06-06 10:46:08 +02:00
khwezi 043f30eb94 Merge pull request 'Added EF_CORE_SUPPRESS_PENDING_MODEL_CHANGES_WARNING' (#21) from setup into master
Reviewed-on: #21
2026-06-06 10:25:32 +02:00
Khwezi Mngoma 742d556c03 Added EF_CORE_SUPPRESS_PENDING_MODEL_CHANGES_WARNING 2026-06-06 10:25:03 +02:00
khwezi 4f2fc59091 Merge pull request 'Added AdminIdentityDbContext extension' (#20) from setup into master
Reviewed-on: #20
2026-06-06 01:40:10 +02:00
Khwezi Mngoma cf59d6dcc3 Added AdminIdentityDbContext extension 2026-06-06 01:39:48 +02:00
khwezi fd5f65a39a Merge pull request 'Refactored connection strings' (#19) from setup into master
Reviewed-on: #19
2026-06-06 01:29:53 +02:00
Khwezi Mngoma cc8d9dff88 Refactored connection strings 2026-06-06 01:29:29 +02:00
khwezi 134b1f8984 Merge pull request 'Refactored dockerignore' (#18) from setup into master
Reviewed-on: #18
2026-06-06 01:15:53 +02:00
Khwezi Mngoma ddf1cb6ba5 Refactored dockerignore 2026-06-06 01:15:25 +02:00
khwezi 9174438503 Merge pull request 'Ignoring missing resource files not needed for a dotnet restore' (#17) from setup into master
Reviewed-on: #17
2026-06-06 01:12:41 +02:00
Khwezi Mngoma c78102264e Ignoring missing resource files not needed for a dotnet restore 2026-06-06 01:12:17 +02:00
khwezi fe7fa3fa33 Merge pull request 'Fixed solution file name typo' (#16) from setup into master
Reviewed-on: #16
2026-06-06 00:55:37 +02:00
Khwezi Mngoma fa679c18eb Fixed solution file name typo 2026-06-06 00:55:00 +02:00
khwezi c011f8a066 Merge pull request 'Removed debug code' (#15) from setup into master
Reviewed-on: #15
2026-06-06 00:45:27 +02:00
Khwezi Mngoma a4b41a7385 Removed debug code 2026-06-06 00:44:23 +02:00
khwezi 5e565f288d Merge pull request 'Added forced output code' (#14) from setup into master
Reviewed-on: #14
2026-06-06 00:40:55 +02:00
Khwezi Mngoma 49840847ff Added forced output code 2026-06-06 00:40:20 +02:00
khwezi 2174c45903 Merge pull request 'Added ebug code to docker fiiles' (#13) from setup into master
Reviewed-on: #13
2026-06-06 00:33:37 +02:00
Khwezi Mngoma e4dd946280 Added ebug code to docker fiiles 2026-06-06 00:33:13 +02:00
khwezi b0019749fc Merge pull request 'FORCE BuildKit to use the host network interface to clear DNS/handshake resolution' (#12) from setup into master
Reviewed-on: #12
2026-06-06 00:30:14 +02:00
Khwezi Mngoma d80c1eab81 FORCE BuildKit to use the host network interface to clear DNS/handshake resolution 2026-06-06 00:29:49 +02:00
khwezi 54fa60f81b Merge pull request 'Simplified docker files' (#11) from setup into master
Reviewed-on: #11
2026-06-06 00:23:52 +02:00
Khwezi Mngoma 22cc955a41 Simplified docker files 2026-06-06 00:23:28 +02:00
khwezi 64f189345a Merge pull request 'Refactored docker files to overcome the individually targeted project files' (#10) from setup into master
Reviewed-on: #10
2026-06-06 00:16:48 +02:00
Khwezi Mngoma 8a5d55fc2a Refactored docker files to overcome the individually targeted project files 2026-06-06 00:16:21 +02:00
khwezi 28616de240 Merge pull request 'Removed nexus source' (#9) from setup into master
Reviewed-on: #9
2026-06-06 00:10:12 +02:00
Khwezi Mngoma be6cb422e5 Removed nexus source 2026-06-06 00:09:48 +02:00
khwezi 68ee0ad3b7 Merge pull request 'Added NUGET_CERT_REVOCATION_MODE to docker files' (#8) from setup into master
Reviewed-on: #8
2026-06-06 00:07:28 +02:00
Khwezi Mngoma 5f1e31b703 Added NUGET_CERT_REVOCATION_MODE to docker files 2026-06-06 00:07:00 +02:00
khwezi 7b8c03763d Merge pull request 'Added host resolution fix to build steps' (#7) from setup into master
Reviewed-on: #7
2026-06-06 00:03:41 +02:00
Khwezi Mngoma 99c3498ae4 Added host resolution fix to build steps
Added verbosity flags on each restore command
2026-06-06 00:03:18 +02:00
khwezi ca29ddd8c5 Merge pull request 'Removed the need to use Targetarch from dotnet commands' (#6) from setup into master
Reviewed-on: #6
2026-06-05 23:57:23 +02:00
Khwezi Mngoma ab4fbefa40 Removed the need to use Targetarch from dotnet commands 2026-06-05 23:56:59 +02:00
khwezi 956301a5fc Merge pull request 'Refactored docker files to remove the slash notation no the restore command' (#5) from setup into master
Reviewed-on: #5
2026-06-05 23:53:47 +02:00
Khwezi Mngoma 7ab3d1a153 Refactored docker files to remove the slash notation no the restore command 2026-06-05 23:53:19 +02:00
khwezi cefd11c907 Merge pull request 'Added nexus package source to docker file' (#4) from setup into master
Reviewed-on: #4
2026-06-05 23:51:05 +02:00
Khwezi Mngoma 23070382d3 Added nexus package source to docker file 2026-06-05 23:50:39 +02:00
23 changed files with 906 additions and 378 deletions
+24 -11
View File
@@ -1,25 +1,38 @@
**/.classpath # Source Control / IDEs
**/.dockerignore
**/.env
**/.git **/.git
**/.gitignore **/.gitignore
**/.project **/.gitattributes
**/.settings
**/.toolstarget
**/.vs **/.vs
**/.vscode **/.vscode
**/.classpath
**/.project
**/.settings
**/*.*proj.user **/*.*proj.user
**/*.dbmdl **/*.dbmdl
**/*.jfm **/*.jfm
**/azds.yaml
# Build / Dependency Artifacts
**/bin **/bin
**/charts **/obj
**/docker-compose*
**/Dockerfile*
**/node_modules **/node_modules
**/npm-debug.log **/npm-debug.log
**/obj **/.toolstarget
# Docker / Deployment Files
**/.dockerignore
**/.env
**/Dockerfile*
**/charts
**/secrets.dev.yaml **/secrets.dev.yaml
**/values.dev.yaml **/values.dev.yaml
**/azds.yaml
# Explicitly target Docker Compose configuration files while sparing .dcproj
**/docker-compose.yml
**/docker-compose.override.yml
**/docker-compose.prod.yml
**/docker-compose.staging.yml
# Miscellaneous
LICENSE LICENSE
README.md README.md
+19 -17
View File
@@ -1,14 +1,13 @@
version: '3.4'
services: services:
litecharmssecurity.admin: litecharmssecurity.admin:
image: skoruba-duende-identityserver-admin image: skoruba-duende-identityserver-admin
build: build:
context: . context: .
dockerfile: src/LiteCharmsSecurity.Admin/Dockerfile dockerfile: src/LiteCharmsSecurity.Admin/Dockerfile
network: host
container_name: litecharms-security-admin container_name: litecharms-security-admin
ports: ports:
- "8081:8080" # Point your tunnel to this host port for admin.security.khongisa.co.za - "8081:8080"
environment: environment:
- ASPNETCORE_ENVIRONMENT=Production - ASPNETCORE_ENVIRONMENT=Production
- ForwardedHeadersConfiguration__Enabled=true - ForwardedHeadersConfiguration__Enabled=true
@@ -22,17 +21,19 @@ services:
- AdminConfiguration__BasicConfiguration__BasePath=/ - AdminConfiguration__BasicConfiguration__BasePath=/
# Postgres Database Overrides # Postgres Database Overrides
- ConnectionStrings__DataProtectionDbConnection=Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=${DB_PASSWORD};application_name=litecharms_security_admin_dp; - ConnectionStrings__DataProtectionDbConnection=Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=${DB_PASSWORD};
litecharmssecurity.admin.api: litecharmssecurity.admin.api:
image: skoruba-duende-identityserver-admin-api image: skoruba-duende-identityserver-admin-api
build: build:
context: . context: .
dockerfile: src/LiteCharmsSecurity.Admin.Api/Dockerfile dockerfile: src/LiteCharmsSecurity.Admin.Api/Dockerfile
network: host
container_name: litecharms-security-admin-api container_name: litecharms-security-admin-api
ports: ports:
- "8082:8080" # Point your tunnel to this host port for api.security.khongisa.co.za - "8082:8080"
environment: environment:
- EF_CORE_SUPPRESS_PENDING_MODEL_CHANGES_WARNING=true
- ASPNETCORE_ENVIRONMENT=Production - ASPNETCORE_ENVIRONMENT=Production
- ForwardedHeadersConfiguration__Enabled=true - ForwardedHeadersConfiguration__Enabled=true
- ForwardedHeadersConfiguration__AllowAll=true - ForwardedHeadersConfiguration__AllowAll=true
@@ -45,13 +46,13 @@ services:
- AdminApiConfiguration__IdentityServerBaseUrl=https://sts.security.khongisa.co.za - AdminApiConfiguration__IdentityServerBaseUrl=https://sts.security.khongisa.co.za
# Postgres Database Overrides # Postgres Database Overrides
- ConnectionStrings__ConfigurationDbConnection=Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=${DB_PASSWORD};application_name=litecharms_security_config; - ConnectionStrings__ConfigurationDbConnection=Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=${DB_PASSWORD};
- ConnectionStrings__PersistedGrantDbConnection=Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=${DB_PASSWORD};application_name=litecharms_security_grant; - ConnectionStrings__PersistedGrantDbConnection=Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=${DB_PASSWORD};
- ConnectionStrings__IdentityDbConnection=Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=${DB_PASSWORD};application_name=litecharms_security_identity; - ConnectionStrings__IdentityDbConnection=Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=${DB_PASSWORD};
- ConnectionStrings__AdminLogDbConnection=Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=${DB_PASSWORD};application_name=litecharms_security_log; - ConnectionStrings__AdminLogDbConnection=Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=${DB_PASSWORD};
- ConnectionStrings__AdminAuditLogDbConnection=Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=${DB_PASSWORD};application_name=litecharms_security_audit; - ConnectionStrings__AdminAuditLogDbConnection=Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=${DB_PASSWORD};
- ConnectionStrings__AdminConfigurationDbConnection=Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=${DB_PASSWORD};application_name=litecharms_security_admin_config; - ConnectionStrings__AdminConfigurationDbConnection=Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=${DB_PASSWORD};
- ConnectionStrings__DataProtectionDbConnection=Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=${DB_PASSWORD};application_name=litecharms_security_api_dp; - ConnectionStrings__DataProtectionDbConnection=Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=${DB_PASSWORD};
# Operational Management Switches (Controlled via Dockhand UI variables) # Operational Management Switches (Controlled via Dockhand UI variables)
- SeedConfiguration__ApplySeed=${APPLY_SEED:-true} - SeedConfiguration__ApplySeed=${APPLY_SEED:-true}
@@ -75,9 +76,10 @@ services:
build: build:
context: . context: .
dockerfile: src/LiteCharmsSecurity.STS.Identity/Dockerfile dockerfile: src/LiteCharmsSecurity.STS.Identity/Dockerfile
network: host
container_name: litecharms-security-sts-identity container_name: litecharms-security-sts-identity
ports: ports:
- "8083:8080" # Point your tunnel to this host port for sts.security.khongisa.co.za - "8083:8080"
environment: environment:
- ASPNETCORE_ENVIRONMENT=Production - ASPNETCORE_ENVIRONMENT=Production
- ForwardedHeadersConfiguration__Enabled=true - ForwardedHeadersConfiguration__Enabled=true
@@ -95,7 +97,7 @@ services:
- SmtpConfiguration__Password=${SMTP_PASSWORD} - SmtpConfiguration__Password=${SMTP_PASSWORD}
# Postgres Database Overrides # Postgres Database Overrides
- ConnectionStrings__ConfigurationDbConnection=Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=${DB_PASSWORD};application_name=litecharms_security_sts_config; - ConnectionStrings__ConfigurationDbConnection=Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=${DB_PASSWORD};
- ConnectionStrings__PersistedGrantDbConnection=Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=${DB_PASSWORD};application_name=litecharms_security_sts_grant; - ConnectionStrings__PersistedGrantDbConnection=Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=${DB_PASSWORD};
- ConnectionStrings__IdentityDbConnection=Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=${DB_PASSWORD};application_name=litecharms_security_sts_identity; - ConnectionStrings__IdentityDbConnection=Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=${DB_PASSWORD};
- ConnectionStrings__DataProtectionDbConnection=Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=${DB_PASSWORD};application_name=litecharms_security_sts_dp; - ConnectionStrings__DataProtectionDbConnection=Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=${DB_PASSWORD};
+13
View File
@@ -0,0 +1,13 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "10.0.7",
"commands": [
"dotnet-ef"
],
"rollForward": false
}
}
}
+9 -11
View File
@@ -3,21 +3,19 @@ WORKDIR /app
EXPOSE 80 EXPOSE 80
EXPOSE 443 EXPOSE 443
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0 AS build FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
ARG TARGETARCH ARG TARGETARCH
WORKDIR /src WORKDIR /app_source
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 . . COPY . .
WORKDIR "src/LiteCharmsSecurity.Admin.Api"
RUN dotnet build -a $TARGETARCH "LiteCharmsSecurity.Admin.Api.csproj" -c Release -o /app/build RUN dotnet restore "LiteCharmsSecurity.AdminUI.sln"
WORKDIR "/app_source/src/LiteCharmsSecurity.Admin.Api"
RUN dotnet build "LiteCharmsSecurity.Admin.Api.csproj" -c Release -o /app/build
FROM build AS publish FROM build AS publish
RUN dotnet publish -a $TARGETARCH "LiteCharmsSecurity.Admin.Api.csproj" -c Release --no-restore -o /app/publish RUN dotnet publish "LiteCharmsSecurity.Admin.Api.csproj" -c Release --no-restore -o /app/publish
FROM base AS final FROM base AS final
WORKDIR /app WORKDIR /app
@@ -17,6 +17,10 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.7">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="10.0.7"> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="10.0.7">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
@@ -24,6 +24,11 @@ namespace LiteCharmsSecurity.Admin.Api
public static async Task Main(string[] args) public static async Task Main(string[] args)
{ {
// Force EF Core to globally ignore the Model Drift warning at the AppDomain level
AppContext.SetSwitch("Microsoft.EntityFrameworkCore.Issue34300", true);
// OR if using standard diagnostics suppression:
System.Environment.SetEnvironmentVariable("EF_CORE_SUPPRESS_PENDING_MODEL_CHANGES_WARNING", "true");
var configuration = GetConfiguration(args); var configuration = GetConfiguration(args);
Log.Logger = new LoggerConfiguration() Log.Logger = new LoggerConfiguration()
+8 -6
View File
@@ -1,25 +1,27 @@
// Copyright (c) Jan Škoruba. All Rights Reserved. // Copyright (c) Jan Škoruba. All Rights Reserved.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using System.IdentityModel.Tokens.Jwt;
using HealthChecks.UI.Client; using HealthChecks.UI.Client;
using LiteCharmsSecurity.Admin.Api.Configuration;
using LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts;
using LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity;
using LiteCharmsSecurity.Shared.Dtos;
using LiteCharmsSecurity.Shared.Dtos.Identity;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Diagnostics.HealthChecks; using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using NSwag.AspNetCore; using NSwag.AspNetCore;
using Skoruba.AuditLogging.EntityFramework.Entities; using Skoruba.AuditLogging.EntityFramework.Entities;
using LiteCharmsSecurity.Admin.Api.Configuration;
using Skoruba.Duende.IdentityServer.Admin.EntityFramework.Configuration.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.Configuration;
using Skoruba.Duende.IdentityServer.Admin.UI.Api.Helpers; using Skoruba.Duende.IdentityServer.Admin.UI.Api.Helpers;
using Skoruba.Duende.IdentityServer.Shared.Configuration.Helpers; using Skoruba.Duende.IdentityServer.Shared.Configuration.Helpers;
using LiteCharmsSecurity.Shared.Dtos; using System.IdentityModel.Tokens.Jwt;
using LiteCharmsSecurity.Shared.Dtos.Identity;
using StartupHelpers = Skoruba.Duende.IdentityServer.Shared.Configuration.Helpers.StartupHelpers; using StartupHelpers = Skoruba.Duende.IdentityServer.Shared.Configuration.Helpers.StartupHelpers;
namespace LiteCharmsSecurity.Admin.Api namespace LiteCharmsSecurity.Admin.Api
@@ -10,16 +10,16 @@
"ForwardLimit": 1 "ForwardLimit": 1
}, },
"ConnectionStrings": { "ConnectionStrings": {
"ConfigurationDbConnection": "Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=wsb7sebwm$BoZ9;application_name=litecharms_security;", "ConfigurationDbConnection": "Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=wsb7sebwm$BoZ9;",
"PersistedGrantDbConnection": "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;",
"IdentityDbConnection": "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;",
"AdminLogDbConnection": "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;",
"AdminAuditLogDbConnection": "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;",
"DataProtectionDbConnection": "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;",
"AdminConfigurationDbConnection": "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;"
}, },
"AdminApiConfiguration": { "AdminApiConfiguration": {
"ApplicationName": "Lite Charms Security UI", "ApplicationName": "Lite Charms Security",
"ApiName": "Lite Charms Security Api", "ApiName": "Lite Charms Security Api",
"ApiVersion": "v1", "ApiVersion": "v1",
"ApiBaseUrl": "https://localhost:44302", "ApiBaseUrl": "https://localhost:44302",
@@ -80,9 +80,9 @@
"ReadConfigurationFromKeyVault": false "ReadConfigurationFromKeyVault": false
}, },
"SeedConfiguration": { "SeedConfiguration": {
"ApplySeed": true "ApplySeed": false
}, },
"DatabaseMigrationsConfiguration": { "DatabaseMigrationsConfiguration": {
"ApplyDatabaseMigrations": true "ApplyDatabaseMigrations": false
} }
} }
@@ -9,6 +9,7 @@
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.1" /> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.7" PrivateAssets="All" /> <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" /> <PackageReference Include="Skoruba.Duende.IdentityServer.Admin.EntityFramework.Admin.Storage" Version="3.0.0-rc4" />
<PackageReference Include="System.Security.Cryptography.Xml" Version="10.0.11" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@@ -0,0 +1,350 @@
// <auto-generated />
using System;
using LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.Identity
{
[DbContext(typeof(AdminIdentityDbContext))]
[Migration("20260606104139_FixModelDrift")]
partial class FixModelDrift
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.7")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
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.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.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(450)
.HasColumnType("character varying(450)");
b.Property<string>("ProviderKey")
.HasMaxLength(450)
.HasColumnType("character varying(450)");
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(450)
.HasColumnType("character varying(450)");
b.Property<string>("Name")
.HasMaxLength(450)
.HasColumnType("character varying(450)");
b.Property<string>("Value")
.HasColumnType("text");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("UserTokens", (string)null);
});
modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityPasskey", b =>
{
b.HasOne("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentity", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsOne("Microsoft.AspNetCore.Identity.IdentityPasskeyData", "Data", b1 =>
{
b1.Property<byte[]>("UserIdentityPasskeyCredentialId");
b1.Property<byte[]>("AttestationObject")
.IsRequired();
b1.Property<byte[]>("ClientDataJson")
.IsRequired();
b1.Property<DateTimeOffset>("CreatedAt");
b1.Property<bool>("IsBackedUp");
b1.Property<bool>("IsBackupEligible");
b1.Property<bool>("IsUserVerified");
b1.Property<string>("Name");
b1.Property<byte[]>("PublicKey")
.IsRequired();
b1.Property<long>("SignCount");
b1.PrimitiveCollection<string>("Transports");
b1.HasKey("UserIdentityPasskeyCredentialId");
b1.ToTable("UserPasskeys");
b1
.ToJson("Data")
.HasColumnType("jsonb");
b1.WithOwner()
.HasForeignKey("UserIdentityPasskeyCredentialId");
});
b.Navigation("Data")
.IsRequired();
});
modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityRoleClaim", b =>
{
b.HasOne("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityUserClaim", b =>
{
b.HasOne("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentity", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityUserLogin", b =>
{
b.HasOne("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentity", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityUserRole", b =>
{
b.HasOne("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentity", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityUserToken", b =>
{
b.HasOne("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentity", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,98 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.Identity
{
/// <inheritdoc />
public partial class FixModelDrift : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "UserTokens",
type: "character varying(450)",
maxLength: 450,
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(128)",
oldMaxLength: 128);
migrationBuilder.AlterColumn<string>(
name: "LoginProvider",
table: "UserTokens",
type: "character varying(450)",
maxLength: 450,
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(128)",
oldMaxLength: 128);
migrationBuilder.AlterColumn<string>(
name: "ProviderKey",
table: "UserLogins",
type: "character varying(450)",
maxLength: 450,
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(128)",
oldMaxLength: 128);
migrationBuilder.AlterColumn<string>(
name: "LoginProvider",
table: "UserLogins",
type: "character varying(450)",
maxLength: 450,
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(128)",
oldMaxLength: 128);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "UserTokens",
type: "character varying(128)",
maxLength: 128,
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(450)",
oldMaxLength: 450);
migrationBuilder.AlterColumn<string>(
name: "LoginProvider",
table: "UserTokens",
type: "character varying(128)",
maxLength: 128,
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(450)",
oldMaxLength: 450);
migrationBuilder.AlterColumn<string>(
name: "ProviderKey",
table: "UserLogins",
type: "character varying(128)",
maxLength: 128,
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(450)",
oldMaxLength: 450);
migrationBuilder.AlterColumn<string>(
name: "LoginProvider",
table: "UserLogins",
type: "character varying(128)",
maxLength: 128,
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(450)",
oldMaxLength: 450);
}
}
}
@@ -1,10 +1,10 @@
// <auto-generated /> // <auto-generated />
using System; using System;
using LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts;
#nullable disable #nullable disable
@@ -17,28 +17,11 @@ namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.Identit
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "10.0.2") .HasAnnotation("ProductVersion", "10.0.7")
.HasAnnotation("Relational:MaxIdentifierLength", 63); .HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); 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 => modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentity", b =>
{ {
b.Property<string>("Id") b.Property<string>("Id")
@@ -104,6 +87,23 @@ namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.Identit
b.ToTable("Users", (string)null); b.ToTable("Users", (string)null);
}); });
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.UserIdentityRole", b => modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityRole", b =>
{ {
b.Property<string>("Id") b.Property<string>("Id")
@@ -183,12 +183,12 @@ namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.Identit
modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityUserLogin", b => modelBuilder.Entity("LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity.UserIdentityUserLogin", b =>
{ {
b.Property<string>("LoginProvider") b.Property<string>("LoginProvider")
.HasMaxLength(128) .HasMaxLength(450)
.HasColumnType("character varying(128)"); .HasColumnType("character varying(450)");
b.Property<string>("ProviderKey") b.Property<string>("ProviderKey")
.HasMaxLength(128) .HasMaxLength(450)
.HasColumnType("character varying(128)"); .HasColumnType("character varying(450)");
b.Property<string>("ProviderDisplayName") b.Property<string>("ProviderDisplayName")
.HasColumnType("text"); .HasColumnType("text");
@@ -225,12 +225,12 @@ namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.Identit
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("LoginProvider") b.Property<string>("LoginProvider")
.HasMaxLength(128) .HasMaxLength(450)
.HasColumnType("character varying(128)"); .HasColumnType("character varying(450)");
b.Property<string>("Name") b.Property<string>("Name")
.HasMaxLength(128) .HasMaxLength(450)
.HasColumnType("character varying(128)"); .HasColumnType("character varying(450)");
b.Property<string>("Value") b.Property<string>("Value")
.HasColumnType("text"); .HasColumnType("text");
@@ -7,9 +7,14 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.DataProtection.EntityFrameworkCore" Version="10.0.7" /> <PackageReference Include="Microsoft.AspNetCore.DataProtection.EntityFrameworkCore" Version="10.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.7">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Skoruba.AuditLogging.EntityFramework" Version="3.0.0" /> <PackageReference Include="Skoruba.AuditLogging.EntityFramework" Version="3.0.0" />
<PackageReference Include="Skoruba.Duende.IdentityServer.Admin.EntityFramework.Admin.Storage" Version="3.0.0-rc4" /> <PackageReference Include="Skoruba.Duende.IdentityServer.Admin.EntityFramework.Admin.Storage" Version="3.0.0-rc4" />
<PackageReference Include="Skoruba.Duende.IdentityServer.Admin.EntityFramework.Configuration" Version="3.0.0-rc4" /> <PackageReference Include="Skoruba.Duende.IdentityServer.Admin.EntityFramework.Configuration" Version="3.0.0-rc4" />
<PackageReference Include="System.Security.Cryptography.Xml" Version="10.0.11" />
</ItemGroup> </ItemGroup>
</Project> </Project>
@@ -9,6 +9,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="10.0.7" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="10.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.7" PrivateAssets="All" /> <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" /> <PackageReference Include="Skoruba.Duende.IdentityServer.Admin.EntityFramework.Admin.Storage" Version="3.0.0-rc4" />
<PackageReference Include="System.Security.Cryptography.Xml" Version="10.0.11" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
+9 -15
View File
@@ -5,32 +5,26 @@ EXPOSE 443
FROM node:22-bookworm-slim AS node FROM node:22-bookworm-slim AS node
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0 AS build FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
ARG TARGETARCH ARG TARGETARCH
ENV DOTNET_CLI_TELEMETRY_OPTOUT=1 \ ENV DOTNET_CLI_TELEMETRY_OPTOUT=1 \
NUGET_XMLDOC_MODE=skip NUGET_XMLDOC_MODE=skip
WORKDIR /src WORKDIR /app_source
COPY --from=node /usr/local/bin/node /usr/local/bin/node COPY --from=node /usr/local/bin/node /usr/local/bin/node
COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules
RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \ RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \
&& npm install -g npm@latest \ && npm install -g npm@latest
&& node --version && npm --version
COPY ["src/LiteCharmsSecurity.Admin/LiteCharmsSecurity.Admin.csproj", "src/LiteCharmsSecurity.Admin/"]
COPY ["src/LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL/LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.csproj", "src/LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL/"]
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/"]
RUN dotnet restore -a $TARGETARCH "src/LiteCharmsSecurity.Admin/LiteCharmsSecurity.Admin.csproj"
COPY . . COPY . .
WORKDIR "src/LiteCharmsSecurity.Admin"
RUN dotnet build -a $TARGETARCH "LiteCharmsSecurity.Admin.csproj" -c Release -o /app/build RUN dotnet restore "LiteCharmsSecurity.AdminUI.sln"
WORKDIR "/app_source/src/LiteCharmsSecurity.Admin"
RUN dotnet build "LiteCharmsSecurity.Admin.csproj" -c Release -o /app/build
FROM build AS publish FROM build AS publish
RUN dotnet publish -a $TARGETARCH "LiteCharmsSecurity.Admin.csproj" -c Release --no-restore -o /app/publish RUN dotnet publish "LiteCharmsSecurity.Admin.csproj" -c Release --no-restore -o /app/publish
FROM base AS final FROM base AS final
WORKDIR /app WORKDIR /app
@@ -15,7 +15,7 @@
}, },
"AdminConfiguration": { "AdminConfiguration": {
"BasicConfiguration": { "BasicConfiguration": {
"Title": "Lite Charms Security UI", "Title": "Lite Charms Security",
"BasePath": "/" "BasePath": "/"
}, },
"AuthenticationConfiguration": { "AuthenticationConfiguration": {
@@ -41,7 +41,7 @@
"ProtectKeysWithAzureKeyVault": false "ProtectKeysWithAzureKeyVault": false
}, },
"ConnectionStrings": { "ConnectionStrings": {
"DataProtectionDbConnection": "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;"
}, },
"AzureKeyVaultConfiguration": { "AzureKeyVaultConfiguration": {
"AzureKeyVaultEndpoint": "", "AzureKeyVaultEndpoint": "",
+10 -10
View File
@@ -1,21 +1,21 @@
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
WORKDIR /app WORKDIR /app
EXPOSE 80 EXPOSE 80
EXPOSE 443 EXPOSE 443
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:9.0 AS build FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
ARG TARGETARCH ARG TARGETARCH
WORKDIR /src WORKDIR /app_source
COPY ["src/LiteCharmsSecurity.STS.Identity/LiteCharmsSecurity.STS.Identity.csproj", "src/LiteCharmsSecurity.STS.Identity/"]
COPY ["src/LiteCharmsSecurity.Admin.EntityFramework.Shared/LiteCharmsSecurity.Admin.EntityFramework.Shared.csproj", "src/LiteCharmsSecurity.Admin.EntityFramework.Shared/"]
COPY ["src/LiteCharmsSecurity.Shared/LiteCharmsSecurity.Shared.csproj", "src/LiteCharmsSecurity.Shared/"]
RUN dotnet restore -a $TARGETARCH "src/LiteCharmsSecurity.STS.Identity/LiteCharmsSecurity.STS.Identity.csproj"
COPY . . COPY . .
WORKDIR "src/LiteCharmsSecurity.STS.Identity"
RUN dotnet build -a $TARGETARCH "LiteCharmsSecurity.STS.Identity.csproj" -c Release -o /app/build RUN dotnet restore "LiteCharmsSecurity.AdminUI.sln"
WORKDIR "/app_source/src/LiteCharmsSecurity.STS.Identity"
RUN dotnet build "LiteCharmsSecurity.STS.Identity.csproj" -c Release -o /app/build
FROM build AS publish FROM build AS publish
RUN dotnet publish -a $TARGETARCH "LiteCharmsSecurity.STS.Identity.csproj" -c Release --no-restore -o /app/publish RUN dotnet publish "LiteCharmsSecurity.STS.Identity.csproj" -c Release --no-restore -o /app/publish
FROM base AS final FROM base AS final
WORKDIR /app WORKDIR /app
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net10.0</TargetFramework> <TargetFramework>net10.0</TargetFramework>
@@ -0,0 +1,39 @@
using Duende.IdentityServer.Models;
using Duende.IdentityServer.Services;
using LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity;
using Microsoft.AspNetCore.Identity;
using System.Security.Claims;
using System.Threading;
using System.Threading.Tasks;
namespace LiteCharmsSecurity.STS.Identity.Services;
public sealed class ClaimsInjectorProfileService(UserManager<UserIdentity> userManager) : IProfileService
{
public Task GetProfileDataAsync(ProfileDataRequestContext context)
=> GetProfileDataAsync(context, CancellationToken.None);
public async Task GetProfileDataAsync(ProfileDataRequestContext context, CancellationToken ct)
{
var user = await userManager.GetUserAsync(context.Subject);
if (user != null && !string.IsNullOrEmpty(user.Email))
{
context.IssuedClaims.Add(new Claim("email", user.Email));
context.IssuedClaims.Add(new Claim("email_verified", user.EmailConfirmed ? "true" : "false"));
if (!string.IsNullOrEmpty(user.UserName))
{
context.IssuedClaims.Add(new Claim("preferred_username", user.UserName));
}
}
}
public Task IsActiveAsync(IsActiveContext context)
=> IsActiveAsync(context, CancellationToken.None);
public async Task IsActiveAsync(IsActiveContext context, CancellationToken ct)
{
var user = await userManager.GetUserAsync(context.Subject);
context.IsActive = user != null;
}
}
+14 -12
View File
@@ -1,24 +1,25 @@
using System;
using System.Threading.Tasks;
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 IdentityModel;
using Duende.IdentityServer; using Duende.IdentityServer;
using Duende.IdentityServer.Configuration; using Duende.IdentityServer.Configuration;
using HealthChecks.UI.Client;
using IdentityModel;
using LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts; using LiteCharmsSecurity.Admin.EntityFramework.Shared.DbContexts;
using LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity; using LiteCharmsSecurity.Admin.EntityFramework.Shared.Entities.Identity;
using Skoruba.Duende.IdentityServer.Shared.Configuration.Helpers;
using LiteCharmsSecurity.STS.Identity.Configuration; using LiteCharmsSecurity.STS.Identity.Configuration;
using LiteCharmsSecurity.STS.Identity.Configuration.Constants; using LiteCharmsSecurity.STS.Identity.Configuration.Constants;
using LiteCharmsSecurity.STS.Identity.Configuration.Interfaces; using LiteCharmsSecurity.STS.Identity.Configuration.Interfaces;
using LiteCharmsSecurity.STS.Identity.Helpers; using LiteCharmsSecurity.STS.Identity.Helpers;
using LiteCharmsSecurity.STS.Identity.Passkeys; using LiteCharmsSecurity.STS.Identity.Passkeys;
using LiteCharmsSecurity.STS.Identity.Services;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Skoruba.Duende.IdentityServer.Shared.Configuration.Helpers;
using System;
using System.Threading.Tasks;
namespace LiteCharmsSecurity.STS.Identity namespace LiteCharmsSecurity.STS.Identity
{ {
@@ -129,7 +130,8 @@ namespace LiteCharmsSecurity.STS.Identity
public virtual void RegisterAuthentication(IServiceCollection services) public virtual void RegisterAuthentication(IServiceCollection services)
{ {
services.AddAuthenticationServices<AdminIdentityDbContext, UserIdentity, UserIdentityRole>(Configuration); services.AddAuthenticationServices<AdminIdentityDbContext, UserIdentity, UserIdentityRole>(Configuration);
services.AddIdentityServer<IdentityServerConfigurationDbContext, IdentityServerPersistedGrantDbContext, UserIdentity>(Configuration); services.AddIdentityServer<IdentityServerConfigurationDbContext, IdentityServerPersistedGrantDbContext, UserIdentity>(Configuration)
.AddProfileService<ClaimsInjectorProfileService>();
} }
public virtual void RegisterAuthorization(IServiceCollection services) public virtual void RegisterAuthorization(IServiceCollection services)
@@ -1,9 +1,9 @@
{ {
"ConnectionStrings": { "ConnectionStrings": {
"ConfigurationDbConnection": "Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=wsb7sebwm$BoZ9;application_name=litecharms_security;", "ConfigurationDbConnection": "Server=192.168.1.170;Port=5432;Database=skoruba;User Id=skoruba;Password=wsb7sebwm$BoZ9;",
"PersistedGrantDbConnection": "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;",
"IdentityDbConnection": "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;",
"DataProtectionDbConnection": "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;"
}, },
"DatabaseProviderConfiguration": { "DatabaseProviderConfiguration": {
"ProviderType": "PostgreSQL" "ProviderType": "PostgreSQL"
@@ -61,7 +61,7 @@
"ResolutionPolicy": "Username" "ResolutionPolicy": "Username"
}, },
"AdminConfiguration": { "AdminConfiguration": {
"PageTitle": "Lite Charms IdentityServer", "PageTitle": "Lite Charms Security",
"HomePageLogoUri": "~/images/skoruba-icon.svg", "HomePageLogoUri": "~/images/skoruba-icon.svg",
"FaviconUri": "~/favicon.svg", "FaviconUri": "~/favicon.svg",
"Theme": null, "Theme": null,
@@ -14,6 +14,7 @@
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="10.0.7" /> <PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="10.0.7" />
<PackageReference Include="Sendgrid" Version="9.29.3" /> <PackageReference Include="Sendgrid" Version="9.29.3" />
<PackageReference Include="Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Identity" Version="3.0.0-rc4" /> <PackageReference Include="Skoruba.Duende.IdentityServer.Admin.BusinessLogic.Identity" Version="3.0.0-rc4" />
<PackageReference Include="System.Security.Cryptography.Xml" Version="10.0.11" />
</ItemGroup> </ItemGroup>
</Project> </Project>