skoruba-adminui-on-duende
Skill1 starsChanged 7 months agoMITView on GitHub
Add the Skoruba Duende IdentityServer Admin UI (AdminUI + Admin.Api) to an existing Duende IdentityServer application, running locally first and deploying second. Covers the two-database split (reuse the app's existing IdentityServer DB, add a separate admin DB), one-off bootstrap vs runtime migration/seed gating, wiring the OIDC api resource / api scope / admin UI client into the host IdP, seeding the admin user and administration role, Caddy/TLS + forwarded-header host rewrite so OIDC redirect URIs match, and — most importantly — resolving ASP.NET Identity table-name schema drift (`Users`/`Roles`/`UserClaims`/`UserRoles`/`UserLogins` vs `AspNet*`) and missing newer Duende `Clients` columns through EF migrations (compatibility views + idempotent ALTER) instead of manual SQL. Use when the user mentions "Skoruba", "Skoruba.Duende.IdentityServer.Admin", "Duende admin UI", "IdentityServer admin panel", "add admin UI to IdentityServer", "identity-server-admin-api", "skoruba_identity_admin_api", "relation Users / Roles / UserClaims / UserRoles / UserLogins does not exist", "42P01" from the admin API, "column PushedAuthorizationLifetime does not exist", snake_case vs PascalCase table/column drift, "PendingModelChangesWarning" / "AdminIdentityDbContext has pending changes" from Skoruba's own bootstrap, "invalid_scope" on the admin login, a login that loops back to the login page, a "SameSite=None ... must also set Secure" cookie warning, a `/{culture}/login` 404, or is standing up a management UI in front of Duende IdentityServer.
In this repository11 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- app-store-version-checkSkill
- cohosted-frontend-backendSkill
- dotnet-cpmSkill
- gitmojiSkill
- markdown-outputSkill
- oidc-integrationSkill
- repo-memorySkill
- specflow-to-reqnrollSkill
- tddSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 128
When an admin-API endpoint 500s, do this before writing anything:
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Skoruba AdminUI on Duende IdentityServer
Overview
Skoruba's Duende.IdentityServer.Admin gives you a management UI for an
existing Duende IdentityServer instance. It is three cooperating services,
not one app:
| Service | Role | Talks to |
Admin.Api | REST backend the UI calls | your DBs + your IdP (OIDC/JWT) |
Admin (AdminUI) | Blazor/MVC front-end (BFF) | Admin.Api + your IdP (OIDC login) |
| your existing IdP | issues tokens, owns the data | its own DBs |
Core principle: you do not stand up a new IdentityServer. You point Skoruba at your existing Duende IdP and its existing database, add one small admin-only database, and reconcile the schema differences with EF migrations.
This skill is local-run-first. Get it working under Docker Compose against localhost, then port the same wiring to your deployment. Deployment specifics are in references/deployment.md.
When to Use
- Adding Skoruba AdminUI in front of an existing Duende IdentityServer app.
- The admin API returns
500with42P01: relation "X" does not existor42703: column ... does not exist. - You need the OIDC client/scope/role wiring to let the admin UI log in.
Skip / adapt: greenfield IdentityServer where you control every table name from day one (drift may not exist), or non-PostgreSQL stores (the compatibility views still apply, dialect differs).
The 6 moving parts (checklist)
Work top-to-bottom. Each links to a reference when it needs detail.
- Compose topology — postgres, an admin-DB init one-off,
Admin.Api,Admin, and a TLS reverse proxy. See references/docker-compose.md. - Two-database split — reuse existing IdP DB for Configuration /
PersistedGrant / Identity; a new
*_adminDB for AdminLog / AdminAuditLog / AdminConfiguration / DataProtection. See references/docker-compose.md. - Bootstrap the admin DB WITHOUT Skoruba's auto-migration — Skoruba's
startup migration is unreliable (its shipped EF model drifts ahead of its
committed migrations →
PendingModelChangesWarningonAdminIdentityDbContext, and it tries to migrate the contexts pointed at your real DB). Create the few admin-only tables via explicit SQL in a one-off init, and keep every long-running service onApplyDatabaseMigrations=false/ApplySeed=false. See references/docker-compose.md. - IdP OIDC wiring — register the
skoruba_identity_admin_apiapi resource + api scope, the admin UI client, and seed the admin user + administration role. See references/idp-wiring.md. - Host rewrite / forwarded headers — the UI sits behind TLS on a fixed
host:port; redirect URIs must match exactly, so forward
X-Forwarded-Proto/Hostand have the IdP honor them. See references/idp-wiring.md. - Schema-drift compatibility migrations — this is where most time is lost. See references/database-compatibility.md.
Interactive login has its own three blockers (login-URL 404 when the IdP's
login frontend isn't hosted locally; a redirect loop from a SameSite=None
auth cookie dropped over HTTP; a 500 right after auth from an under-seeded admin
user). They are covered in references/idp-wiring.md §6.
The schema-drift trap (read this before debugging 500s)
Skoruba's EF models assume default IdentityServer / ASP.NET Identity table
names: Users, Roles, UserClaims, UserRoles, UserLogins, and a
Clients table with whatever columns Skoruba's Duende version expects.
Two common divergences (often combined):
- Renamed Identity tables (
AspNetUsers,AspNetRoles, …) and/or an older Duende schema (missing newerClientscolumns). - A snake_case naming convention (EFCore.NamingConventions /
UseSnakeCaseNamingConvention): every table and column issnake_case(clients.client_id,users.normalized_user_name), but Skoruba selects PascalCase (Clients.ClientId). This drifts every table across all three contexts at once — expect ~20+ config views, plus persisted-grant and identity views — each projectingsnake_col AS "PascalCol".
Each mismatch surfaces one at a time as the admin API hits a new endpoint:
| Symptom (admin API log) | Cause | Fix |
42P01: relation "Users" does not exist | table renamed to AspNetUsers | compatibility VIEW via migration |
42P01: relation "Roles" / "UserClaims" / "UserRoles" / "UserLogins" does not exist | same, for that table | compatibility VIEW via migration |
42703: column c."PushedAuthorizationLifetime" does not exist | older Duende Clients schema | idempotent ALTER TABLE ADD COLUMN IF NOT EXISTS via migration |
400 "Persisted Grant for this subject id ... doesn't exist" | data absence, not drift | none — user simply has no grants |
Non-negotiable rule: persist every schema change through an EF migration
committed to source, never hand-run psql. Manual SQL works on your laptop
and then the deployed DB 500s. This is the single most important lesson.
Full patterns, exact SQL, and the build→ef→psql validation loop are in
references/database-compatibility.md.
Fast diagnostic loop
When an admin-API endpoint 500s, do this before writing anything:
# 1. read the real Postgres error from the admin API container logs
docker compose logs --tail=50 skoruba-admin-api
# 2. confirm the drift directly — is the relation missing, and does the
# AspNet* equivalent exist?
docker compose exec -T postgres psql -U postgres -d <idp_db> -c \
"SELECT to_regclass('\"Users\"'), to_regclass('\"AspNetUsers\"');"42P01 / 42703 → schema drift → add a migration.
400 ... doesn't exist in a JSON validation body → data absence, not a bug.
Validation (definition of done, local)
dotnet buildthe migrations project succeeds.dotnet ef migrations list --context <Context>shows your new migration.dotnet ef migrations script <prev> <new> --context <Context>emits the expected DDL.dotnet ef database update <new> --context <Context>applies it.psqlconfirms the view/column exists and a representative query runs.- The failing admin-UI page now loads (or returns an empty list, not a 500).
Repeat per endpoint until the UI is clean. Then move the same migrations and env wiring into the deployment path (references/deployment.md).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

