Bundle: redb-identity / root files (_root.txt), 15 files Snapshot: development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-identity Index: https://redbase.app/src/dev-2026-12-06/redb-identity/_index.txt ==== Path: redb-identity/CHANGELOG.md Snapshot: redb-identity, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/CHANGELOG.md ---- # Changelog All notable changes to redb.Identity will be documented in this file. This changelog covers the **planned NuGet/`.tpkg` packages** that ship from this repository: | Package | Description | |---------|-------------| | `redb.Identity.Core` | OIDC / OAuth 2.1 engine: OpenIddict pipeline on redb.Route, redb-backed stores (Application, Authorization, Token, Scope, KeyRing, Session, Audit), `direct-vm://identity-*` API surface | | `redb.Identity.Core.Module` | `.tpkg` host glue for `redb.Identity.Core` — `IRouteModule` entry point, configuration binding, named-redb wiring (`identity`) | | `redb.Identity.Contracts` | Transport-agnostic request/response DTOs and route-name constants shared by Core, Http, and Client | | `redb.Identity.Management` | Transport-neutral management and self-service controllers — thin adapters over the `direct-vm://identity-manage-*` routes, shared by every facade | | `redb.Identity.Http` | HTTP / HTTPS facade `.tpkg` — OIDC discovery, `authorize`, `token`, `userinfo`, `introspect`, `revoke`, JWKS, PAR, DCR, SCIM, `/me`, management, browser flows | | `redb.Identity.Grpc` | gRPC facade `.tpkg` — service-to-service surface (`Token`, `Introspect`, `Revoke`, `UserInfo`, `Discovery`, `Jwks`) + management services; contract shipped in `redb.Identity.Contracts` under `Protos/` | | `redb.Identity.Soap` | WS-Trust facade `.tpkg` — `Issue`, `Validate`, `Cancel`, `Renew` over SOAP on the same core routes; WSDL published on GET | | `redb.Identity.Web` | Server-rendered host pages: login, native consent, MFA enrollment, e-mail verification, password recovery, account self-service | | `redb.Identity.Client` | In-process and HTTP client SDK for `direct-vm://identity-*` endpoints + backchannel OIDC client (`BackchannelOidcClient`) | | `redb.Identity.DataProtection` | Standalone `Microsoft.AspNetCore.DataProtection` wiring on redb-backed key-ring storage (no ASP.NET) | | `redb.Identity.Ldap` | LDAP / Active Directory federation provider — directory sync handler + bind-on-login adapter | | `redb.Identity.Resource.Dpop` | Resource-server middleware: DPoP (RFC 9449) proof validation + replay cache for downstream APIs | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). > **Note on version history:** **`1.0.1`** is the first public source release > (repo: [redbase-app/redb-identity](https://github.com/redbase-app/redb-identity)). > The pre-1.0 history is preserved as `1.0.0-preview.*` in [changelog/CHANGELOG-1.x.md](changelog/CHANGELOG-1.x.md) — the engine ran > in internal Tsak deployments through the whole `direct-vm://`-first design > phase; those entries collapse that history. Versioning is unified across all > packages in the table above — every release bumps every package together. > > **From `3.4.0` onward redb.Identity shares the ecosystem version** (`redb` core / `redb.Route` / > `redb.Tsak`) instead of its own `1.x` line — see the `[3.4.0]` entry in [changelog/CHANGELOG-3.x.md](changelog/CHANGELOG-3.x.md). The `1.0.1`–`1.2.2` tags stay > as valid history; the jump to `3.4.0` is a realignment onto the shared number, not a breaking change. > NuGet publication follows the source cut. ## [Unreleased] Pending changes live in `changelog/unreleased/` until the release; `pwsh scripts/changelog.ps1 -Preview` shows them. ## [4.8.0] — 2026-12-01 ### Breaking - **Admin TOTP confirm works again: `IdentityClient.ConfirmUserTotpAsync` takes the setup token.** Confirming through the management API was refused with `Missing setup_token`; the request now carries `setupToken` from the setup answer, and the client method has a new `setupToken` parameter. Packages: `redb.Identity.Client`, `redb.Identity.Management`. Upgrade: [UPGRADING.md](UPGRADING.md#admin-totp-confirm-sends-the-setup-token). - **The client needs `Authority`.** `IdentityClientOptions` and `BackchannelIdentityClientOptions` take the token and every other protocol address from the discovery document of the issuer instead of `BaseUrl`, so their `Authority` is required; without it the host fails at start with a message naming the option. Packages: `redb.Identity.Client`. Upgrade: [UPGRADING.md](UPGRADING.md#the-client-needs-the-authority). - **Group names are unique across the group tree, compared without case and surrounding whitespace.** Creating or renaming a group to a name another group has answers `409`. Groups that already share a name keep working and are reported at every start until renamed; the upgrade notes list the query that finds them. Packages: `redb.Identity.Core`, `redb.Identity.Ldap`. Upgrade: [UPGRADING.md](UPGRADING.md#group-names-are-unique). - **External audit targets are delivered through the delivery outbox, with retries per target.** A target that is down no longer loses events or holds up the others; delivery is at least once and unordered. Every enabled target now needs a unique `Name`, or the start stops; `TimeoutMs`, `MaxAttempts` and `RetryBackoffMs` set its retries. Packages: `redb.Identity.Core`. Upgrade: [UPGRADING.md](UPGRADING.md#audit-targets-go-through-the-outbox). - **Identity in an own host starts with one call, `RedbIdentityHost.StartAsync`, after `services.AddRedbIdentityHost()`.** It reads the `Identity` and `IdentityTransport` sections and fails at start, naming the key, when the issuer, a key source or the transport section is missing. The older entry point `redb.Identity.Core.InitRoute` is removed, and options registered in the host's own container are no longer read; the upgrade notes show the replacement. Packages: `redb.Identity.Core`, `redb.Identity.Core.Module`, `redb.Identity.Http`, `redb.Identity.Grpc`, `redb.Identity.Soap`. Upgrade: [UPGRADING.md](UPGRADING.md#own-host-one-start-call). - **E-mail MFA can be enrolled: setup sends the code, and `IdentityClient.ConfirmUserEmailAsync` takes `mfaState` and `setupToken`.** The code goes out through the SMTP channel or the host's e-mail channel, also for sign-in. Setup answers `501 no_channel`, `429 rate_limited` or `502 delivery_failed` when it cannot send. Packages: `redb.Identity.Core`, `redb.Identity.Client`, `redb.Identity.Management`. Upgrade: [UPGRADING.md](UPGRADING.md#e-mail-mfa-enrollment-sends-the-code). - **Back-channel logout goes only to public `https` addresses by default.** `Identity:BackchannelLogout:RequireHttps` now defaults to `true` and `:AllowPrivateNetworkTargets` to `false`, so the check runs without being turned on, also for clients registered earlier. A relying party on an internal network or on plain HTTP no longer receives the notification until those options are set; the logout itself completes either way. Packages: `redb.Identity.Core`. Upgrade: [UPGRADING.md](UPGRADING.md#back-channel-logout-addresses-must-be-public-https). - **A JAR `request_uri` must be registered for its client.** Clients get the `request_uris` metadata (management API, console, dynamic registration). With JAR on, a `request_uri` is fetched only when it equals one of the client's registered values; any other is answered `invalid_request_uri`. Inline request objects and PAR are not affected. `Jar.RequireRequestUriRegistration=false` keeps unregistered clients working, with a warning per request. Packages: `redb.Identity.Core`, `redb.Identity.Contracts`. Upgrade: [UPGRADING.md](UPGRADING.md#request_uri-needs-registered-addresses). - **The redb.Identity packages target .NET 10 and .NET 11; .NET 8 and .NET 9 are no longer targets.** Both reached end of support on 10 November 2026. An application on .NET 8 or 9 stays on 4.7.x or moves to .NET 10. The images, the archives and the Tsak modules run on .NET 10 as before. Upgrade: [UPGRADING.md](UPGRADING.md#net-10-and-net-11-only). ### Added - **Every management answer of redb.Identity has a declared type in `redb.Identity.Contracts`.** Refusals, outcomes, groups, admin MFA, sessions, tokens, cleanups, webhook deliveries and impersonation can be read as types by a .NET client; the JSON on the wire is unchanged, except that `IntrospectionResponse` leaves absent members out. Packages: `redb.Identity.Contracts`. - **The delivery outbox cleans itself, can be inspected and redelivered, and reports its backlog.** Finished rows go after 7 days (delivered) or 30 days (failed, cancelled), pending rows never; `GET /webhooks/deliveries` and `POST /webhooks/deliveries/{id}/redeliver` manage them, a redelivery is audited as `WebhookDeliveryRedelivered`; the module turns Degraded when a delivery waits over 5 minutes. Packages: `redb.Identity.Core`, `redb.Identity.Management`. - **Device authorization and pushed authorization requests (PAR) accept client authentication by HTTP Basic, as the token endpoint does.** A confidential client may send its credentials in the `Authorization` header there instead of the form body, and the discovery document lists `client_secret_basic` for both endpoints. Packages: `redb.Identity.Core`. - **Audit events of management calls record the acting client and subject.** `identity_audit_log` gains an `actor_subject` column, added automatically, and the audit API and targets carry it; `client_id` and `ip_address` are filled for these events too. Packages: `redb.Identity.Core`, `redb.Identity.Contracts`. - **`private_key_jwt` clients can publish their keys at `jwks_uri`.** Without an inline `jwks`, the keys at the client's `jwks_uri` verify its client assertions, fetched through the outbound URL guard and cached (`Identity:ClientKeys:CacheLifetime`, `Identity:ClientKeys:MinimumRefreshInterval`); a rotated key is picked up by one bounded refresh. Dynamic registration also accepts `request_object_signing_alg`, and the registration read (RFC 7592) returns it. Packages: `redb.Identity.Core`, `redb.Identity.Contracts`. - **`IdentityTransport:Http:Host` sets the bind address of the HTTP facade**, as `Host` already does for the gRPC and SOAP facades. The default stays `0.0.0.0`; `127.0.0.1` keeps the listeners on the loopback behind a local proxy. Packages: `redb.Identity.Http`. - **The recovery-code pepper can be rotated.** `Identity:RecoveryCodePreviousPeppers` keeps earlier values of `Identity:RecoveryCodePepper` for verification, so unused MFA recovery codes and open password-reset, e-mail verification and change-e-mail links survive a new pepper. The leader logs daily how many users still hold codes under each previous value. The steps are in the README, "Rotating the recovery-code pepper". ### Changed - **The client asks for `identity:manage` by default.** `IdentityClientOptions.Scopes` defaulted to `identity.admin`, a scope the server does not know, so a token request that kept the default failed with `invalid_scope`. It now asks for `identity:manage`, as `BackchannelIdentityClientOptions` does; set a narrower scope if the client needs less. Packages: `redb.Identity.Client`. Upgrade: [UPGRADING.md](UPGRADING.md#the-client-asks-for-identitymanage-by-default). - **The self-service MFA and WebAuthn answers are declared types in `redb.Identity.Contracts`** (`MfaStatusResponse`, `MfaSetupResponse`, `WebAuthnStatusResponse`, `WebAuthnCredentialList` and the others). The JSON on the wire is unchanged. Packages: `redb.Identity.Contracts`, `redb.Identity.Core`. - **A management request refused for a state conflict answers `409`, not `400`.** This changes the status of: creating a federation provider, a role or a claim definition that already exists, and deleting a system role. The federation provider answer also says `"error": "duplicate"` now, not `"conflict"`. Deleting a role that does not exist answers `404`. A client that branches on `400` for these cases checks for `409` (or `404`) instead. Packages: `redb.Identity.Core`, `redb.Identity.Management`. - **A management request for a record that is not there answers `404`, as RFC 9110 and RFC 7644 describe.** This now holds for `DELETE` of a user, an application, a scope, a claim definition, a claim mapper, a claim scope and a group, and for reading the members of a group or checking a membership. These answered `200` before (the user delete with `"alreadyAbsent": true`). A client that treats a repeated `DELETE` as success accepts `404` there too. Packages: `redb.Identity.Core`. - **Webhook deliveries go through an outbox table and survive a restart.** Events are written to `identity_delivery_outbox` (created at start) and sent by a delivery worker with retries, a per-subscriber limit and at-least-once semantics; a delivery to a subscription deleted or disabled in between is not sent. Receivers deduplicate by `X-RedbIdentity-Delivery` and must not rely on arrival order; the README section "Webhook delivery" has the details and the `Identity:Delivery` settings. Packages: `redb.Identity.Core`. - **The Identity packages bring the redb.Route and redb.Tsak assemblies they need at run time.** A host that embeds Identity from NuGet no longer has to reference `redb.Route.Redis`, `redb.Route.Mail`, `redb.Tsak.Contracts` or `redb.Tsak.Core` itself to start. Its dependency closure grows accordingly (`redb.Identity.Core.Module` brings `redb.Tsak.Core`). A deployment in a Tsak worker needs no change: the modules still carry no copy of these. Packages: `redb.Identity.Core`, `redb.Identity.Core.Module`, `redb.Identity.Ldap`, `redb.Identity.Resource.Dpop`. - **An `invalid_client` answer to a request that used HTTP Basic carries `WWW-Authenticate: Basic`.** This includes a wrong client secret sent through Basic. Requests that authenticate in the form body are answered as before. Packages: `redb.Identity.Core`. - **Base64 from a client is read only in its canonical spelling, the same on .NET 10 and .NET 11.** This applies to HTTP Basic credentials, the session, consent, MFA, federation and logout values the server issued, and a WS-Trust `BinarySecurityToken` declared `Base64Binary`. A value whose last character has non-zero unused bits, which no standard encoder writes, is refused. A declared `Base64Binary` token that is not base64 now gets `wst:InvalidRequest` instead of being passed on as text. Packages: `redb.Identity.Core`, `redb.Identity.Http`, `redb.Identity.Soap`. - **The cache of fetched client key sets is bounded.** It holds at most `Identity:ClientKeys:MaxCachedKeySets` `jwks_uri` addresses (256 by default; before, there was no bound); an address dropped from it is fetched again when it is needed. Packages: `redb.Identity.Core`. - **Dynamic registration stores `jwks_uri`, and `jwks` for every auth method.** Both are answered from storage; a request with both is refused with `invalid_client_metadata`, as RFC 7591 requires. A client that registered a `jwks_uri` before 4.8.0 sends it again in a registration update (`PUT /connect/register/{client_id}`). Packages: `redb.Identity.Core`. - **Built on redb 4.8.0, redb.Route 4.8.0 and redb.Tsak 4.8.0.** The images and archives take those releases; the Identity store takes the redb 4.8.0 database upgrade at its first start, and all nodes of one database move to 4.8.0 together, as the redb 4.8.0 upgrade notes describe. Packages: `redb.Identity.Core`. - **`dotnet new redb-identity-app --framework` offers `net10.0` (the default) and `net11.0`; `net8.0` and `net9.0` are gone.** The choice sets the web server only: the module and its contracts load into the Tsak worker and stay on `net10.0`. Packages: `redb.Templates`. - **Microsoft dependencies move to the 10.0.15 servicing line.** Microsoft.Extensions.*, Microsoft.Data.Sqlite, System.Security.Cryptography.Xml / Pkcs and the ASP.NET Core packages are referenced at 10.0.15 (was 10.0.13). On .NET 11 the ASP.NET Core packages (DataProtection, JwtBearer, OpenIdConnect) and System.Security.Cryptography.Xml / Pkcs are taken from the 11.0 line. An application that pins one of them lower raises its pin. - **A federation provider's client secret follows one rule on create and update.** An empty string or no value means no secret; on update an empty string clears the stored one, and no value leaves it alone. A secret of white space only is refused with `400 validation_error` instead of being stored. ### Fixed - **The console keeps backchannel logout with a separate management port.** With `ManagementPort` set and `Identity:ApiBaseUrl` on that port, the console asked the management port for its service token and got `404`, so a backchannel logout never reached it. It now takes the token endpoint from the discovery document of `Identity:Authority`. - **The console's Settings page shows discovery and JWKS with a separate management port.** With `ManagementPort` set and `Identity:ApiBaseUrl` on that port, both panels answered `404`; they now read the issuer named by `Identity:Authority`. ## Earlier versions Earlier releases are archived by line in [changelog/](changelog/): [4.7.x](changelog/CHANGELOG-4.7.x.md), [4.6.x](changelog/CHANGELOG-4.6.x.md), [4.5.x](changelog/CHANGELOG-4.5.x.md), [4.4.x](changelog/CHANGELOG-4.4.x.md), [4.3.x](changelog/CHANGELOG-4.3.x.md), [4.2.x](changelog/CHANGELOG-4.2.x.md), [4.1.x](changelog/CHANGELOG-4.1.x.md), [4.0.x](changelog/CHANGELOG-4.0.x.md), [3.x](changelog/CHANGELOG-3.x.md), [1.x](changelog/CHANGELOG-1.x.md). Path: redb-identity/CONTRIBUTING.md Snapshot: redb-identity, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/CONTRIBUTING.md ---- # Contributing to redb.Identity Thank you for your interest in redb.Identity! ## How to Contribute Everything below is open to anyone with a GitHub account. You do not need to be a member, a collaborator, or a previous contributor to open an issue or start a discussion. ### Asking Questions - [Discussions → Q&A](https://github.com/redbase-app/redb-identity/discussions/categories/q-a) — how to configure a flow, why a token looks the way it does, anything else - [Discussions → Ideas](https://github.com/redbase-app/redb-identity/discussions/categories/ideas) — propose a direction before it becomes a feature request ### Reporting Issues - [GitHub Issues](https://github.com/redbase-app/redb-identity/issues) for bug reports and feature requests - **Security vulnerabilities go to [a private advisory](https://github.com/redbase-app/redb-identity/security/advisories/new), not a public issue.** See [SECURITY.md](SECURITY.md). ### Bug Reports Please include: - Package name and version (e.g. `redb.Identity.Core 3.6.0`) - .NET version and database provider (PostgreSQL / MSSQL / SQLite) - The flow involved (`authorization_code`, `client_credentials`, `refresh_token`, device code, ...) - Client type — public or confidential - The actual request and response, with secrets and tokens redacted - Expected vs actual behavior, including exception message and stack trace if any A failing request/response pair is worth more than a description. If the behaviour deviates from an RFC or the OpenID Connect spec, cite the section — spec compliance is treated as a correctness requirement here, not a preference. ### Feature Requests Open an issue or a [Discussion](https://github.com/redbase-app/redb-identity/discussions/categories/ideas) with: - Description of the feature - Use case / motivation - The relevant RFC or OpenID Connect specification, if the feature is a standard one - Example configuration or API showing the desired shape ## Code Contributions ### Scope This repository contains the source of the redb.Identity authorization server: the core engine, the HTTP and gRPC facades, the Management API, the client library, and the web UI. Pull requests for bug fixes, spec-compliance fixes, documentation improvements, and test coverage are welcome. ### Getting Started 1. Fork the repository 2. Create a branch: `git checkout -b fix/refresh-token-rotation` 3. Make your changes (see guidelines below) 4. Run the test suite 5. Submit a Pull Request with a clear description ### Code Guidelines - Follow the existing code style — C# 12, `nullable enable`, `implicit usings` - Use English for all code identifiers, XML doc summaries, and error messages - Add `/// ` for all new public classes and methods - Prefer concrete types and strong typing; do not use `dynamic` - Error responses must follow the relevant RFC — correct `error` code, correct HTTP status - Never log tokens, client secrets, authorization codes, or key material - Do not suppress `CS1591` — every public member must have XML documentation ### Tests A bug fix needs a test that fails on the unfixed code and passes on the fixed one. Do not weaken an assertion to make a suite green. Some suites need external services (PostgreSQL, LDAP, an SMTP sink). If you cannot run those locally, say so in the pull request rather than skipping them silently. ### Commit Messages Use the format: `type(scope): description` Examples: - `fix(token): reject refresh token reuse after rotation` - `feat(par): support RFC 9126 pushed authorization requests` - `docs(deployment): correct the signing key store default` ## License By contributing, you agree that your contributions will be licensed under the [Apache License 2.0](LICENSE). Path: redb-identity/DEPLOYMENT.md Snapshot: redb-identity, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/DEPLOYMENT.md ---- # redb.Identity: Deployment Guide redb.Identity is an OIDC/OAuth2 identity server that runs as **Tsak modules** on the [redb.Tsak](https://github.com/redbase-app/redb-tsak) Worker runtime. The backend is a set of `.tpkg` modules (`identity.contracts` carrier, `identity.core` engine, `identity.http` facade, optional `identity.grpc` and `identity.soap` facades) plus a `context.json`; the login/admin UI is a separate Blazor **BFF** (`redb.Identity.Web`). You pick a distribution shape based on what you want bundled, from the OIDC backend alone to backend, Tsak dashboard and Identity's own UI in one container. --- ## Port matrix | Port | Service | In which artifacts | |------|---------|--------------------| | **9090** | Tsak Worker management API; in managed and full only on 127.0.0.1 inside the container, behind the dashboard | backend, (archive) | | **5002** | **Identity OIDC** (HTTPS): `/connect/*`, `/.well-known/*`, userinfo | backend, managed, full, (archive) | | **8085** | Tsak dashboard (manages the Worker) | managed, full, (archive) | | **8087** | **Identity BFF**: login, consent, admin UI | full, web, (archive) | The OIDC default in code is 8080; `context.json` pins it to **5002**. Every host port can be remapped (`-p :`, or `PublicPort` in `context.json`). --- ## Artifacts ### Images (`ghcr.io/redbase-app/…`) | Image | What's inside | Ports | Use it when | |-------|---------------|-------|-------------| | `redb-identity-backend` | Tsak Worker + Identity modules | 9090, 5002 | pure OIDC backend, you already have UIs | | `redb-identity-managed` | + **Tsak dashboard** | 5002, **8085** | backend you want to **manage** via the Tsak dashboard | | `redb-identity-full` | + **Identity BFF** | 5002, 8085, **8087** | everything: managed backend **and** Identity's own login UI | | `redb-identity-web` | Identity BFF only | 8087 | scale/deploy the UI separately, point it at any backend | Tags: `:`, `:-net10` and `:latest`. The images start on SQLite with a bundled self-signed certificate for `localhost` (password `changeit`); call them with `curl -k` until you replace it ([HTTPS.md](HTTPS.md)). ### Archives (GitHub Release assets) | Archive | What's inside | For | |---------|---------------|-----| | `redb-identity--` | self-contained worker + dashboard + modules + BFF + start scripts | run the **full** stack without Docker | | `redb-identity-modules-` | the `.tpkg` modules + `context.json` | **updating** an existing backend (drop into Worker `modules/`, hot-reload) | > **Version coupling.** The backend, managed and full images are built on the Tsak Worker/stack image of the same > release, and the modules are packed against that Worker. Deploy the modules onto the matching Tsak version. --- ## Run Named volumes keep the state across a recreated container: the SQLite store (`/app/data`), the Identity Web key ring and log, and the key rings of the Tsak worker and dashboard. Without them, every recreated container signs all users out. ### Full (backend + dashboard + Identity UI) ```bash docker run -d --name redb-identity-full \ -p 8087:8087 -p 8085:8085 -p 5002:5002 \ -e Tsak__Api__Host=127.0.0.1 -e Tsak__Web__AdminPassword= \ -e Tsak__Contexts__identity.core__Override__Identity__SeedBackchannelClient__ClientSecret= \ -e Identity__BackchannelClient__ClientSecret= \ -v identity_data:/app/data \ -v web_keys:/app/web-keys -v web_logs:/app/web-logs \ -v dp_keys:/root/.aspnet/DataProtection-Keys \ ghcr.io/redbase-app/redb-identity-full:latest # Identity login/admin : http://localhost:8087 # Tsak dashboard : http://localhost:8085 # OIDC discovery : https://localhost:5002/.well-known/openid-configuration ``` ### Managed (backend + Tsak dashboard, no Identity UI) ```bash docker run -d --name redb-identity-managed -p 8085:8085 -p 5002:5002 \ -e Tsak__Api__Host=127.0.0.1 -e Tsak__Web__AdminPassword= \ -v identity_data:/app/data -v dp_keys:/root/.aspnet/DataProtection-Keys \ ghcr.io/redbase-app/redb-identity-managed:latest ``` ### Backend only (OIDC, no UI) ```bash docker run -d --name redb-identity-backend -p 5002:5002 -p 9090:9090 \ -v identity_data:/app/data \ ghcr.io/redbase-app/redb-identity-backend:latest ``` ### Web BFF only (against an external backend) ```bash docker run -d --name redb-identity-web -p 8087:8087 \ -e Identity__Authority=https://your-backend:5002 \ -e Identity__MetadataAddress=https://your-backend:5002/.well-known/openid-configuration \ -e Identity__ApiBaseUrl=https://your-backend:5002 \ -e Identity__BackchannelClient__ClientSecret= \ -v web_keys:/app/keys -v web_logs:/app/logs \ ghcr.io/redbase-app/redb-identity-web:latest ``` `your-backend` is the backend's public Issuer: the BFF calls it from the container and sends the browser to it, so the name must resolve in both places and match the backend's `Issuer`, and the container must trust its certificate. For a local check against a backend on the same Docker host with the bundled self-signed certificate, set the backend's Issuer to `https://host.docker.internal:5002` (a name the certificate covers), run the BFF with `--add-host host.docker.internal:host-gateway` and `-e Identity__AcceptAnyBackchannelCert=true`; that flag is for development only. The `web` image runs as the non-root user `app` (uid 1654): a host directory mounted on `/app/keys` or `/app/logs` instead of a named volume must be writable by that uid. The `backend`, `managed` and `full` images run as root, like the Tsak images they are built on. ### Standalone archive (no Docker) ```bash tar -xzf redb-identity--linux-x64.tar.gz && cd redb-identity--linux-x64 ./scripts/start-full.sh # worker(9090+5002) + dashboard(8085) + BFF(8087) # or ./scripts/start-backend.sh # OIDC backend only ``` ### Update an existing backend (no redeploy) ```bash # from redb-identity-modules-.zip: cp *.tpkg context.json /modules/ # The Tsak Worker hot-reloads the modules. OIDC stays on 5002. ``` --- ## Configuration & secrets **No secret ships in any artifact.** Supply them at deploy time through the Tsak layered configuration; the env override form is `Tsak__Contexts____Override__…`. The annotated `context.sample.json` lists every setting. Minimum to boot a real backend: - **Issuer**: the public https URL, in both `identity.core` (`Identity:Issuer`) and `identity.http` (`IdentityTransport:Issuer`). - **Backchannel secret**: the **same** value on both sides so the BFF can talk to the backend: - backend: `Tsak__Contexts__identity.core__Override__Identity__SeedBackchannelClient__ClientSecret` - BFF: `Identity__BackchannelClient__ClientSecret` - **Tsak management API**: the images ship it without API keys. In `managed` and `full` it listens on 127.0.0.1 inside the container (`Tsak__Api__Host=127.0.0.1`), where the dashboard reaches it, and the dashboard needs its password (`Tsak__Web__AdminPassword`); the compose files set both. In `backend` it answers on 9090 to whoever reaches the port: publish it only to a trusted network, or turn on Tsak's API keys (`Tsak:Auth`). - **First administrator**: a fresh database has `admin` / `admin`. `Identity:SeedAdmin:Password` replaces it while it is still the default and never overwrites a changed password; on a database shared with the Tsak dashboard the account is the dashboard's too (README, "First administrator"). ### Postgres instead of SQLite The same image runs on Postgres through env overrides. `identity.core` and `identity.http` must share one redb store, because the DataProtection key ring lives in it, so set both contexts: ```yaml environment: Tsak__Contexts__identity.core__Override__Identity__RedbInstanceName: identity-pg Tsak__Contexts__identity.http__Override__RedbInstanceName: identity-pg Tsak__Contexts__identity.core__Override__Redb__identity-pg__ConnectionString: "Host=postgres;Port=5432;Username=identity;Password=***;Database=identity;Pooling=true" Tsak__Contexts__identity.http__Override__Redb__identity-pg__ConnectionString: "Host=postgres;Port=5432;Username=identity;Password=***;Database=identity;Pooling=true" ``` ### DataProtection key rings The Identity server keeps its key ring in the database. The Tsak worker and dashboard keep theirs in `/root/.aspnet/DataProtection-Keys`, hence the `dp_keys` volume for `managed` and `full`; the Identity Web BFF keeps its own on `/app/keys` (`web`) or `/app/web-keys` (`full`). Upgrading a 4.3 container that had no volume on `/root/.aspnet/DataProtection-Keys`: copy the ring out before removing the container, as described in [UPGRADING.md](UPGRADING.md#dataprotection-key-ring). Federation / LDAP / dynamic-registration / MFA-recovery secrets: see `context.sample.json`. --- ## Verify signatures All images and archives are cosign-signed; the public key `cosign.pub` is attached to every GitHub release: ```bash cosign verify --key cosign.pub ghcr.io/redbase-app/redb-identity-backend: cosign verify-blob --key cosign.pub \ --bundle redb-identity--linux-x64.tar.gz.bundle redb-identity--linux-x64.tar.gz ``` --- ## Build the modules yourself ```powershell pwsh scripts/pack-tpkg.ps1 -TsakModules /modules ``` builds every `.tpkg` and copies them into the given Worker `modules/` directory; take `context.sample.json` as the `context.json` next to them. Path: redb-identity/Directory.Build.props Snapshot: redb-identity, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/Directory.Build.props ---- net10.0;net11.0 enable true $(NoWarn);1591 enable 4.8.0 4.8.0 RedBase RedBase redb.Identity Transport-agnostic OAuth 2.1 / OpenID Connect server for the redb ecosystem, built on OpenIddict and redb.Route. Copyright (c) 2024-2026 RedBase https://redbase.app https://github.com/redbase-app/redb-identity git Apache-2.0 README.md redb;identity;oauth2;oidc;openid-connect;openiddict;scim;mfa;webauthn;dpop Path: redb-identity/Directory.Build.targets Snapshot: redb-identity, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/Directory.Build.targets ---- true <_RedbCentral>true <_RedbNetMajor>$([System.Version]::Parse('$(TargetFrameworkVersion.TrimStart(`v`))').Major) 3.1.12 4.18.1 10.0.15 11.0.0 $(RedbSecAspNetCoreVersion) 10.0.15 11.0.0 10.0.15 true $(WarningsAsErrors);NU1506 true all moderate $(WarningsAsErrors);NU1902;NU1903;NU1904 Path: redb-identity/Directory.Packages.props Snapshot: redb-identity, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/Directory.Packages.props ---- true Path: redb-identity/HTTPS.md Snapshot: redb-identity, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/HTTPS.md ---- # redb.Identity over HTTPS How the redb.Identity OpenID Provider (OP) serves its HTTP facade over **native TLS/HTTPS**, why you need it, how to configure it, and how to operate it day-to-day. > TL;DR — redb.Identity can terminate TLS **itself** (no reverse proxy required). Point > `IdentityTransport:Http:Ssl=true`, give it a PFX, and set the `Issuer` to the matching > `https://…` URL. Every facade endpoint then binds with TLS via Kestrel. --- ## 1. Why HTTPS is not optional for an OP An OpenID Provider is a security authority: it mints ID tokens, access tokens and sets session cookies. The OpenID Connect / OAuth 2.x specs and every conformance/certification profile treat plain HTTP as a hard error for anything but throwaway local development: - **OIDC Discovery / RFC 8414** — the `issuer` identifier and every advertised endpoint (`authorization_endpoint`, `token_endpoint`, `userinfo_endpoint`, `jwks_uri`, `registration_endpoint`, …) **must** use the `https` scheme. The OpenID conformance suite fails the *Config OP* profile outright on an http issuer (`"issuer is not a valid RFC 8414 issuer identifier URL"`, `"… must use the https scheme"`). - **Tokens & cookies** — bearer tokens and the session cookie must never travel in clear text. redb.Identity automatically sets the cookie `Secure` flag when the `Issuer` scheme is `https` (see `HttpFacadeRouteBuilder`, `_transportOptions.Issuer.Scheme == "https"`). - **PKCE / DPoP / PAR** protect against interception, but they assume the transport itself is confidential. Without TLS the whole chain is moot. So: **dev-only** may run http on `127.0.0.1`; **anything reachable by another machine — including the OpenID conformance suite — must be https.** --- ## 2. You do NOT need a reverse proxy The `redb.Route.Http` connector that powers the facade supports TLS natively through Kestrel: - URI scheme `https:` is a first-class component (`HttpsComponent`, registered alongside `HttpComponent`). - `HttpEndpointOptions` exposes `Ssl` (bool), `SslCertPath` (PFX path), `SslCertPassword`. - `SharedHttpServerManager` configures Kestrel to listen with the supplied certificate. redb.Identity wires this into the HTTP facade so a single config switch flips **all** endpoints on the public port from `http:` to `https:`. A TLS-terminating reverse proxy (nginx/Caddy) is still a perfectly valid deployment choice — but it is **optional**, not required. --- ## 3. Configuration All settings live under `IdentityTransport:Http` (context.json → identity.http context, or host appsettings / env overrides). The relevant fields: | Field | Meaning | |-------|---------| | `Ssl` | `true` → serve the facade over HTTPS. Default `false` (plain http, dev only). | | `SslCertPath` | Filesystem path to a **PFX (PKCS#12)** certificate. Required when `Ssl=true`. | | `SslCertPassword` | Password for the PFX (`null` if none). **Secret** — supply via env override in prod. | And the issuer (both contexts must agree with the scheme you actually serve): - `identity.core` → `Identity:Issuer` - `identity.http` → `IdentityTransport:Issuer` ### Example (context.json) ```jsonc // identity.core "Identity": { "Issuer": "https://id.example.com", // MUST be https when Ssl=true ... } // identity.http "IdentityTransport": { "Issuer": "https://id.example.com", // mirror of the above "Http": { "PublicPort": 5002, "Ssl": true, "SslCertPath": "C:/certs/id.example.com.pfx", "SslCertPassword": "…" // prod: leave out of the file, use an env override } } ``` ### Env-var override for the secret (recommended in production) ``` Tsak__Contexts__identity.http__Override__IdentityTransport__Http__SslCertPassword= ``` ### The Issuer MUST match the URL clients use The `issuer` string is emitted verbatim in discovery and as the `iss` claim of every token. It **must** be identical to the origin clients (and the conformance suite) use to reach the OP, including scheme and host. A mismatch (`iss` says one thing, the URL another) breaks RP validation and fails conformance. Bind host and issuer host are independent: the facade binds `0.0.0.0:{port}` (all interfaces) regardless; the issuer is a static advertised URL. --- ## 4. How it works internally (for maintainers) 1. `HttpFacadeRouteBuilder.Configure()` reads `IdentityTransport:Http:Ssl`. When true it computes, once: - `_scheme = "https"` - `_sslParams = "&ssl=true&sslCertPath=…&sslCertPassword=…"` (URL-encoded) 2. Every endpoint is registered as `From($"{_scheme}:{METHOD}:0.0.0.0:{port}{path}?inOut=true{_sslParams}…")`. Because **all** endpoints on a host:port must agree on TLS (`SharedHttpServerManager` throws *"already registered as HTTP/HTTPS"* on a mismatch), the scheme + ssl params are applied uniformly — never mix http and https endpoints on the same port. 3. `InitRoute` registers **both** the `http` and `https` route components (sharing one `SharedHttpServerManager`). If only `http` were registered you'd get *"No component registered for scheme 'https'"* at startup. 4. `Uri.EscapeDataString` escapes the cert path/password so Windows paths and special characters survive the URI query. --- ## 5. Certificates You need a **PFX** whose Subject Alternative Names (SAN) cover every host clients use to reach the issuer. ### Production Use a certificate from a real CA (Let's Encrypt, your corporate PKI, …) for your public issuer host, e.g. `id.example.com`. Export it to PFX and point `SslCertPath` at it. Rotate before expiry; the cert is re-read when the facade (re)starts / hot-reloads. ### Local development / conformance testing (self-signed) A self-signed cert is fine as long as the *client* trusts it. Generate one with OpenSSL (note the SANs — include every host you'll use): ```bash openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 825 -nodes \ -subj "/CN=redb-identity-dev" \ -addext "subjectAltName=DNS:host.docker.internal,DNS:localhost,IP:127.0.0.1" openssl pkcs12 -export -out redb-identity-dev.pfx -inkey key.pem -in cert.pem -passout pass:changeit ``` Because it is self-signed, any RP/tool that talks to the OP must trust it (add the cert to the OS or the tool's trust store). Browsers will warn until you trust it locally. --- ## 6. The OpenID conformance-suite case (why the odd host + self-signed) When validating against the official OpenID Foundation conformance suite (which runs in Docker): - The suite (Java, in a container) reaches the OP on the Windows host via `host.docker.internal:5002`, so the **issuer is set to `https://host.docker.internal:5002`** for the duration of that testing (plain non-Docker dev would use `https://127.0.0.1:5002` or `http://127.0.0.1:5002` with `Ssl=false`). - The suite is an RP and validates the OP's TLS cert. For a self-signed dev cert this means the suite's **Java truststore must contain the cert** — we build a truststore from the image's `cacerts` + `keytool -importcert …` and mount it into the suite container. - With that in place the *Config OP* profile goes from **8 failures (all "must use https")** to **0 failures** — the discovery document itself was already structurally conformant; TLS was the only gap. The full suite setup lives in `C:\Work\yaml\conformance\` (compose + certs + truststore). --- ## 7. Operating notes / "how to live with it" - **Switching http ⇄ https is a per-port, all-or-nothing change.** Flip `Ssl` and update the `Issuer` scheme together, then restart / hot-reload. A hot-reload tears down the old server on the port and binds a fresh one with the new scheme; if a switch ever fails to bind, restart the worker so the port is fully released first. - **Cookie `Secure` follows the issuer scheme automatically** — no separate flag. If you serve https but leave `Issuer` on http, cookies won't be `Secure` and browsers may reject them. - **Behind a load balancer / TLS-terminating proxy** you may instead keep the facade on http and let the proxy do TLS. In that case set `Ssl=false` but STILL set `Issuer` to the public `https://…` URL (what the world sees), and configure `ReverseProxies` (forwarded-header trust) so the OP honours `X-Forwarded-Proto`. Native TLS (this document) and proxy-TLS are the two supported topologies — pick one. - **Password hygiene** — never commit a real `SslCertPassword`. Use the L5 env-var override. The dev value in the repo (`changeit`) protects only a throwaway self-signed cert. - **Cert expiry** — self-signed dev certs above last 825 days; production certs rotate on the CA's schedule. Re-point `SslCertPath` (or replace the file) and restart to load a new cert. --- ## 8. Troubleshooting | Symptom | Cause / fix | |--------|-------------| | `No component registered for scheme 'https'` at startup | The `https` route component wasn't registered. `InitRoute` must add `HttpsComponent` alongside `HttpComponent`. | | `SslCertPath is required when Ssl=true` | `Ssl=true` but no `SslCertPath`. Provide the PFX path. | | `already registered as HTTP/HTTPS` on a port | Some endpoints on that port are http and others https. All endpoints on one host:port must share the same scheme. | | Suite / RP: `PKIX path building failed` / TLS handshake error | The client doesn't trust the OP's (self-signed) cert. Add it to the client's trust store (Java: `keytool -importcert` into `cacerts`; OS: install the cert). | | Conformance: `issuer is not a valid RFC 8414 identifier URL` / `must use the https scheme` | The OP is still on http, or `Issuer` isn't https. Set `Ssl=true` and both `Issuer`s to the https URL. | | `iss` mismatch at the RP | The `Issuer` value doesn't match the URL clients use (scheme/host). Make them identical. | | Port 5002 unreachable after flipping `Ssl` | The old server didn't release the port in time on hot-reload. Restart the worker. | Path: redb-identity/LICENSE Snapshot: redb-identity, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/LICENSE ---- Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may accept and charge a fee in exchange for, or offer support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright 2024-2026 RedBase Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Path: redb-identity/NOTICE Snapshot: redb-identity, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/NOTICE ---- redb — Entity Database for .NET Copyright 2024-2026 RedBase This product includes software developed by RedBase (https://redbase.app). Licensed under the Apache License, Version 2.0 (the "License"); you may not use the open-source components of this product except in compliance with the License. You may obtain a copy of the License in the LICENSE file in the root of this distribution or at: http://www.apache.org/licenses/LICENSE-2.0 ------------------------------------------------------------------------ Components and licenses ------------------------------------------------------------------------ * Open-source projects (Apache License 2.0): redb.Core, redb.Postgres, redb.MSSql, redb.Tsak.Core, redb.Tsak.Web, redb.Tsak.CLI, redb.Tsak.Worker, redb.Tsak.Client, redb.Tsak.Contracts, redb.Identity, redb.Route, redb.CLI, redb.PropsEditor, redb.Templates, redb.Examples, and other non-".Pro" projects. * Commercial / Pro projects (REDBASE Commercial License — see LICENSE-PRO.txt): redb.Core.Pro, redb.Postgres.Pro, redb.MSSql.Pro, redb.Tsak.Core.Pro, redb.Tsak.Web.Pro, redb.Licensing (the licensing library is distributed alongside Pro components). * Third-party components: see project files (.csproj) for transitive package references and their respective licenses. Path: redb-identity/OPENID_CERTIFICATION.md Snapshot: redb-identity, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/OPENID_CERTIFICATION.md ---- # redb.Identity — OpenID Connect Certification Readiness This document describes what redb.Identity implements toward [OpenID Certification](https://openid.net/certification/), what was changed to prepare for it, and the current state against the official OpenID Foundation conformance suite. > **Status — preparing for OpenID Certification.** In local runs of the official > OIDF conformance suite against a live server over native HTTPS (latest run > 2026-11-03, see §4): **Config OP — zero failures**, and **Basic OP — 35 modules, zero failures** > (29 PASSED, 3 REVIEW awaiting a screenshot, 1 WARNING that is a deliberate > extension, 2 SKIPPED optional features). Every defect the suite found is fixed; > §4.1 lists them, including the ones we had previously — and wrongly — written > off as harness limitations. > > **Both SKIPPED modules are `alg:none` (unsigned) request objects — skipped *because* the > server refuses to advertise the unsafe mode, which is the correct, secure answer, not a gap.** > See §4.3. `FAILED` is `0`. It is a **status / spec** document, not a marketing claim: it tracks our own local conformance runs and the protocol work that makes redb.Identity certifiable. > **We do not carry the OpenID Certified™ mark.** That is a trademark, granted by > the OpenID Foundation through a formal (and paid) submission. What is claimed > here is only what is true: the server is run against the official OIDF > conformance suite, and these are the results. --- ## 1. What redb.Identity is redb.Identity is an **OpenID Provider (OP)** built on: - **OpenIddict** for the OAuth 2.0 / OpenID Connect server pipeline (token issuance, JWT signing, discovery, the server event/handler model). - **redb.Route** as the transport and routing fabric — every OIDC endpoint (`/connect/authorize`, `/connect/token`, `/connect/userinfo`, …) is a redb.Route route in the `identity.http` context, forwarding to the `identity.core` context via in-process `direct-vm` for the OpenIddict work. - **redb** as the persistence layer for users, sessions, clients, consents, claims, and audit. It is deployed as **tpkg modules** hot-loaded into a Tsak Worker (`redb.Identity.Core.Module.tpkg` + `redb.Identity.Http.tpkg`). The identity store in the certification setup is **PostgreSQL** (`RedbInstanceName: "identity-pg"` in `context.json`); the Worker itself runs on SQLite. --- ## 2. Certification profiles targeted The OpenID Connect **Basic OP** and **Config OP** conformance profiles (the authorization-code flow with a confidential client) are the first targets. - **Config OP** — discovery-document / metadata correctness over HTTPS. - **Basic OP** — the full `response_type=code` authorization-code flow: login, consent, token issuance, userinfo, scopes, `prompt`, `max_age`, code reuse, refresh tokens, PKCE, request objects, and negative cases. --- ## 3. Protocol work done for certification Everything below is implemented in the OpenIddict server pipeline (`redb.Identity.Core`) or the HTTP facade (`redb.Identity.Http`) and is committed on `develop`. ### 3.1 Native HTTPS (no reverse proxy) The conformance suite requires the OP to be served over HTTPS with a valid issuer. redb.Identity serves TLS **natively** through the redb.Route.Http connector (Kestrel), configured entirely from `context.json` (`ssl=true`, `sslCertPath`, `sslCertPassword`) — no nginx/Envoy in front. Both `HttpComponent` (scheme `http`) and `HttpsComponent` (scheme `https`) are registered against one shared `SharedHttpServerManager`, so a single `host:port` is tracked once regardless of scheme. See **[HTTPS.md](HTTPS.md)** for the full design and operator setup. ### 3.2 Discovery metadata completeness `ApplyDiscoveryResponseHandler` advertises the metadata the Config/Basic OP profiles check, including: - `acr_values_supported` = `["1","2"]` - `claim_types_supported` = `["normal"]` - `token_endpoint_auth_methods_supported` = `[client_secret_basic, client_secret_post, private_key_jwt, none]` - `introspection_endpoint_auth_methods_supported` / `revocation_endpoint_auth_methods_supported` = `[basic, post, private_key_jwt]` (no `none`) `Cache-Control` on discovery and JWKS is left **cacheable by design**. ### 3.3 Error delivery hardened (open-redirect + correct channel) The authorization-endpoint error path (`RedbRouteOpenIddictServerHandler`, `ApplyAuthorizationResponseHandler`) validates the `redirect_uri` against the client via `IOpenIddictApplicationManager.FindByClientIdAsync` + `ValidateRedirectUriAsync` **before** redirecting any error back. An error is delivered to the `redirect_uri` only when that URI is registered for the client (RFC 6749 §4.1.2.1); otherwise it is surfaced directly. This closes an open-redirect vector and delivers `invalid_scope`/`invalid_request` on the correct channel. ### 3.4 Token endpoint error normalization At the token endpoint, `invalid_token` is normalized to `invalid_grant`, and status codes are mapped explicitly (`invalid_client` → 401, others → 400). This fixed the code-reuse case (a redeemed code now returns `400 invalid_grant`, not `401 invalid_token`). ### 3.5 Boolean claims per OIDC §5.1 `email_verified` and `phone_number_verified` are emitted as JSON **booleans** (`SetClaim(..., bool)`), not strings. `acr` is `"1"` / `"2"`. ### 3.6 Configurable PKCE (Basic vs OAuth 2.1) PKCE is now configurable (`RedbIdentityOptions.RequirePkce`, default `true`). When enabled, dynamic registration adds the per-client `ft:pkce` requirement and the server enforces S256. For the **Basic OP** profile (which exercises non-PKCE code flow) PKCE is turned off in the conformance `context.json`; the `oidcc-ensure-request-with-valid-pkce-succeeds` module still passes with PKCE supported. S256-only configuration is kept unconditional. ### 3.7 prompt=login / max_age re-authentication (§3.1.2.1) Both `prompt=login` and a stale `max_age` now **force the End-User back to `/login`** (not an error to the RP) and complete once they re-authenticate. The redirect loop is broken **without a bypass** by a DataProtection-signed re-auth marker cookie (`redb.identity.reauth`): - `SessionTicketService.ProtectReauth/UnprotectReauth` sign/verify the instant re-auth was forced (a distinct protector purpose, 10-minute max age — a client cannot forge an earlier timestamp). - On the way in, `SessionCookieProcessors.ReadSessionCookie` decodes the marker into a `reauth_stamp` header; on the way out `HandleReauthCookie` mints it when re-auth is forced and expires it **only on final success** (so a consent round-trip keeps it). - `HandleAuthorizationRequestHandler` runs the gate **before** the no-principal check, so a logged-out `prompt=login` needs only a single `/login`. Re-auth is satisfied once the **active session id differs** from the one the marker captured — a fresh `/login` always mints a new session. Keying on the session id (not the second-precision `auth_time`) is precise: it neither loops on a same-second re-login nor leaves a same-second window where an unchanged session could be mistaken for a re-authentication. Verified end-to-end over HTTPS: `authorize?prompt=login` → `/login` → re-login → `code`; and a same-second retry **without** re-login still routes to `/login` (no bypass). Commits `9736dad7`, ``. ### 3.8 Token endpoint no-store cache headers (RFC 6749 §5.1) The token endpoint (and PAR, introspection, revocation, device authorization) now send `Cache-Control: no-store` + `Pragma: no-cache`, wired via `AddNoStoreCacheHeaders` after JSON serialization on those routes only — discovery and JWKS stay cacheable. Commit `3583a19b`. --- ## 4. Current conformance state (local runs) Runs use the [official OpenID Foundation conformance suite](https://gitlab.com/openid/conformance-suite) locally (Docker, `https://localhost.emobix.co.uk:8443`) driven against the OP at `https://host.docker.internal:5002` over native HTTPS (see §5). The latest run is of 2026-11-03, with the suite's own scripted browser; the three modules that need a person at the browser were last run on 2026-07-13. - **Config OP** — **0 failures**, one WARNING. A newer suite check, `CheckForUnexpectedParametersInServerMetadata`, lists three discovery fields outside RFC 8414: `device_authorization_endpoint_auth_methods_supported`, `pushed_authorization_request_endpoint_auth_methods_supported` and `federation_providers` (our extension: the configured external identity providers). Unknown fields are allowed by RFC 8414 and the suite reports them as a warning. - **Basic OP** — **35 modules, 0 failures.** | Result | Modules | Notes | |--------|---------|-------| | PASSED | 29 | | | REVIEW | 3 | the suite requires a human-uploaded screenshot — pass-equivalent (run of 2026-07-13) | | WARNING | 1 | `oidcc-server` — two deliberate id_token claims (below) | | SKIPPED | 2 | **both** are `alg:none` (unsigned) request objects — skipped because we correctly refuse the unsafe mode; see §4.3 | | **FAILED** | **0** | | The three REVIEW modules (`prompt-login`, `max-age-1`, `ensure-registered-redirect-uri`) behave correctly end to end; the suite additionally wants a screenshot as certification evidence and therefore never auto-finishes them. A scripted browser cannot supply it, so their result is the one of the browser run of 2026-07-13. ### 4.1 What the suite actually found An earlier revision of this document attributed several non-passing modules to "automation-driver limits" and "suite configuration". **That was wrong, and it is worth saying so plainly**: when we stopped excusing them and dug in, most turned out to be **genuine OP defects**. All are now fixed. | What the suite flagged | What it really was | Fix | |------------------------|--------------------|-----| | `oidcc-scope-address/phone/all` — WARNING | **Not** "the client wasn't registered with those scopes." The `profile` claim set was **incomplete** — the suite diffs userinfo against the exact OIDC §5.1 list and warns per missing claim | Full §5.1 set emitted; `updated_at` as a JSON number, `*_verified` as JSON booleans | | `oidcc-server` — id_token claims | Scope-derived `profile`/`email`/`phone`/`address` claims were **embedded in the id_token**. In the code flow they belong in UserInfo (§5.4). An id_token is forwarded to third parties and logged as proof of sign-in — the user's phone number travelled far further than the RP intended. **A PII leak** | Scope-derived claims are now AccessToken-destination only: served from `/connect/userinfo`, absent from the id_token | | userinfo returning extra fields | UserInfo was copying claims through a *deny-list*, leaking token plumbing: OpenIddict's `oi_*` internals, `jti`/`exp`/`iat`/`at_hash`. Those describe the **token**, not the user (§5.3) | Explicit allow-list | | `oidcc-userinfo-post-body` | `/connect/userinfo` (POST) did not accept the access token in the form-encoded body (RFC 6750 §2.2) | Route now maps form to body | | `oidcc-claims-essential` — WARNING | The test requests `name` as an essential claim via the **`claims` parameter** (§5.5), which we had **not implemented at all** — and our own discovery said so: `claims_parameter_supported: false` | §5.5 implemented; discovery now says `true` | | `oidcc-ensure-post-request-succeeds` — INTERRUPTED (run of 2026-11-03) | An authorization request sent as **POST** to a user without a session lost its parameters on the way to the login page: the return address was rebuilt from the (empty) query string, so after login the OP answered "client_id is missing". The browser run of July passed only because a session already existed. OIDC Core §3.1.2.1 requires POST support | The login and consent redirects carry the form parameters of a POST request; module passes | | `oidcc-server-client-secret-post` — FAILED | **Suite config, not an OP defect** — and this one really was the harness. The test does `config.add("client", config.get("client_secret_post"))`, overwriting `client` with a key our plan didn't have, so it died *before* issuing a single request to the OP | Plan config gained a third client under the `client_secret_post` key. Module passes | Earlier passes also fixed: the error open-redirect (RFC 6749 §4.1.2.1), reused authorization code → `400 invalid_grant` (§5.2), `Cache-Control: no-store` on token/introspect/revoke (§5.1), and boolean `*_verified` claims (§5.1). ### 4.2 The one remaining WARNING is deliberate `oidcc-server` finishes WARNING on two non-requested id_token claims: ``` id_token contains non-requested claim 'oi_tkn_id' id_token contains non-requested claim 'redb:user_id' ``` These are **warnings, not failures**. OIDC Core does not forbid additional id_token claims; the suite warns because an extra claim *can* mean user data is leaking — and its own message concedes the alternative: *"…or that it implements an extension the conformance suite is not aware of."* That is our case. Neither claim is data about the user: - **`oi_tkn_id`** — the id of the token's entry in the store. It is what makes the id_token **revocable** and what drives back-channel logout. Dropping it means giving up id_token revocation: a real capability traded for a clean warning list. - **`redb:user_id`** — a namespaced private claim (RFC 7519 §4.3). The public `sub` is a GUID (stable across instances); the hot key in the relational `_users` table is a bigint. This lets a client decode the id_token and join the user to **its own** table without a round-trip back to us. And the part that makes this a judgement rather than a rationalisation: in the same pass we **deleted** a third such claim. OpenIddict was also stamping `oi_au_id` — its internal link to the authorization entry — into the id_token. That one means nothing to a client and there was no defending it (`StripInternalClaimsFromIdentityToken`; kept on the access_token, where introspection needs it). We kept the two we can answer for and cut the one we could not. ### 4.3 The two SKIPPED modules are a security choice, not a gap Both skipped modules test the **unsigned** (`alg:none`) request object: - `oidcc-unsigned-request-object-supported-correctly-or-rejected-as-unsupported` - `oidcc-ensure-request-object-with-redirect-uri` Read the suite's own words on them: each is *"skipped if the server discovery document does not indicate support for unsigned request objects — i.e. if `alg:none`"*, i.e. if `request_object_signing_alg_values_supported` does not contain `none`. Ours does not: ```json "request_parameter_supported": true, "request_uri_parameter_supported": true, "request_object_signing_alg_values_supported": ["RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512"] ``` An `alg:none` request object is a JWT **with no signature** — it throws away the exact integrity guarantee that JWT-Secured Authorization Requests (RFC 9101) exist to provide, and lets the authorization parameters be tampered with in transit. We refuse it on purpose: - **FAPI 2.0 forbids `alg:none`** for request objects and mandates asymmetric signing; - accepting it would open a request-parameter-tampering hole. So the suite sees "this server supports request objects, but only **signed** ones" and correctly marks the two `alg:none` tests **not applicable**. `SKIPPED` here means *"the server declined to advertise an unsafe mode"* — it is the secure answer, and Basic OP treats it as such (`FAILED = 0`). **What actually changed since the earlier run.** Before we implemented RFC 9101, the server advertised no request-object support at all, and `ensure-request-object-with-redirect-uri` ran down a screenshot (REVIEW) path. Now that the server genuinely processes **signed** request objects (both `request` and `request_uri`) and honestly advertises exactly that, the suite moves the `alg:none` variants to SKIPPED. The count went 1→2 SKIPPED and 4→3 REVIEW; the real gain is that signed request objects now work end-to-end rather than being attested by a screenshot. Turning either skip into a pass would require advertising and accepting `alg:none` — a deliberate security regression we will not make. > For readers scanning the badge: **two skips, zero failures.** Both skips are the > server refusing an unsigned-JWT mode that the OAuth security profiles (FAPI 2.0) > tell it to refuse. That is the correct outcome, not a missing feature. --- ## 5. How to run the conformance suite locally 1. Bring up the OP over HTTPS (native TLS; see [HTTPS.md](HTTPS.md)) with the conformance `context.json` (issuer `https://host.docker.internal:5002`, `RequirePkce=false` for Basic OP). 2. Bring up the OIDF suite with `host.docker.internal:host-gateway` and the self-signed cert trusted in the suite's Java truststore. 3. Register a confidential static client (`client_secret_basic`, `authorization_code`+`refresh_token`, all scopes incl. `offline_access`, `address`, `phone`) plus a second client for `oidcc-refresh-token`, and point the plan config at them. 4. Create the `oidcc-basic-certification-test-plan` and drive each module. The harness is the [official OpenID Foundation conformance suite](https://gitlab.com/openid/conformance-suite); the steps above reproduce our local runs against it. --- ## 6. Commit trail | Commit | Scope | |--------|-------| | `e776cd62` | Native HTTPS, discovery metadata, error-delivery hardening, token error normalization, boolean claims, configurable PKCE | | `9736dad7` | `prompt=login` / `max_age` re-authentication (signed re-auth marker) | | `3583a19b` | Token endpoint `Cache-Control: no-store` / `Pragma: no-cache` (RFC 6749 §5.1) | Path: redb-identity/README.md Snapshot: redb-identity, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/README.md ---- # redb.Identity > **A transport-agnostic OAuth 2.1 / OpenID Connect server for the redb ecosystem.** > Built on [OpenIddict](https://documentation.openiddict.com/) and [redb.Route](https://github.com/redbase-app/redb-route). Every endpoint is a `direct-vm://` route — call it over HTTP, gRPC, WS-Trust (SOAP), or **straight from another in-process module with zero network overhead**. Ships as `.tpkg` packages for [redb.Tsak](https://github.com/redbase-app/redb-tsak). REDB-backed, cluster-ready, standards-compliant. Documentation and articles: [![License: Apache 2.0](https://img.shields.io/badge/license-Apache_2.0-blue)](https://github.com/redbase-app/redb-identity/blob/main/LICENSE) [![Website](https://img.shields.io/badge/docs-redbase.app-orange)](https://redbase.app) [![.NET](https://img.shields.io/badge/.NET-10%20%7C%2011-purple)](https://dotnet.microsoft.com) [![Providers](https://img.shields.io/badge/storage-PostgreSQL%20%7C%20MSSQL%20%7C%20SQLite-336791)](#provider-matrix-zero-code-changes-between-rows) [![NuGet: redb.Identity.Core](https://img.shields.io/nuget/v/redb.Identity.Core?label=nuget%3A%20Core&color=004880)](https://www.nuget.org/packages/redb.Identity.Core) [![NuGet: redb.Identity.Http](https://img.shields.io/nuget/v/redb.Identity.Http?label=nuget%3A%20Http&color=004880)](https://www.nuget.org/packages/redb.Identity.Http) [![NuGet: redb.Identity.Client](https://img.shields.io/nuget/v/redb.Identity.Client?label=nuget%3A%20Client&color=004880)](https://www.nuget.org/packages/redb.Identity.Client) [![OIDC](https://img.shields.io/badge/OpenID_Connect-Core_1.0-1F4E79)](#openid-connect) [![OAuth](https://img.shields.io/badge/OAuth-2.1_%2B_RFC_6749-4A148C)](#oauth-2x-core) [![DPoP](https://img.shields.io/badge/DPoP-RFC_9449-1565C0)](#oauth-2x-core) [![PAR](https://img.shields.io/badge/PAR-RFC_9126-1565C0)](#oauth-2x-core) [![JAR](https://img.shields.io/badge/JAR-RFC_9101-1565C0)](#oauth-2x-core) [![DCR](https://img.shields.io/badge/DCR-RFC_7591%2F7592-1565C0)](#oauth-2x-core) [![SCIM](https://img.shields.io/badge/SCIM-2.0_(RFC_7643%2F7644)-2E7D32)](#scim-20-rfc-7643--7644) [![FIDO2](https://img.shields.io/badge/FIDO2-WebAuthn_L2-006064)](#mfa) [![Engine](https://img.shields.io/badge/engine-OpenIddict-512BD4)](#) [![Runtime](https://img.shields.io/badge/runtime-redb.Route-FF6F00)](#) --- ## Contents - [TL;DR](#tldr) · [Install](#install) · [Quick start](#quick-start) · [What's new in 4.4](#whats-new-in-44) - [Why redb.Identity exists](#why-redbidentity-exists) · [In-process direct-vm calls](#the-killer-feature-in-process-direct-vm-calls) · [Architecture](#architecture) · [Project structure](#project-structure) - [Endpoint catalogue](#endpoint-catalogue) · [Standards compliance](#standards-compliance) · [Storage model](#storage-model--built-on-the-redb-object-engine) - [Cluster-readiness](#cluster-readiness) · [Observability](#observability) · [Security highlights](#security-highlights) · [Audit event catalogue](#audit-event-catalogue) - [Runnable demos](#runnable-demos-demos) · [Typed SDK](#typed-sdk-iidentityclient) · [Reference BFF](#reference-bff--admin-ui-redbidentityweb) · [Testing](#testing) · [Roadmap](#roadmap-excerpt) Further documents: [DEPLOYMENT.md](DEPLOYMENT.md) (images, archives, ports, secrets), [HTTPS.md](HTTPS.md) (TLS), [UPGRADING.md](UPGRADING.md) (what to change per version), [CHANGELOG.md](CHANGELOG.md), [OPENID_CERTIFICATION.md](OPENID_CERTIFICATION.md), [SECURITY.md](SECURITY.md), [CONTRIBUTING.md](CONTRIBUTING.md). --- ## TL;DR | If you want… | redb.Identity gives you… | |---|---| | A full OIDC / OAuth 2.1 server without ASP.NET coupling | A `direct-vm://`-only core: `token`, `authorize`, `userinfo`, `introspect`, `revoke`, `jwks`, `.well-known/openid-configuration`, PAR, JAR (signed request objects), Device Code, Dynamic Registration. | | To call Identity from another in-process module **with no HTTP** | `To("direct-vm://identity-token")` from your own `RouteBuilder`. Zero serialization, zero loopback, zero TLS handshake, same exchange. | | HTTP / gRPC / WS-Trust endpoints | Drop in the matching facade `.tpkg` (`redb.Identity.Http`, `.Grpc`, `.Soap`). Each facade is a thin transport bridge — no business logic. Message-bus facades are planned, see the [Roadmap](#roadmap-excerpt). | | A drop-in user / group / scope / client / consent / audit / session store | Built-in storage via [redb.Core](https://github.com/redbase-app/redb) typed `*Props` objects. Code-first schemes, no migrations. | | Multi-instance / cluster deployment | DataProtection key-ring + signing keys shared through redb object store. Cleanup timers run leader-only via `.Cluster(true)`. | | Modern MFA | TOTP (RFC 6238) + SMS/Email OTP + WebAuthn (FIDO2) + Recovery codes. E-mail codes go out through the SMTP channel (`Smtp.Enabled`) or the host's own e-mail channel; SMS OTP needs a delivery channel registered by the host, and none ships. | | Self-service for end users | `/me/profile`, `/me/sessions`, `/me/mfa`, `/me/webauthn`, `/me/consents`, `/me/federated`. | | Federation | OIDC / GitHub external providers, stored as redb props objects, admin CRUD. | | Backchannel logout that works across replicas | RFC 8417-style revoked-SID list (`/revoked-sids/add` + `/since`) + push-and-poll fallback. | | SCIM 2.0 provisioning | Users + Groups + Bulk endpoints (RFC 7644). | | RFC compliance | OIDC Core, OAuth 2.1, RFC 7662 (Introspection), RFC 7591/7592 (DCR), RFC 8628 (Device Code), RFC 9126 (PAR), **RFC 9101 (JAR — JWT-Secured Authorization Request, opt-in)**, RFC 9068 (JWT access-token profile — `at+jwt`, full claim set, `aud` issued and verified), RFC 8707 (Resource Indicators), RFC 8693 (Token Exchange, opt-in), RFC 9449 (DPoP), RFC 8417 / OIDC Backchannel Logout. | | Conformance you can check | Exercised against the **official OpenID Foundation conformance suite** (Config OP, Basic OP). Unsigned `alg:none` request objects are refused, as FAPI 2.0 requires. Per-module results: [OPENID_CERTIFICATION.md](OPENID_CERTIFICATION.md). | ## Install ### NuGet packages Add the pieces you need; the storage provider is chosen by the host: ```pwsh # Core OIDC / OAuth 2.1 engine (OpenIddict on redb.Route) + a storage provider dotnet add package redb.Identity.Core dotnet add package redb.Postgres.Pro # or redb.MSSql.Pro / redb.SQLite.Pro # HTTP facade (OIDC + management + SCIM endpoints) dotnet add package redb.Identity.Http # Typed client SDK (IIdentityClient) — for BFFs / services calling Identity dotnet add package redb.Identity.Client ``` | Package | Purpose | |---|---| | [`redb.Identity.Core`](https://www.nuget.org/packages/redb.Identity.Core) | OAuth 2.1 / OIDC engine — OpenIddict pipeline, redb stores, MFA, WebAuthn, federation, signing keys | | [`redb.Identity.Http`](https://www.nuget.org/packages/redb.Identity.Http) | HTTP / HTTPS facade — discovery, token, authorize, userinfo, introspect, JWKS, PAR, DCR, SCIM, `/me`, management | | [`redb.Identity.Grpc`](https://www.nuget.org/packages/redb.Identity.Grpc) | gRPC facade — service-to-service surface (token, introspect, revoke, userinfo, discovery, JWKS) + the management services; `.proto` contracts ship in `redb.Identity.Contracts` under `Protos/` | | [`redb.Identity.Soap`](https://www.nuget.org/packages/redb.Identity.Soap) | WS-Trust facade — `Issue`, `Validate`, `Cancel`, `Renew` over SOAP on the same core routes; WSDL published on GET; TLS required, and its absence is a refusal to start | | [`redb.Identity.Management`](https://www.nuget.org/packages/redb.Identity.Management) | Transport-neutral management + self-service controllers — thin adapters over `direct-vm://identity-manage-*`, shared by every facade | | [`redb.Identity.Contracts`](https://www.nuget.org/packages/redb.Identity.Contracts) | Wire DTOs + route-name constants (shared by Core, Http, Client) | | [`redb.Identity.Client`](https://www.nuget.org/packages/redb.Identity.Client) | Typed HTTP SDK (`IIdentityClient`) + backchannel OIDC client | | [`redb.Identity.DataProtection`](https://www.nuget.org/packages/redb.Identity.DataProtection) | redb-backed ASP.NET Core DataProtection key-ring | | [`redb.Identity.Core.Module`](https://www.nuget.org/packages/redb.Identity.Core.Module) | redb.Tsak `.tpkg` host glue (only when hosting inside a Tsak worker) | | [`redb.Identity.Ldap`](https://www.nuget.org/packages/redb.Identity.Ldap) | LDAP / Active Directory federation provider | | [`redb.Identity.Resource.Dpop`](https://www.nuget.org/packages/redb.Identity.Resource.Dpop) | Resource-server DPoP (RFC 9449) validator for downstream APIs | > The reference BFF + Blazor admin UI (`redb.Identity.Web`) is not a NuGet package: it ships as source in this > repository and as the `redb-identity-web` image. ### Docker images and archives Four images on `ghcr.io/redbase-app`, all signed with cosign: | Image | Contents | |---|---| | `redb-identity-backend` | Tsak Worker + Identity modules (OIDC only) | | `redb-identity-managed` | + Tsak dashboard | | `redb-identity-full` | + Identity Web BFF (login, consent, admin UI) | | `redb-identity-web` | Identity Web BFF only | Each GitHub release also carries a standalone archive per runtime (no Docker) and a modules archive (the `.tpkg` packages + `context.json`) for an existing Tsak worker. Ports, volumes, secrets and signature checks: [DEPLOYMENT.md](DEPLOYMENT.md). ### Upgrading [UPGRADING.md](UPGRADING.md) lists what to check and change for each version; [CHANGELOG.md](CHANGELOG.md) has the full list of changes. --- ## Quick start ### Run the image ```bash docker run -d --name identity -p 5002:5002 -v identity_data:/app/data ghcr.io/redbase-app/redb-identity-backend:latest curl -k https://localhost:5002/.well-known/openid-configuration ``` The image runs on SQLite with a bundled self-signed certificate for `localhost`, so call it with `curl -k`. For a real deployment replace the certificate, set the public issuer and pick the store as described in [DEPLOYMENT.md](DEPLOYMENT.md) and [HTTPS.md](HTTPS.md). ### Host the modules in your own Tsak worker Take the `.tpkg` packages and `context.json` from the modules archive of a release, or build them from source: ```pwsh pwsh scripts/pack-tpkg.ps1 -TsakModules /modules ``` | Package | Tsak context | Contains | |---|---|---| | `redb.Identity.Contracts.tpkg` | `identity.contracts` | The shared DTO assembly every Identity module resolves against | | `redb.Identity.Core.Module.tpkg` | `identity.core` | OIDC engine, redb stores, MFA, federation, signing keys | | `redb.Identity.Http.tpkg` | `identity.http` | HTTP facade: protocol endpoints, management API, SCIM, `/me` | | `redb.Identity.Grpc.tpkg` | `identity.grpc` | gRPC facade (optional) | | `redb.Identity.Soap.tpkg` | `identity.soap` | WS-Trust facade (optional) | The worker loads every package it finds in `modules/` together with `context.json`. ### Host Identity in your own process Without a Tsak worker, reference `redb.Identity.Core.Module`, the facades you serve (for example `redb.Identity.Http`) and one redb provider package; everything else comes with them. For SQLite take `redb.SQLite.Pro`: it runs in C# alone. `redb.SQLite` (Free) needs the native extension its package ships for linux-x64, linux-arm64 and win-x64, so it runs only on those. For PostgreSQL take `redb.Postgres` or `redb.Postgres.Pro`. Then start Identity with one call: ```csharp var services = new ServiceCollection(); services.AddLogging(b => b.AddConsole()); services.AddSingleton(configuration); services.AddRedbPro(o => o.UseSqlite("Data Source=identity.db")); // or AddRedb(o => o.UsePostgres(cs)) services.AddRedbIdentityHost(); // HTTP server manager and direct-vm registry await using var provider = services.BuildServiceProvider(); await using var identity = await RedbIdentityHost.StartAsync(provider, configuration, redb.Identity.Http.InitRoute.main); ``` `configuration` holds the same two sections a worker hands the modules: ```json { "Identity": { "Issuer": "https://id.example.com/", "UsePropsSigningKeyStore": true }, "IdentityTransport": { "Http": { "PublicPort": 5002 } } } ``` `StartAsync` checks the host and the configuration first and fails, naming the missing registration or key, when logging or `AddRedbIdentityHost()` is absent, `Identity:Issuer` is missing or not an absolute URI, no key source is set (`Identity:UsePropsSigningKeyStore` keeps the keys in redb; `Identity:AllowEphemeralKeys` is for development, the keys die with the process) or a facade is given without `IdentityTransport`. Then it runs the core module and the facades in the order given, starts them (schema and seed data on the first start, then the ports open) and fails if a route did not start. It returns the running host; disposing it stops the routes, lets running requests finish, closes the ports and disposes Identity's services. Options registered in your own container (`AddRedbIdentityServer`) are not read and are refused at start: settings come from the sections only. A service that calls the management API needs a client of its own. `Identity:SeedBackchannelClient` creates one at start (`Enabled`, `ClientId`, `ClientSecret`, `Scopes`, for example `identity:manage`); it takes a token with the `client_credentials` grant at `/connect/token`. A management call without a token is answered `401`. ### Configure Settings come from the Tsak layered configuration, one bucket per context. The images and archives ship an annotated `context.json`; the minimum is the issuer, which both the engine and the HTTP facade need: ```jsonc { "Contexts": { "identity.core": { "Identity": { "Issuer": "https://identity.example.com", "Features": { "EnableScim": true, "EnableDeviceCodeFlow": true, "EnablePushedAuthorization": true } } }, "identity.http": { "IdentityTransport": { "Issuer": "https://identity.example.com", "Http": { "PublicPort": 5002 } } } } } ``` Both HTTP listeners bind to `IdentityTransport:Http:Host` (default `0.0.0.0`, every interface); `127.0.0.1` keeps them on the loopback for a host behind a local reverse proxy. The gRPC and SOAP facades take `Host` the same way. Secrets go to environment variables, never to `context.json`: ``` Tsak__Contexts__identity.core__Override__Identity__RecoveryCodePepper=... Tsak__Contexts__identity.core__Override__Identity__FederationProviders__0__ClientSecret=... Tsak__Contexts__identity.core__Override__Identity__Ldap__Providers__0__BindPassword=... ``` ### Rotating the recovery-code pepper `Identity:RecoveryCodePepper` is mixed into the hashes of the MFA recovery codes and of the password-reset, e-mail-verification and change-e-mail links. A new value alone would void every unused recovery code and every open link, so the old value stays listed in `Identity:RecoveryCodePreviousPeppers` for verification: 1. Generate a new value: 32 random bytes, base64 (`openssl rand -base64 32`). 2. On every node at once, set `RecoveryCodePepper` to the new value and add the old one to `RecoveryCodePreviousPeppers` (`Tsak__Contexts__identity.core__Override__Identity__RecoveryCodePreviousPeppers__0=...`), then restart. A node that runs without the old value refuses what was issued under it. 3. Everything new is hashed with the new value. While previous values are listed, the leader logs once after start and then daily, per previous pepper id, how many users still hold recovery codes hashed with it (ids and counts only). 4. Remove an old value, again on every node at once, when its count is 0 and the longest link lifetime has passed since the rotation (24 hours with the default e-mail-verification TTL). Recovery codes do not expire: users who still hold old codes keep them working only while the old value is listed, and lose them when it goes; they can regenerate their codes before that. Several rotations stack: the list holds every value that is still needed. Keep it short: while previous values are listed, a recovery-code attempt against a set without a pepper id (issued before 4.8.0) costs one PBKDF2 per code for the current pepper and one more for each listed value, so remove a value as soon as its count reaches 0. ### First administrator A fresh database has the user `admin` with the password `admin`. Set `Identity:SeedAdmin:Password` before the first start (or `Identity:SeedAdmin:Enabled=false`): Identity applies it while the stored password is empty or still `admin`, and never overwrites a password that was changed. While the configured password is the default, the server logs a warning at every start. When Identity runs in a Tsak worker that shares its database with the Tsak dashboard in cluster mode, the dashboard creates this administrator first, from `Tsak:Web:AdminLogin` and `Tsak:Web:AdminPassword` (admin/admin by default), and both sign in with the same account. Change its password in the Tsak dashboard or in the Identity UI; `Identity:SeedAdmin:Password` replaces it only while it is still admin/admin. For an unattended setup there is a one-time endpoint that creates an administrator, the `identity-admins` group and the Web console client. It is off by default; enable it with `Identity:Bootstrap:Enabled=true` and a secret of at least 32 characters in `Identity:Bootstrap:Secret`: ```bash curl -k -X POST https://localhost:5002/internal/bootstrap-admin \ -H "Content-Type: application/json" -H "X-Bootstrap-Secret: $BOOTSTRAP_SECRET" \ -d '{ "email": "admin@example.com", "password": "..." }' # A second call returns 410 Gone. ``` --- ## What's new in 4.4 Each item links to the migration steps in [UPGRADING.md](UPGRADING.md). - **OpenIddict 7**, with the Microsoft.Extensions and ASP.NET Core 10 packages on every target framework. Sessions and refresh tokens issued by earlier versions stay valid. [OpenIddict 7](UPGRADING.md#openiddict-7) - **`resource` (RFC 8707) is validated** on authorize, PAR and token exchange against the scopes' `Resources`. [resource parameter](UPGRADING.md#resource-parameter) - **JWT client assertions follow rfc7523bis**: `typ` header `client-authentication+jwt` and the issuer as `aud`. [Client assertions](UPGRADING.md#client-assertions-private_key_jwt-client_secret_jwt) - **Token exchange (RFC 8693)** runs on OpenIddict's built-in grant and checks the calling client and the user. - **DPoP-bound tokens at third-party resource servers** need OpenIddict's proof-of-possession check switched off for `cnf.jkt`. [DPoP](UPGRADING.md#dpop-bound-access-tokens-at-third-party-resource-servers) - **The DataProtection key ring lives in redb**; the first start imports the old file ring once. [DataProtection key ring](UPGRADING.md#dataprotection-key-ring) - **Images**: `redb-identity-web` runs as a non-root user and keeps its key ring and log on volumes; the `managed` and `full` compose stacks keep the Tsak key rings on a volume. See [DEPLOYMENT.md](DEPLOYMENT.md). --- ## Why redb.Identity exists Most .NET Identity products force one of three uncomfortable choices: 1. **ASP.NET-bound stacks** (Duende IdentityServer, ASP.NET Identity Core) — every endpoint is an HTTP middleware. Want to call `token` from a Worker Service or a message bus consumer? You have to spin up an HTTP listener and loopback. Want to test the issuance pipeline in isolation? You need `WebApplicationFactory`. 2. **Heavy IAM platforms** (Keycloak, Auth0, Okta) — full-featured, but standalone services with their own runtime, their own admin UI, their own database, their own configuration model, and their own deployment story. Multi-tenant, but not embeddable. 3. **Roll your own** — and re-implement OAuth Code+PKCE, refresh-token rotation, consent storage, session revocation, MFA replay protection, JWKS rotation, key-ring sharing across replicas, RFC 8417 backchannel logout — for the third time this decade. redb.Identity is the missing fourth option: **the IS engine is just a set of `direct-vm://` routes**. The transport is your choice — and "no transport, just call it from the next module over" is a first-class deployment mode. You get the standards conformance and the storage model of a full IS server, but you wire it into your topology the same way you wire any other redb.Route pipeline. | | ASP.NET-bound IS (Duende, OpenIddict samples) | redb.Identity | Standalone IAM (Keycloak / Auth0) | |---|---|---|---| | Call `token` from another in-process module | Loopback HTTP | **`To("direct-vm://identity-token")`** — same exchange, zero copy | Network hop | | Add a new transport (gRPC, MQ, SignalR) | Rewrite endpoints as gRPC services / consumers | Add a facade `.tpkg`, point it at `direct-vm://` | Vendor adapter (if it exists) | | Replace HTTP with gRPC entirely | Major refactor | **Drop the HTTP facade. Keep Core.** | Not possible | | Storage | Custom EF Core schema + migrations | redb `RedbObject` — code-first, no migrations | Vendor schema, vendor migrations | | Multi-replica key sharing | DIY DataProtection persistence + JWKS rotation | Built-in: redb-backed key-ring + signing key store | Built-in (vendor-specific) | | Embeddable in a Tsak worker | No | **Yes — as one or two `.tpkg` packages** | No | | License | Mixed (Duende: commercial) | Apache 2.0 | Mixed | --- ## The killer feature: in-process direct-vm calls Every public endpoint in Identity is registered on a `direct-vm://identity-*` route. `direct-vm` is redb.Route's in-process, cross-`RouteContext`, **zero-copy synchronous** transport. Three consequences fall out for free: ### 1. Other Tsak modules in the same worker call Identity with no network at all ```csharp // Inside another .tpkg module loaded into the same Tsak worker public class CheckoutRoutes : RouteBuilder { private IProducerTemplate _identity = null!; // request-reply into Identity, in-process protected override void Configure() { _identity = new ProducerTemplate(Context!); _identity.Start(); From("rabbitmq:checkout.orders") // Need a service-account access token to call a downstream API? // Just hit Identity's token endpoint right here — same process, no socket. .Process(async (e, ct) => { var token = await _identity.RequestBody( IdentityEndpoints.Token, // "direct-vm://identity-token" new { grant_type = "client_credentials", client_id = "checkout-svc", /* ... */ }); e.In.SetHeader("Authorization", $"Bearer {token!.AccessToken}"); }) .To("http://pricing-api/quote"); } } ``` No HTTP listener. No TLS handshake. No JSON over the loopback. The exchange flows straight from your route into the Identity processor and back, in the same thread, with the same `IExchange` instance. Total cost: a method call plus the existing OpenIddict pipeline work. #### Calling the management routes from your module The management routes (`IdentityEndpoints.ManageUsers`, `ManageGroups`, `ManageApps` and the other `identity-manage-*` routes, MFA, SCIM) never trust the transport: `direct-vm` is shared by every module in the worker, so an exchange that reaches them without a management context is refused with `403 not_authorized`. Your module establishes that context the way the HTTP and gRPC facades do, in four steps on the same exchange: 1. **A token of your own client.** Create a confidential client for the module (console or management API) with the `client_credentials` grant and only the granular scopes it needs, for example `identity:users:read`. Take a token from `IdentityEndpoints.Token` and reuse it until it expires. 2. **Authentication.** Put the token in `Authorization: Bearer` and send the exchange through `IdentityEndpoints.AuthManagement`. It validates the token and leaves the management context (`identity:management-scopes`, `identity:management-subject`) on the exchange, or stops it with `401`. 3. **Authorization.** Set `identity:authz-resource` to the resource the HTTP API names (`/api/v1/identity/users`, `/api/v1/identity/groups`, ...) and `identity:authz-action` to `read` or `write`, and send the exchange through `IdentityEndpoints.AuthzCheck`. It checks the token's scopes against the same table the facades use, or stops the exchange with `403 insufficient_scope`. Skipping this step lets any token with a management scope reach every operation. 4. **The operation.** Set the `operation` header and the request body (the DTOs of `redb.Identity.Contracts`) and send the exchange to the management route. ```csharp From("direct:orders-find-user") .Process(async (e, ct) => { e.In.Headers["Authorization"] = $"Bearer {await _serviceToken.GetAsync(ct)}"; // step 1, cached }) .To(IdentityEndpoints.AuthManagement) // step 2 .Process((e, _) => { e.Properties["identity:authz-resource"] = "/api/v1/identity/users"; e.Properties["identity:authz-action"] = "read"; return Task.CompletedTask; }) .To(IdentityEndpoints.AuthzCheck) // step 3 .Process((e, _) => { e.In.Headers["operation"] = "read"; e.In.Body = new Dictionary { ["id"] = e.In.GetHeader("userId") }; return Task.CompletedTask; }) .To(IdentityEndpoints.ManageUsers); // step 4 ``` A refusal at step 2 or 3 stops the exchange, so the route does not reach the management route. Use the module's own client, not the Web console's `identity-backchannel` service account: that one shares its secret with the console and holds `identity:manage`, the whole management surface. ### 2. Facades are pure transport adapters — pick the ones you need ```csharp // HTTP facade — included From(Http.From("0.0.0.0:5000")) .RedbController(); // POST /connect/token // ↓ The controller's only job is: // exchange.To(IdentityEndpoints.Token) // direct-vm://identity-token // gRPC facade — shipped. One method address is one route, so each operation // gets its own route id, policies, metrics and lifecycle. From(GrpcDsl.Listen("0.0.0.0:5001").Method("/identity.v1.Identity/Token")) .RouteId("grpc-identity-token") .Process(GrpcIdentityProcessors.MapRequest(TokenRequest.Parser)) .Enrich(IdentityEndpoints.Token, GrpcIdentityProcessors.AdoptCoreAnswer) .Process(GrpcIdentityProcessors.MapErrorToGrpcStatus) .Process(GrpcIdentityProcessors.MapResponse("extra")); // WS-Trust facade — shipped. One address for all four operations, because that is // WS-Trust's own shape: the WS-Addressing Action names the operation, not the URL. From(SoapDsl.Listen("/sts").Host("0.0.0.0").Port(5021).Ssl()) .RouteId("soap-identity-sts") .Process(SoapIdentityProcessors.MapRequest) // RST → core parameters .Enrich(e => e.Properties["identity:wstrust-endpoint"] as string, SoapIdentityProcessors.AdoptCoreAnswer) .Process(SoapIdentityProcessors.MapResponse); // → RSTR, or a soap:Fault // RabbitMQ RPC facade (planned) From("rabbitmq:identity.rpc.token") .InOut() .To(IdentityEndpoints.Token); ``` Adding a new transport never touches Core. **There is no business logic in the facades to break.** Removing a transport is `rm facade.tpkg`. ### 3. Standards-bound flows that need a browser still get one — only those The only OAuth interaction that fundamentally requires a browser is the **authorization-code redirect** (and its sibling, the device-code verification URL). Every other endpoint — `token`, `refresh_token`, `introspect`, `revoke`, `userinfo`, `device_code` request, management API, MFA verify, SCIM — is transport-neutral: it works over gRPC or a direct call today, and a message-bus facade (planned, see the [Roadmap](#roadmap-excerpt)) would need no change in Core. | Flow / endpoint | Needs HTTP + browser | Works on any transport | |---|---|---| | `client_credentials` (M2M) | — | yes | | `authorization_code` — redirect to `/authorize` | yes | — | | `authorization_code` — `code → token` exchange | — | yes | | `refresh_token`, `revoke`, `introspect`, `userinfo` | — | yes | | `device_code` — initial request | — | yes | | `device_code` — user verification URL | yes | — | | Management API, SCIM 2.0, audit query | — | yes | --- ## Architecture ### Engine and facade contexts, hosted in one Tsak worker The gRPC and WS-Trust facades (`identity.grpc`, `identity.soap`) sit next to `identity.http` the same way; the `identity.contracts` carrier holds the shared DTO assembly. ``` ┌───────────────────────────────────────────────────────────────────────────────┐ │ Tsak worker │ │ │ │ ┌─────────────────────────────────────────────────────────────────────────┐ │ │ │ RouteContext "identity.core" ← redb.Identity.Core.Module.tpkg │ │ │ │ ────────────────────────────────────────────────────────────────────── │ │ │ │ • IdentityCoreRouteBuilder — ~50 direct-vm:// routes │ │ │ │ • OpenIddict server pipeline (token, authorize, userinfo, ...) │ │ │ │ • redb stores: Users, Apps, Scopes, Tokens, Sessions, Audit, ... │ │ │ │ • DataProtection key-ring in redb (RedbXmlRepository) │ │ │ │ • Signing keys (PropsSigningKeyStore — RSA 2048, encrypted) │ │ │ │ • MFA: TOTP / SMS-Email OTP / WebAuthn / Recovery codes │ │ │ │ • Cleanup timers (.Cluster(true) → leader-only in a cluster): │ │ │ │ identity-token-cleanup / -session-cleanup │ │ │ │ identity-mfa-otp-cleanup / -revoked-sids-cleanup │ │ │ │ identity-mfa-webauthn-challenge-cleanup │ │ │ │ • XML key-ring refresh (NOT cluster-gated — every replica refreshes) │ │ │ └─────────────────────────────────────────────────────────────────────────┘ │ │ ▲ │ │ direct-vm:// (synchronous, in-process, cross-context) │ │ │ │ │ ┌─────────────────────────────────────────────────────────────────────────┐ │ │ │ RouteContext "identity.http" ← redb.Identity.Http.tpkg │ │ │ │ ────────────────────────────────────────────────────────────────────── │ │ │ │ • Kestrel listener → redb.Route.Http → RedbController dispatcher │ │ │ │ • Controllers: ApplicationsController, UsersController, MfaController, │ │ │ │ SessionsController, RevokedSidsController, ScimUsers, │ │ │ │ MeProfileController, MePasswordController, ... │ │ │ │ • OIDC paths: /connect/token, /authorize, /userinfo, /introspect, ... │ │ │ │ • Management API: /api/v1/identity/* (identity:manage scope) │ │ │ │ • Self-service: /me/* (identity:account scope) │ │ │ │ • SCIM 2.0: /scim/v2/Users, /Groups, /Bulk │ │ │ │ • Cross-context brokers: CORS check, post-logout validate, MFA state │ │ │ └─────────────────────────────────────────────────────────────────────────┘ │ │ │ │ ┌─────────────────────────────────────────────────────────────────────────┐ │ │ │ Other Tsak modules (your code) │ │ │ │ ────────────────────────────────────────────────────────────────────── │ │ │ │ • Call IdentityEndpoints.Token / .Userinfo / .ManageUsers / ... │ │ │ │ via direct-vm:// directly — no HTTP needed │ │ │ └─────────────────────────────────────────────────────────────────────────┘ │ └───────────────────────────────────────────────────────────────────────────────┘ │ ▼ ┌────────────────────────────────────┐ │ redb store (Postgres / MSSQL / SQLite)│ │ - Users, Groups, Apps │ │ - Tokens, Authorizations │ │ - Sessions, MFA, Federation │ │ - DataProtection keys, JWKS │ │ - Audit trail │ │ - Idempotency cache │ └───────────────────────────────┘ ``` ### Project-reference isolation ``` redb.Identity.Http ─project-ref→ redb.Identity.Contracts allowed redb.Identity.Http ─project-ref→ redb.Identity.DataProtection allowed redb.Identity.Http ─project-ref→ redb.Identity.Core FORBIDDEN ``` The HTTP facade compiles **without seeing a single type from Identity.Core**. It only sees: - Wire DTOs and endpoint constants (`redb.Identity.Contracts`) - The shared XML key repository (`redb.Identity.DataProtection`) - A few SPI interfaces (`IMfaStateInspector`, `IRegisteredClientOriginRegistry`, `IIdentityClient`) This is what makes the `.tpkg` story honest: the two packages are independently buildable, independently versionable, and Core's internal types never leak across the ABI boundary. CI fails the build if a `using redb.Identity.Core;` shows up anywhere under `redb.Identity.Http/`. ### Anatomy of a token request — three transports, one pipeline ``` ┌────────────────────────────────────────────────────────────────────────────┐ │ Caller │ ├────────────────────────────────────────────────────────────────────────────┤ │ Browser: POST /connect/token (form-encoded) │ │ In-proc: exchange.To("direct-vm://identity-token") │ │ gRPC: client.Token(request) — same direct-vm under the hood │ └────────────────────────────────────────────────────────────────────────────┘ │ ▼ ┌────────────────────────────────────────────────────────────────────────────┐ │ Transport facade (only for non-direct-vm callers) │ │ HTTP: HeaderBridge → CorsCheck → AuthScope → To("direct-vm://identity…") │ └────────────────────────────────────────────────────────────────────────────┘ │ ▼ ┌────────────────────────────────────────────────────────────────────────────┐ │ IdentityCoreRouteBuilder.tokenRoute (RouteId: identity-token) │ │ │ │ WithRedbTx(...) ← atomic write boundary │ │ .Process(trustedProxy) ← sanitize X-Forwarded-For │ │ .Process(perIpThrottle) ← per-IP rate limit (optional) │ │ .OnException ← RFC 6749 error mapping │ │ .Throttle(clientId, ...) ← per-client token bucket │ │ .Traced("identity.token-request") │ │ .Metered(..., │ │ new TokenEndpointProcessor(handler, timeProvider)) │ │ ↑ │ │ OpenIddict server pipeline │ │ ↑ │ │ redb stores (RedbTokenStore, RedbApplicationStore, ...) │ │ .EndTraced() │ │ .WireTap("direct-vm://identity-events") ← audit + outbox (targets) │ └────────────────────────────────────────────────────────────────────────────┘ │ ▼ { access_token, refresh_token, expires_in, ... } ``` The same `TokenEndpointProcessor` runs whether the call came in over HTTP, gRPC, or a direct-vm call from the next module. **One pipeline, one set of tests, one audit trail.** --- ## Project structure ``` redb.Identity/ ├── src/ │ ├── redb.Identity.Core/ OAuth 2.1 / OIDC engine — OpenIddict + processors │ │ + redb stores + MFA + WebAuthn + federation │ │ + DataProtection + signing-key store │ │ (~50 direct-vm:// route registrations) │ ├── redb.Identity.Core.Module/ Thin Tsak entry point (InitRoute.main), │ │ lifecycle listeners, child SP build │ ├── redb.Identity.Contracts/ Wire DTOs (System.Text.Json only), │ │ endpoint URIs, route IDs, feature flags │ ├── redb.Identity.Management/ Transport-neutral management + self-service │ │ controllers over direct-vm://identity-manage-*, │ │ shared by the Http and Grpc facades │ ├── redb.Identity.Http/ HTTP facade — Kestrel + RedbControllers, │ │ project-ref-isolated from Core │ ├── redb.Identity.Grpc/ gRPC facade — the service-to-service subset │ │ (token, introspect, revoke, userinfo, │ │ discovery, jwks) over the same direct-vm │ │ routes; contract in Contracts/Protos │ ├── redb.Identity.Soap/ WS-Trust facade — Issue / Validate / Cancel / │ │ Renew over SOAP on the same core routes │ ├── redb.Identity.DataProtection/ RedbXmlRepository — ASP.NET DP keys in redb │ ├── redb.Identity.Resource.Dpop/ RFC 9449 DPoP resource-server validation │ ├── redb.Identity.Ldap/ LDAP external provider + sync (optional) │ ├── redb.Identity.Client/ Typed C# SDK — IIdentityClient, partial classes │ │ per area (Users, Apps, MFA, SCIM, Audit, …) │ └── redb.Identity.Web/ Reference BFF + Blazor admin UI │ (only refs Contracts + Client — HARDLINE) ├── tests/ Same suite on PostgreSQL · MSSQL · SQLite │ ├── redb.Identity.Tests/ Unit + integration (multi-provider harness) │ ├── redb.Identity.Client.Tests/ SDK transport contract tests │ └── redb.Identity.Web.Tests/ BFF smoke acceptance ├── demos/ Live-server RFC-conformance probes + run_all.ps1 ├── scripts/ │ └── pack-tpkg.ps1 Build + pack the .tpkg modules into a Tsak worker's modules/ ├── context.sample.json Annotated configuration for every Identity context ├── README.md This file ├── DEPLOYMENT.md, HTTPS.md Images, archives, ports, secrets; TLS ├── UPGRADING.md, CHANGELOG.md Migration steps per version; changes ├── Directory.Build.props └── Directory.Packages.props Central package versions (projects name no version) ``` --- ## Endpoint catalogue Every protocol endpoint (`/connect/*`) is *also* registered on `direct-vm://identity-*` for zero-network in-process calls — see [IdentityEndpoints.cs](src/redb.Identity.Contracts/Routes/IdentityEndpoints.cs). ### OAuth 2.1 / OIDC protocol surface (`/connect/*`, `/.well-known/*`) Wired in [HttpFacadeRouteBuilder.cs](src/redb.Identity.Http/HttpFacadeRouteBuilder.cs). | Path | Method | Auth | Purpose | |---|---|---|---| | `/connect/token` | POST | client authentication; grants `authorization_code` / `client_credentials` / `password` / `refresh_token` / `device_code` / token exchange (opt-in) | OAuth 2.1 token endpoint | | `/connect/authorize` | GET, POST | session cookie | Authorization endpoint (browser redirect); validates `resource` (RFC 8707) | | `/connect/par` | POST | `client_credentials` | Pushed Authorization Request (RFC 9126); validates `resource` | | `/connect/userinfo` | GET, POST | Bearer | OpenID Connect userinfo | | `/connect/introspect` | POST | `client_credentials` | RFC 7662 token introspection | | `/connect/revocation` | POST | `client_credentials` | RFC 7009 token revocation | | `/connect/logout` | GET, POST | session cookie (optional) | OIDC RP-Initiated Logout | | `/connect/register` | POST | Bearer (optional) | RFC 7591 Dynamic Client Registration | | `/connect/register/{client_id}` | GET, PUT, DELETE | Bearer | RFC 7592 DCR Management | | `/connect/deviceauthorization` | POST | `client_credentials` | RFC 8628 Device Authorization | | `/connect/device/verify` | POST | anonymous | RFC 8628 §3.3 end-user verification | | `/.well-known/openid-configuration` | GET | anonymous | OIDC Discovery 1.0 | | `/.well-known/oauth-authorization-server` | GET | anonymous | RFC 8414 metadata | | `/.well-known/jwks` | GET | anonymous | JSON Web Key Set | ### Admin REST (`/api/v1/identity/*`) — requires Bearer + `identity:manage` scope | Path | Method | Purpose | Source | |---|---|---|---| | `/applications` (+ `/{id}/rotate-secret`) | GET/POST/PUT/DELETE | OAuth client CRUD + secret rotation | [ApplicationsController.cs](src/redb.Identity.Management/Controllers/ApplicationsController.cs) | | `/users` (+ `/search`, `/{id}/change-password`) | GET/POST/PUT/DELETE | User management | [UsersController.cs](src/redb.Identity.Management/Controllers/UsersController.cs) | | `/groups` (+ `/{id}/children`, `/members`, `/move`) | GET/POST/PUT/DELETE | Hierarchical groups & membership | [GroupsController.cs](src/redb.Identity.Management/Controllers/GroupsController.cs) | | `/scopes` | GET/POST/PUT/DELETE | OAuth scope catalogue | [ScopesController.cs](src/redb.Identity.Management/Controllers/ScopesController.cs) | | `/claim-mappers` | GET/POST/PUT/DELETE | Declarative claim mapping rules | [ClaimMappersController.cs](src/redb.Identity.Management/Controllers/ClaimMappersController.cs) | | `/claim-scopes` (+ `/assignments`) | GET/POST/PUT/DELETE | Reusable Client Scope bundles + per-app assignment | [ClaimScopesController.cs](src/redb.Identity.Management/Controllers/ClaimScopesController.cs) | | `/audit` | GET | Audit log query | [AuditController.cs](src/redb.Identity.Management/Controllers/AuditController.cs) | | `/tokens` | GET/POST/DELETE | Token lifecycle management; the type filter accepts the short and the URI form (`refresh_token`, `urn:ietf:params:oauth:token-type:refresh_token`) | [TokensController.cs](src/redb.Identity.Management/Controllers/TokensController.cs) | | `/consents` | GET/DELETE | User-consent admin | [ConsentsController.cs](src/redb.Identity.Management/Controllers/ConsentsController.cs) | | `/sessions` | GET/POST/DELETE | Admin session control | [SessionsController.cs](src/redb.Identity.Management/Controllers/SessionsController.cs) | | `/mfa` | GET/POST/DELETE | Admin MFA lifecycle | [MfaController.cs](src/redb.Identity.Management/Controllers/MfaController.cs) | | `/federation-providers` | GET/POST/PUT/DELETE | External IdP CRUD (redb-stored) | [FederationProvidersController.cs](src/redb.Identity.Management/Controllers/FederationProvidersController.cs) | | `/revoked-sids` | GET/POST | Backchannel revoked-SIDs delta feed | [RevokedSidsController.cs](src/redb.Identity.Management/Controllers/RevokedSidsController.cs) | ### Self-service (`/me/*`) — requires Bearer + `identity:account` scope `RequireSelfOrAdminProcessor` guards every `/me/*` route: a token with `identity:account` can never mutate another user's data. | Path | Method | Purpose | Source | |---|---|---|---| | `/me` | GET, PUT | Profile read/update | [MeController.cs](src/redb.Identity.Management/Controllers/MeController.cs) | | `/me/password` | PUT | Self-service password change | [MePasswordController.cs](src/redb.Identity.Management/Controllers/MePasswordController.cs) | | `/me/sessions` | GET, DELETE | List/revoke own sessions (SSO) | [MeSessionsController.cs](src/redb.Identity.Management/Controllers/MeSessionsController.cs) | | `/me/mfa` | GET/POST/DELETE | Self-service MFA enroll/disable | [MeMfaController.cs](src/redb.Identity.Management/Controllers/MeMfaController.cs) | | `/me/webauthn` | GET/POST/PATCH/DELETE | WebAuthn credentials (FIDO2) | [MeWebAuthnController.cs](src/redb.Identity.Management/Controllers/MeWebAuthnController.cs) | | `/me/consents` | GET, DELETE | Consent dashboard | [MeConsentsController.cs](src/redb.Identity.Management/Controllers/MeConsentsController.cs) | | `/me/federated-identities` | GET/POST/DELETE | Link/unlink external IdP accounts | [MeFederatedIdentitiesController.cs](src/redb.Identity.Management/Controllers/MeFederatedIdentitiesController.cs) | ### gRPC (`identity.v1.Identity`) A second transport over the same `direct-vm://identity-*` routes, for services rather than browsers. Contract: [identity.v1.proto](src/redb.Identity.Contracts/Protos/identity.v1.proto); usage: [redb.Identity.Grpc/README.md](src/redb.Identity.Grpc/README.md). | Method | Auth | Purpose | |---|---|---| | `/identity.v1.Identity/Token` | client credentials, fields or `authorization: Basic` | RFC 6749 §3.2 | | `/identity.v1.Identity/Introspect` | client credentials | RFC 7662 | | `/identity.v1.Identity/Revoke` | client credentials | RFC 7009 | | `/identity.v1.Identity/UserInfo` | `authorization: Bearer` | OIDC Core §5.3 | | `/identity.v1.Identity/Discovery`, `/Jwks` | anonymous | documents, passed through verbatim | | `/redb.route.grpc.RedbService/Process` | as above | envelope fallback: JSON body + `operation` metadata | | `/grpc.health.v1.Health/Check` | anonymous | k8s / Consul / Envoy probe | Browser flows (`authorize`, login, consent, MFA pages, device verification) and DPoP stay on HTTP by construction: the former need a browser, redirects and a cookie session; RFC 9449 binds a DPoP proof to an HTTP method and URL. Management operations are not on this transport yet. ### SCIM 2.0 (`/scim/v2/*`) | Path | Method | Auth | Purpose | |---|---|---|---| | `/Users` | GET/POST/PUT/PATCH/DELETE | Bearer + `scim` scope | RFC 7644 §3.2–3.5 | | `/Groups` | GET/POST/PUT/PATCH/DELETE | Bearer + `scim` scope | RFC 7644 §3.2–3.5 | | `/Bulk` | POST | Bearer + `scim` scope | RFC 7644 §3.7 | | `/ServiceProviderConfig`, `/ResourceTypes`, `/Schemas` | GET | anonymous | RFC 7643 §5 discovery | ### BFF / convenience (`redb.Identity.Web`) | Path | Method | Purpose | |---|---|---| | `/api/auth/login` | POST | Form-based browser login over BFF | | `/api/auth/logout` | POST | BFF logout | | `/account/login` | GET | Back-compat redirect to `/login` | | `/health` | GET | BFF liveness probe | --- ## Standards compliance RFC compliance is verified by integration tests (`tests/redb.Identity.Tests/`) — every spec below is wired in code, not aspirational. Section references and §-citations live next to the matching assertions. **42 RFCs are cited by number in `src/`, 46 counting `tests/`**; the tables below are exhaustive. ### OAuth 2.x core | RFC | Spec | Coverage | |---|---|---| | **6749** | OAuth 2.0 Authorization Framework | Authorization Code, Client Credentials, Refresh Token, Resource Owner Password Credentials (§4.3, opt-in). RFC 6749 §5.2 error mapping (`invalid_request`/`invalid_grant`/`unsupported_grant_type` → correct HTTP status), §10.5 single-use authorization code (atomic consume), §10.12-style one-time `jti` enforcement. | | **6750** | Bearer Token Usage | `Authorization: Bearer …`. Query-parameter transport (§2.3) explicitly rejected by management API. | | **7009** | Token Revocation | Always 200 (§2.1), idempotent re-revocation, refresh-token rotation. | | **7591** | Dynamic Client Registration | `POST /connect/register`, optional initial access token (§1.2). | | **7592** | DCR Management Protocol | `GET/PUT/DELETE /connect/register/{client_id}` with `registration_access_token`. | | **7521 / 7523** | Assertion Framework + JWT Bearer client authentication | `private_key_jwt` — DCR accepts `token_endpoint_auth_method=private_key_jwt` with inline `jwks` or a `jwks_uri` (see "Client keys at `jwks_uri`" below); `/connect/token` + `/connect/introspect` authenticate via an RS256-signed client assertion (RFC 7521 §4.2 / RFC 7523 §2.2); advertised in discovery `token_endpoint_auth_methods_supported`. Assertions follow draft-ietf-oauth-rfc7523bis: `typ` header `client-authentication+jwt` and the issuer as `aud`, for every endpoint ([UPGRADING.md](UPGRADING.md#client-assertions-private_key_jwt-client_secret_jwt)). Tampered signature → 401 `invalid_client`. Pinned by `demo_private_key_jwt`. | | **7636** | PKCE | `S256` mandated; `plain` rejected per OAuth 2.1 / RFC 7636 §4.2. | | **7662** | Token Introspection | Answers only a client the token concerns: one in its `aud` or the client it was issued to; any other caller gets `active: false` (§2.2). A resource server is put into the audience through the `Resources` of the scopes its callers request. | | **8252** | OAuth 2.0 for Native Apps (BCP 212) | Private-use URI scheme redirect (§7.1); loopback IP redirect (§7.3) on `127.0.0.1` / `[::1]` with any port (`AllowLoopbackRedirectPortWildcard`, on by default); `application_type=native` and `token_endpoint_auth_method=none` accepted by DCR (`Register_NativeApp_SetsApplicationType`). | | **8414** | Authorization Server Metadata | `/.well-known/oauth-authorization-server` (separate from OIDC Discovery, for non-OIDC clients) — verified by `DiscoveryD1ConformanceTests`. | | **8628** | Device Authorization Grant | `/connect/deviceauthorization`, `/connect/device/verify`, configurable `expires_in` / `interval` (§3.2). | | **8693** | Token Exchange (opt-in) | `grant_type=urn:ietf:params:oauth:grant-type:token-exchange` on OpenIddict's built-in grant, switched on by `EnableTokenExchange`; delegation + impersonation. Subject and actor tokens are access tokens; a token bound to a presenter can be exchanged only by that client, and a token of a disabled or deleted user is refused with `invalid_grant`. | | **8707** | Resource Indicators | `resource` on `/connect/authorize`, `/connect/par` and token exchange: an absolute URI listed in a scope's `Resources`, with the client's `rsrc:` permission, otherwise `invalid_target` ([UPGRADING.md](UPGRADING.md#resource-parameter)). The access-token `aud` is composed from the same model (see RFC 9068). | | **9068** | JWT Profile for OAuth 2.0 Access Tokens | `typ: at+jwt` header (OpenIddict's default for access tokens; id_tokens stay `JWT`, internal tokens carry private `oi_*+jwt` types, so token-type confusion is structurally impossible). Required claims `iss`/`exp`/`aud`/`sub`/`client_id`/`iat`/`jti` plus `auth_time`/`acr`/`amr`, `scope`, and `roles`/`groups` under the §2.2.3 SCIM names. `aud` (§2.2/§3) is composed by `AttachAccessTokenResources`: Resources of the granted scopes ∪ the application's `AccessTokenAudiences`, the OP's own audience for `identity:*` scopes, `{issuer}/resources` (or `DefaultAccessTokenAudience`) as the default resource indicator, plus the requesting `client_id` (so the issuing client may introspect its own token — OpenIddict admits only audience members to introspection). The local validation stack behind the management API verifies `aud` (§4) — a token minted for another API is refused with 401. Pinned by `FullStackAccessTokenAudienceTests`. Note: with the default access-token encryption on, external resource servers see a JWE — set `DisableAccessTokenEncryption` for third-party RFC 9068 validation. | | **9101** | JAR — JWT-Secured Authorization Request | `/connect/authorize` accepts a signed `request` object, resolves the client's keys, verifies the signature and takes the parameters from inside the JWT with §6.1 precedence (inner values win; outer values not repeated inside are dropped). `ValidateRequestObjectHandler` **replaces** OpenIddict's built-in `ValidateRequestParameter` / `ValidateRequestUriParameter`, which reject both unconditionally. Opt-in via `Features.EnableJar` (default `false` → `request_not_supported`, byte-identical to releases before the flag existed); `request_uri` fetching is a second switch (`Jar.EnableRequestUri`) behind `OutboundUrlGuard`, and an address is fetched only when it equals one of the client's registered `request_uris` (exact match, fragment included; `Jar.RequireRequestUriRegistration`, default `true`, published as `require_request_uri_registration`), while PAR-issued `urn:ietf:params:oauth:request_uri:` values stay with OpenIddict. Unsigned `alg:none` objects are refused with the flag on or off. Discovery advertises `request_parameter_supported` / `request_uri_parameter_supported` / `request_object_signing_alg_values_supported` only while the flag is on — the server never announces a mode it will not serve. Signing-algorithm mismatch against the client's registered hint is `LogOnly` or `Enforce`. Pinned by `ValidateRequestObjectHandlerTests`. | | **9126** | Pushed Authorization Requests (PAR) | `POST /connect/par`, configurable `Require PAR`, `request_uri` lifetime (§2.2). | | **9449** | DPoP — Demonstrating Proof-of-Possession | Issuance binding (`cnf.jkt`) + `DPoP-Nonce` (§8) with HMAC-signed stateless nonces + resource-server validator (`redb.Identity.Resource.Dpop`). Per-`jkt` replay store (`DpopConsumedJtiProps`). A resource server of your own that validates these tokens with OpenIddict.Validation 7 must skip its proof-of-possession check for `cnf.jkt` and verify the DPoP proof itself ([UPGRADING.md](UPGRADING.md#dpop-bound-access-tokens-at-third-party-resource-servers)). | **Client keys at `jwks_uri`.** A client publishes its public keys either inline (`jwks`) or at an address (`jwks_uri`), never both; dynamic registration accepts either for every auth method, and an inline set, when stored, is the only source. Keys at `jwks_uri` verify the client's `private_key_jwt` assertions at the token and introspection endpoints and its JAR request objects. The set is fetched through `OutboundUrlGuard` before every fetch and cached for `Identity:ClientKeys:CacheLifetime` (12 hours by default). At most one fetch per address starts per `Identity:ClientKeys:MinimumRefreshInterval` (5 minutes by default), whether the cache expired, an assertion named an unknown `kid` (a client rotated its keys) or the last fetch failed; concurrent requests share it, and it ends after `ClientKeys:FetchTimeout`. Redirects are not followed. A failed fetch, or a set without usable signing keys, keeps the last good set; with none, the client is refused with `invalid_client`. At most `ClientKeys:MaxCachedKeySets` addresses (256 by default) are cached at once; expired entries go first, then the least recently used. ### OpenID Connect | Spec | Coverage | |---|---| | **OIDC Core 1.0** | Authorization Code + PKCE, ID Token (RS256), Userinfo, claim mappers, `prompt=login\|consent\|none`, `max_age`, `acr_values`. | | **OIDC Discovery 1.0** | `/.well-known/openid-configuration` — verified by `DiscoveryD1ConformanceTests` against §3 + RFC 8414 §2. | | **OIDC RP-Initiated Logout 1.0** | `/connect/logout` with `post_logout_redirect_uri` allow-list. | | **OIDC Backchannel Logout 1.0 / RFC 8417** | SET event sink (`BackchannelLogoutEndpoint`), push to RPs **plus** pull-based revoked-SID list (`/revoked-sids/add` + `/revoked-sids/since?cursor=`) for multi-replica RPs — survives lost RP nodes and partitions. The push goes only to an address the outbound URL guard accepts (`https`, public), checked at registration and before every POST; `Identity:BackchannelLogout:RequireHttps` and `:AllowPrivateNetworkTargets` relax it for RPs on an internal network. | | **OIDC Form Post Response Mode** | `response_mode=form_post`. | ### OpenID conformance — tested against the official OIDF suite redb.Identity is exercised against the **official OpenID Foundation conformance suite** — the same suite the OIDF uses to certify providers — over native HTTPS, with the Config OP and Basic OP plans. Running that suite (most .NET OAuth stacks never do) surfaced — and fixed — the exact RFC-precision points hand-rolled servers trip on: errors delivered via the *registered* `redirect_uri` only (RFC 6749 §4.1.2.1), `400 invalid_grant` on code reuse (§5.2), `Cache-Control: no-store` on token responses (§5.1), boolean `email_verified` (OIDC §5.1), session-id-keyed `prompt=login` / `max_age` re-authentication (§3.1.2.1), and id_token hygiene. Per-module breakdown: **[`OPENID_CERTIFICATION.md`](OPENID_CERTIFICATION.md)**. ### JOSE / JWT cryptography | RFC | Spec | Coverage | |---|---|---| | **7515** | JSON Web Signature | RS256 / ES256 issuance + validation. | | **7517** | JSON Web Key + JWKS | `/.well-known/jwks` — verified by `JwksHttpContractTests` (RFC 7517 §5 top-level `keys` array). | | **7518** | JSON Web Algorithms | Algorithm allow-list, asymmetric proofs only (matches RFC 9449 §4.2). | | **7519** | JSON Web Token | ID tokens, access tokens, DPoP proofs. | | **7638** | JWK Thumbprint | SHA-256 thumbprint, base64url-encoded — used as DPoP `jkt` per RFC 9449 §10 (`DpopProofValidator.ComputeJktAsync`, `DpopFullCycleTests`). | | **7800** | PoP Key Semantics for JWTs | `cnf` claim with `jkt` (DPoP proof-of-possession-bound access tokens — `AttachDpopConfirmationClaimHandler`). | | **8176** | Authentication Method Reference Values | `amr` claim values (`pwd`, `mfa`, `otp`, `face`, `fpt`, `hwk`, etc.) emitted by `IdentityPrincipalBuilder`, plus the standardised `mfa` marker per §2. | ### SCIM 2.0 (RFC 7643 / 7644) | Surface | Notes | |---|---| | `/scim/v2/Users` (CRUD + PATCH) | RFC 7644 §3 | | `/scim/v2/Groups` (CRUD + PATCH) | RFC 7644 §3 | | `/scim/v2/Bulk` | RFC 7644 §3.7, partial-success semantics | | `/scim/v2/ServiceProviderConfig`, `/Schemas`, `/ResourceTypes` | Unauthenticated per RFC 7643 §5 | | Attribute names | Verbatim per RFC 7643 §7 — `IdentityCodecProfilesTests` pins that no naming policy mangles them. | | Wire serialization | UTF-8 JSON per RFC 8259 §8.1; null attributes omitted per RFC 7644 §3.8. | ### MFA | RFC / Spec | Coverage | |---|---| | **4226** | HOTP — the basis for TOTP (20-byte HMAC-SHA1 key per §4). | | **6238** | TOTP — with atomic verification (`SELECT FOR UPDATE` + `FailedAttempts++`) and replay protection per §5.2 (a code from an already-accepted step is rejected even within skew). Pinned by `TotpReplayTests`. | | **WebAuthn Level 2 / FIDO2** | Registration + assertion (Fido2NetLib), consumed-challenge cleanup timer, per-credential admin. | | SMS / Email OTP, Recovery codes | One-shot, marked consumed in the same transaction as session creation. | ### Federation & directory | Spec | Coverage | |---|---| | **OIDC** external providers | Per-provider redb CRUD, `IdentityCookie` state binding. | | **GitHub OAuth** | First-class adapter on top of the federation provider. | | **LDAP** (binding) | Search + bind authentication. | | **RFC 4514** | LDAP DN string representation — CN extraction in `LdapGroupMapper`. | | **RFC 4515** | LDAP search filter escaping (`LdapExternalUserProviderTests`). | ### HTTP / transport hygiene | RFC | Coverage | |---|---| | **6265 / 6265bis** | `SameSite=Lax\|Strict\|None`; `__Host-` prefix only emitted when `Secure=true` per §4.1.3.2; empty-value cookie treated as delete directive per §5.2.2. Pinned by `CookieDefaultsTests` + `IdentityCookieFormatterTests`. | | **6585** | Additional HTTP Status Codes — `429 Too Many Requests` + `Retry-After` on rate-limited `/connect/token`, `/connect/par`, `/connect/register` (§4). Pinned by `demo_throttle_rfc6585`. | | **7230** | HTTP/1.1 Message Syntax — Bearer-header OWS tolerance (`ManagementBearerAuthProcessor`, `BearerParsingD6Tests`). | | **7231** | HTTP/1.1 Semantics — `Retry-After` delta-seconds format (§7.1.3) emitted by rate-limit responses (`RateLimitMetricsAndRetryAfterTests`). | | **7232** | HTTP Conditional Requests — `ETag` / `If-Match` → 412 on stale resource (SCIM, per RFC 7644 §3.14 + RFC 7232 §4.2 — `ScimEtagTests`). | | **7234** | HTTP Caching — `Cache-Control` on metadata endpoints (§5.2). | | **7235** | HTTP/1.1 Authentication — quoted-string escaping in `WWW-Authenticate` Bearer challenges (§2.1) on userinfo error responses. | | **7807 / 9457** | `application/problem+json` for HTTP error responses — surfaced by the SDK as `ApiException`. | | **8259** | UTF-8 JSON wire format — locked `JsonSerializerOptions` profiles in `Contracts`. | ### Cryptographic primitives & hardening (OWASP-aligned) | Primitive | Coverage | |---|---| | **Argon2id** | Password hashing — PHC string format with unpadded base64 per **RFC 7693 §3.5** (`Argon2idPasswordHasher`). | | **PBKDF2 / RFC 2898** | Secret derivation for MFA shared-secret encryption (`MfaService` via `Rfc2898DeriveBytes.Pbkdf2(SHA-256)`). | | Recovery codes | One-shot, pepper-encrypted, marked consumed in the same transaction as session creation. | | Brute-force defense | Per-IP rate limits, per-`(IP+user)` failure ceiling with security-channel logger. | | Trusted proxies | `X-Forwarded-For` sanitized BEFORE rate-limit / lockout sees it. | | **SSRF guard on outbound fetches** | `OutboundUrlGuard` refuses loopback, **RFC 1918** private ranges, link-local (including the `169.254.169.254` cloud metadata address) and **RFC 6598** CGNAT space. It gates every address a client can make the server contact: `jwks_uri` (`ClientKeyResolver`), JAR `request_uri` (`ValidateRequestObjectHandler`) and `backchannel_logout_uri` (`BackchannelLogoutDispatcher`). The connection itself goes only to an address the server's own lookup approved at connect time, and redirects are not followed. With an outbound proxy configured, the check by name before the request is the server's only check and the proxy's policy decides where the request ends. Private targets are reachable only by explicit opt-in (`ClientKeysOptions`), for single-network test hosts. Pinned by `OutboundUrlGuardTests`. | | Idempotency | Cache placed AFTER authorization — revoked tokens can't unlock cached responses. An answer that carries a one-time secret (a member marked `[OneTimeSecret]`) is recorded without its body; a repeat answers `{"replayed":true,"secretWithheld":true,...}`. Expired records are deleted by the timer route `identity-idempotency-cleanup` (`Identity:IdempotencyCleanupInterval`, hourly; `Identity:IdempotencyCleanupBatchSize`). | | Revoked access tokens | The management API, SCIM and the account endpoints check each access token against its stored entry, one read per request: a token revoked at `/connect/revocation`, or a token of a deleted client, is refused with `401` at once, not at its expiry. There is no setting for it. | | Self-vs-admin | `RequireSelfOrAdminProcessor` on every `/me/*` route. | | Constant-time comparisons | All secret comparisons. | | **Facade pages: framing, CSRF, consent binding** | Every response through the facade's serializer carries `X-Frame-Options: DENY`, `Content-Security-Policy: frame-ancestors 'none'`, `X-Content-Type-Options: nosniff`, `Referrer-Policy` — the same set the web console's `SecurityHeadersMiddleware` emits. Form POSTs (`/login`, `/consent`, `/mfa`, `/mfa/recovery`) refuse a foreign `Origin`/`Referer` with 403 before reading the body (`AntiForgeryProcessors`; origin-less callers — the console's BFF, demos, API clients — pass). The consent page renders only from a server-signed ticket (`/consent?ct=…`, minted by the authorize endpoint — app name and scopes never come from the URL, so a crafted link cannot dress an attacker's client in a familiar name), and the decision is bound to the session cookie: no session → 401, a ticket minted for another user → 403, the form carries no `user_id`. Pinned by `FullStackFacadeFormHardeningTests`. | ### Tally **42 RFCs cited by number in production code.** Reproduce with: ```sh grep -rhoE 'RFC[ -]?[0-9]{4}' --include=*.cs src | tr -d ' -' | sort -u ``` > 1918, 4226, 4514, 4515, 6238, 6265, 6598, 6749, 6750, 7009, 7230, 7234, 7235, 7515, 7517, 7519, 7521, 7523, 7591, 7592, 7636, 7638, 7643, 7644, 7662, 7693, 7800, 7807, 8176, 8252, 8259, 8414, 8417, 8628, 8693, 8705, 8707, 9068, 9101, 9126, 9449, 9457 **Four more are cited only from `tests/`** (46 across `src` + `tests`), because the RFC is what the assertion pins rather than something the production path names: > 5737 (TEST-NET-1 — unreachable-host LDAP resilience), 7231 (`Retry-After` delta-seconds format), 7232 (`ETag` / `If-Match` → 412 on SCIM), 7239 (`unknown` as a legal proxy identifier in `X-Forwarded-For` parsing). **Two are implemented without the number appearing as text**, so the `grep` above does not see them — the behaviour is real, the citation just lives elsewhere: - **RFC 2898** (PBKDF2) — used through the framework API, `Rfc2898DeriveBytes.Pbkdf2(SHA-256)` in `MfaService`, so the class name carries the number instead of a comment. - **RFC 6585** (`429 Too Many Requests`) — emitted by `RateLimitProcessor.EmitTooManyRequests` with a `Retry-After` header; the number is spelled out in the demo that pins it, `demo_throttle_rfc6585`. One entry in the list above is a **reference, not a feature**: RFC 8705 is named where Identity explains that OpenIddict's own proof-of-possession check knows only certificate-bound tokens (`x5t#S256`); mutual-TLS client authentication is not implemented, see *Not implemented yet* below. Additional standards referenced without an explicit RFC tag in the source: OIDC Core 1.0, OIDC Discovery 1.0, OIDC RP-Initiated Logout 1.0, OIDC Backchannel Logout 1.0, OIDC Form Post Response Mode, WebAuthn Level 2 / FIDO2, SCIM 2.0, OAuth 2.1 PKCE-required profile, RFC 7515 / 7518 / 7519 (transitively via OpenIddict / `Microsoft.IdentityModel.Tokens`). ### Not implemented yet None are blockers for the core IS profile; PRs welcome: - RFC 8705 — Mutual-TLS client authentication + certificate-bound access tokens - RFC 9207 — `iss` parameter in authorization response - RFC 9396 — RAR (Rich Authorization Requests) - RFC 9470 — Step-up Authentication Challenge - FAPI 2.0 profile, CIBA, OIDC Federation 1.0 --- ## Storage model — built on the REDB object engine > redb.Identity does not own a database schema. It is built on top of **[REDB](https://github.com/redbase-app/redb)** — the typed object / props storage engine that ships with this repo (`redb.Core`, `redb.Core.Pro`, `redb.Postgres`, `redb.Postgres.Pro`, `redb.MSSql`, `redb.MSSql.Pro`, `redb.SQLite`, `redb.SQLite.Pro`). This is the single biggest architectural difference vs every other .NET identity server. ### What this buys you over an EF-Core-on-tables identity server | Property | redb.Identity | Typical EF-Core identity server (IdentityServer/OpenIddict-EF/ASP.NET Identity) | |---|---|---| | **Storage engines** | Postgres, MSSQL **and** SQLite from one codebase — swap by changing the provider package the host loads | One provider per build; switching requires re-writing the EF model + migrations | | **Schema evolution** | No migrations. Add a property to a `*Props` class — the redb scheme picks it up at next `InitializeAsync` | Generate migration, review SQL, run `Update-Database`, hope rollback works | | **Custom claims / per-tenant extensions** | `Dictionary? CustomClaims` on `UserProps` — each key becomes a queryable, indexed props row | `jsonb`/`nvarchar(max)` blob; you write your own GIN / computed-column indexes | | **Multi-provider federation links** | `Dictionary` on User — native props rows, hot reverse-lookup via `value_string = "{provider}:{sub}"` | One-to-many join table, scaffolding per provider | | **Hot + cold attribute split** | Hot keys (login, password, status) stay in the relational `_users` table; cold OIDC profile lives in props rows linked by `RedbObject.key = _users._id`. No over-indexed wide rows, no JSON-blob lookups | Either everything in one wide table, or normalised into 8 satellite tables | | **Multi-tenant data isolation** | a named redb instance (`Identity:RedbInstanceName`; the images ship `identity-sqlite`, with `identity-pg` and `identity-mssql` predefined) that can target a separate database or the one of your business module | Single `DbContext`; isolation requires separate ASP.NET apps | | **Caching tier** | `Global*Cache` in `redb.Core` makes scheme + struct lookups O(1) in-process | Bring your own (`IDistributedCache` plumbing) | ### Provider matrix (zero code changes between rows) | Engine | Open-source package | Pro package | Notes | |---|---|---|---| | PostgreSQL 15+ | `redb.Postgres` | `redb.Postgres.Pro` | Battle-tested production target; `LISTEN/NOTIFY`-aware caches in Pro | | Microsoft SQL Server 2019+ | `redb.MSSql` | `redb.MSSql.Pro` | Full parity for OAuth / SCIM / MFA / WebAuthn; Service Broker hooks in Pro | | SQLite 3.44+ | `redb.SQLite` | `redb.SQLite.Pro` | Single-file / embedded target for dev, edge and small deployments; same schemes, same contracts | > Identity references only the `redb.Core` OSS abstraction — **the host worker picks the provider**, Identity code never names one. The **same** test suite runs on PostgreSQL, MSSQL **and** SQLite; a single `REDB_PROVIDER` env-var picks the engine. ### The 33 typed redb schemes that compose redb.Identity All defined via `[RedbScheme("identity.*")]` in [src/redb.Identity.Core/Models/](src/redb.Identity.Core/Models/) (+ DataProtection). The `identity.*` value is the scheme's alias; the database stores the scheme under the class's full name (`_schemes._name`, for example `redb.Identity.Core.Models.UserProps`), so SQL against `_schemes` uses that name. Enumerate them with: ```sh grep -rhoE '\[RedbScheme\("[^"]+"' --include=*.cs src | sed 's/.*("//; s/"$//' | sort ``` | Domain | Schemes | |---|---| | OAuth / OIDC core | `identity.application`, `identity.scope`, `identity.token`, `identity.authorization`, `identity.session`, `identity.idempotency_record` | | Users & groups | `identity.user`, `identity.group`, `identity.group_member`, `identity.password_history` | | Roles & assignments | `identity.role`, `identity.user_role_assignment`, `identity.group_role_assignment`, `identity.role_scope_assignment` | | Account-lifecycle tokens | `identity.password_reset_token`, `identity.email_verification_token`, `identity.change_email_token` | | MFA / WebAuthn | `identity.mfa`, `identity.mfa_otp`, `identity.webauthn_consumed_challenge` | | Federation | `identity.federation_provider`, `identity.federated_identity` | | Claims engine | `identity.claim_definition`, `identity.claim_mapper`, `identity.claim_scope`, `identity.claim_scope_assignment` | | DPoP / replay | `identity.dpop_consumed_jti` | | Webhooks | `identity.webhook_subscription` | | Cluster / cleanup | `identity.revoked_sid`, `identity.system_flag` | | Crypto / DP-keys | `identity.signing_key`, `identity.dp_key`, `identity.dp_key_import` (when the file key ring was moved into redb) | > **Audit is deliberately not one of them.** It used to be `identity.audit_event`, one props object per event. It now lives in a flat relational table, `identity_audit_log`, provisioned by `IdentityAuditLogTableInitListener`: an audit row is append-only, never queried by prop, and always read as a time-ordered range, so a multi-row props write bought nothing and cost a scan on every query. It is the one place where the object engine was the wrong shape, and saying so is more useful than pretending otherwise. ### What a "table" looks like — zero migrations, full IntelliSense ```csharp // src/redb.Identity.Core/Models/UserProps.cs [RedbScheme("identity.user")] public class UserProps { // Standard OIDC profile claims public string? GivenName { get; set; } public string? FamilyName { get; set; } public string? Picture { get; set; } public bool EmailVerified { get; set; } // Structured OIDC address (§5.1.1) — nested redb object, not JSON public AddressClaim? Address { get; set; } // Arbitrary tenant-specific claims — each pair becomes its own props row, // queryable and indexable without ALTER TABLE. public Dictionary? CustomClaims { get; set; } // Multi-provider federation links — native props rows, hot reverse lookup // uses RedbObject.value_string = "{providerId}:{sub}". public Dictionary? ExternalIdentities { get; set; } public string? ScimExternalId { get; set; } // RFC 7643 §3.1 } ``` To add a property to your User — a `LoyaltyTier`, a `ManagerSubject`, a `DepartmentCode` — you literally just add it to the class. No migration, no DBA call, no downtime. redb reads/writes it the next instant; once it's in production data, queries can filter and project it. ### Bootstrap & isolation - **Schema sync.** `IdentitySchemaInitListener` walks `[RedbScheme]`-marked types in loaded assemblies on `InitializeAsync()` and reconciles the redb scheme metadata. - **TOCTOU-safe unique indexes.** `IdentityUniqueIndexesInitListener` applies partial unique indexes that the cleanup races depend on (ClientId, ScopeName, MFA-per-user, idempotency keys, federated `{providerId}:{sub}`). - **Per-context isolation.** Identity always resolves a **named** redb instance (`Identity:RedbInstanceName`; `identity-sqlite` in the images, `identity-pg` and `identity-mssql` predefined) — it can coexist with other modules' redb usage in the same Tsak worker without sharing connections, transactions, or caches. A call into Identity from inside your own transaction therefore runs on a second connection: call Identity outside the transaction. Or, point it at a dedicated DB and your business data never sees an OAuth row. --- ## Cluster-readiness Identity is designed for N-replica deployments where leadership rotates without coordination across the runtime. | Concern | Mechanism | |---|---| | DataProtection key-ring across replicas | `RedbXmlRepository` — redb-persisted XML keys, registered as the ring's repository, so every node reads and writes the same ring. Every replica refreshes its in-memory snapshot every `XmlRepositoryRefreshInterval` (default 12 h, half of the 24 h DataProtection refresh of the active key). **Not** cluster-gated by design — every node must catch keys rotated by others. | | OAuth signing keys across replicas | `PropsSigningKeyStore` — RSA 2048 PEMs, DataProtection-encrypted at rest, bootstrapped under a distributed lock so only one replica generates the first key. Off by default (`UsePropsSigningKeyStore=false`); switch it on for multi-replica. | | Cleanup timers (tokens / sessions / MFA OTP / WebAuthn challenges / revoked SIDs) | Registered with `.Cluster(true)` — leader-only in a clustered Tsak deployment, silently ignored in standalone. Even without the marker, every cleanup uses `IBackgroundDeletionService` (claim pattern), so concurrent execution is safe — `.Cluster(true)` is belt-and-suspenders + log-noise reduction. | | MFA atomicity under concurrency | `SELECT FOR UPDATE` on the MFA row + `FailedAttempts++` inside the same transaction. TOTP replay window enforced per RFC 6238 §5.2. | | Backchannel logout across replicas | `/revoked-sids/add` writes the revocation; `/revoked-sids/since?cursor=` lets every RP replica pull deltas. Push-and-poll, not push-only — survives lost RP nodes and broken network partitions. | | OpenIddict per-request scoping | `RedbRouteOpenIddictServerHandler` captures `IServiceScopeFactory` and opens a fresh per-request scope — works correctly under .tpkg child SP isolation. | --- ## Observability First-class OpenTelemetry surface, structured security log, and Tsak-aggregated health probes — all wired in-tree, no extra package required. ### Metrics — meter `RedbIdentity` Consume from any OTel pipeline: ```csharp builder.Services.AddOpenTelemetry() .WithMetrics(m => m.AddMeter("RedbIdentity")); ``` Defined in [IdentityMetrics.cs](src/redb.Identity.Core/Metrics/IdentityMetrics.cs): | Instrument | Type | Tags | What it tells you | |---|---|---|---| | `identity.login.attempts` | Counter | — | Password login throughput | | `identity.login.failures` | Counter | `reason` | Bad-password / unknown-user / locked / mfa-required | | `identity.mfa.verifications` | Counter | `method`, `result` | TOTP / SMS / email / recovery code outcomes | | `identity.mfa.lockouts` | Counter | `method` | MFA brute-force lockouts triggered | | `identity.tokens.issued` | Counter | `grant_type`, `token_type` | Tokens minted by OpenIddict | | `identity.tokens.errors` | Counter | `error` | `invalid_grant`, `invalid_client`, `invalid_dpop_proof`, … | | `identity.rate_limit.rejections` | Counter | `endpoint`, `key_dimension` | Throttled requests (per-IP / per-client / per-user) | | `identity.password.verify.duration` | Histogram (ms) | `algorithm` | Hash-verify wall-clock (BCrypt / PBKDF2 / Argon2) — catches CPU regressions | | `identity.unique_violation` | Counter | `scheme`, `column` | DB unique-index hits (TOCTOU guard fired) | | `identity.audit.write_failures` | Counter | `event_type` | Audit events whose row could not be written; a gap in the audit trail | ### Security log channel All audit-grade events route through a dedicated logger category so SIEM can subscribe without sifting routine logs: - **Category:** `RedbIdentity.Security` - **Source:** [IdentitySecurityLog.cs](src/redb.Identity.Core/Security/IdentitySecurityLog.cs) - **Wired into:** `LoginService`, `MfaService`, `IdentityCoreRouteBuilder`, `BootstrapAdminProcessor`, rate-limit / RBAC rejections ### Health checks — module `identity` Surface under Tsak's aggregated `/api/health/{startup,live,ready}`. Defined in [IdentityHealthContributor.cs](src/redb.Identity.Core/Health/IdentityHealthContributor.cs). | Probe | Healthy when … | Failure semantics | |---|---|---| | `db` | `IRedbService.GetDbVersionAsync()` returns non-empty | Unhealthy — storage unreachable | | `signing-keys` | ≥ 1 signing credential registered with OpenIddict | Unhealthy — token issuance would fail | | `data-protection` | Active key-ring exposes ≥ 1 key | Degraded — cookies still work on bootstrap key | --- ## Security highlights | Surface | Defense | |---|---| | Token endpoint | Per-IP rate limit + per-`client_id` throttle (token bucket) + RFC 6749 error mapping | | Login endpoint | Per-IP rate limit + per-`(IP+username)` failure ceiling with security-channel logger | | Facade HTML forms | `X-Frame-Options: DENY` + `frame-ancestors 'none'` on every page (no clickjacking of the consent "Allow"); cross-site `Origin`/`Referer` on `/login`, `/consent`, `/mfa*` → 403; consent page renders only from a server-signed ticket and the decision is bound to the session cookie, never to a form field | | Reserved headers | Never trusted from the wire on any transport: `IdentityReservedInboundHeaders` (Contracts) names the internal-only headers (`session_*`, `reauth_marked_sid`, `client_id`, `client_secret`, `access_token`, `user_id`, `ip_address`, `user_agent`) and each facade — HTTP, gRPC (metadata and envelope headers), SOAP — strips them as its first step, so only the cookie / `Authorization` / Basic / body / path / transport can set them. A forged `session_user_id` cannot impersonate a user and a forged `ip_address`/`user_id`/`client_id` cannot sign the audit log. `operation` is stripped on HTTP only — the gRPC envelope route lets the caller name it by design | | Audit attribution | `client_id` comes from Basic **or** the form body, so form-authenticated and public PKCE clients are attributed too; a management or account call records the acting client in `client_id` and the token's subject (client id, or the user's public subject) in `actor_subject`; `ip_address` falls back to the transport's proxy-sanitized `redbHttp.RemoteAddress` and `user_agent` to the real `User-Agent`; on SQLite the `timestamp` column is `REAL` (Julian day), matching how the provider encodes `DateTimeOffset` | | Consent page | Renders and grants only from a server-signed consent ticket (`?ct=…`); app name and scopes come from the ticket, not the URL (no trusted-UI phishing), and the ticket is bound to the session user (no cross-session replay). Pinned by `FullStackFacadeFormHardeningTests` | | MFA verify | DB row-lock + `IdempotentConsumer` keyed by `(jti, code)` — defeats retransmit / captured-request replay | | Recovery codes | One-shot — marked consumed in the same transaction as session creation | | Role scopes | A scope attached to a role is an entitlement, never an addition: it reaches a token only when the client requests it and holds the `scp:` permission, and a gated scope (`AdminScopeEntitlement`: `identity:*`, `scim`, `GatedScopes`) stays only for users whose roles carry it. An administrator signing in to some other application gives it no management scope. Pinned by `RoleScopeAugmentationTests` | | Self vs admin | `RequireSelfOrAdminProcessor` on every `/me/*` route — a token with `identity:account` can never mutate another user's MFA, password, sessions, or consents | | Idempotency | Cache placed AFTER authorization so a revoked token cannot unlock cached responses; one-time secrets are never kept in it, and expired records are deleted hourly | | Trusted proxies | `TrustedProxyResolverProcessor` — `redbHttp.RemoteAddress` is sanitized BEFORE any rate-limit / lockout sees it | | Password history | Configurable depth, rejects reuse | | Federation | OIDC + GitHub, secrets server-side, never returned over the wire | | Audit | Flat `identity_audit_log` table + optional external targets (Kafka / Elasticsearch / RabbitMQ / log), sent through the delivery outbox with retries | | DPoP | RFC 9449 — issuance binding + resource-server `redb.Identity.Resource.Dpop` for downstream APIs | | Secrets | Never in `context.json` — only via Tsak override env-vars (`Tsak__Contexts__identity.core__Override__Identity__*`) | --- ## Audit event catalogue **109 typed audit events across 7 categories** — single source of truth in [IdentityAuditEventIds.cs](src/redb.Identity.Contracts/Routes/IdentityAuditEventIds.cs), with `IdentityAuditCategories.CategoryOf(eventType)` as the one mapping from event to bucket. Every event lands in the flat `identity_audit_log` table (see the storage section — audit is the one part of Identity that is deliberately relational, not props) and, if configured, goes through the delivery outbox to Kafka / Elasticsearch / RabbitMQ / log (see Audit targets below). Plaintext secrets are never persisted to audit — rotations log a `ClientSecretRotated` marker only. | Category | Count | Examples | |---|---:|---| | `authentication` | 14 | `UserLoggedIn`, `UserLoggedOut`, `LoginFailed`, `PasswordChanged`, the password-reset chain (`Requested` / `TokenIssued` / `Completed` / `Failed`), email verification (`Sent` / `Completed` / `Failed`), email change (`Requested` / `Completed` / `Failed`) | | `authorization` | 14 | `TokenIssued`, `TokenRevoked`, `TokenIntrospected`, `AuthorizationGranted`, `ConsentGranted` / `Revoked` / `AllConsentsRevoked`, `DeviceCodeIssued` / `Verified` / `Denied`, `ParRequestAccepted` / `Rejected`, `DpopBindingApplied`, `DpopReplayDetected` | | `admin` | 42 | `ClientRegistered` / `Updated` / `Deleted` / `SecretRotated`, `Scope*`, `ClaimMapper*`, `ClaimScope*` (+ `Assigned` / `Unassigned`), `User*`, `Group*` (+ `Moved`), `Member*`, the role registry (`RoleCreated` / `Updated` / `Deleted`, `RoleAssignedUser` / `Group`, `RoleScopeAttached` / `Detached`) and webhook subscriptions (`Created` / `Updated` / `Deleted` / `SecretRotated`) | | `federation` | 9 | `FederationChallengeInitiated`, `FederationStateValidationFailed`, `FederatedUserLoggedIn`, `FederatedIdentityLinked` / `Unlinked`, `FederatedEmailConflict`, `FederationProvider*` | | `mfa` | 10 | `MfaEnrolled`, `MfaDisabled`, `MfaChallengeIssued`, `MfaVerifyFailed`, `MfaRecoveryCodeUsed` / `CodesDownloaded`, `MfaWebAuthnRegistered` / `Asserted` / `Revoked` / `SignCounterAnomaly` | | `scim` | 9 | `ScimUserCreated` / `Replaced` / `Patched` / `Deleted`, `ScimGroupCreated` / `Replaced` / `Patched` / `Deleted`, `ScimBulkProcessed` | | `system` | 13 | `SessionRevoked` / `AllSessionsRevoked` / `SessionsPruned`, `SidRevoked` / `RevokedSidsPruned`, `MfaOtpPruned`, `IdempotencyRecordsPruned`, `TokenCleanupRan` / `TokensPruned`, `TokensRevokedByUser`, plus the dry-run markers `AllSessionsRevocationPreviewed` / `TokensPrunePreviewed` / `IdempotencyRecordsPrunePreviewed` | ### Webhook delivery Every event goes to the webhook subscriptions that match it through an outbox table, `identity_delivery_outbox`, which a delivery worker reads (the timer route `identity-webhook-delivery`, leader-only under a Tsak cluster; each row is also leased by the database clock, so several nodes never send one row at the same time). - **At least once.** An event reaches the outbox after the request that caused it has committed, in the same pass that writes its audit row; the rare event lost when the process stops between the two has neither an audit row nor a delivery. A delivery whose success was not recorded (the node stopped between the answer and the status update) is sent again. Every attempt of one delivery carries the same `X-RedbIdentity-Delivery` id, and the body is the event with its `eventId`: a receiver deduplicates by either. Nothing here is exactly-once. - **No order.** Retries and parallel sending mean two events for one subscriber may arrive in either order. Order by the event's `timestamp`, not by arrival. - **Retries and timeout per subscription:** `timeoutMs` bounds each attempt, `maxAttempts` and `retryBackoffMs` (doubling, at most 30 s between attempts) decide the retries; after the last one the row is `failed`. A subscription deleted or disabled before its delivery is not sent to; its row ends `cancelled` and stays so: enabling the subscription again later does not send it (only events after that). - **Signature:** `X-RedbIdentity-Signature: sha256=`, computed when the request is sent, with the subscription's secret at that moment. No secret is stored in the outbox. - **Polling:** the worker looks for due rows every `Identity:Delivery:PollInterval` (default 2 s) and reads at most `BatchSize` (default 50) per pass; a claimed row stays reserved to its node for `Lease` (default 60 s, raised to a subscription's timeout plus a margin when that is longer). - **Fairness:** `Identity:Delivery:MaxParallel` (default 8) requests at once per node, at most `MaxParallelPerDestination` (default 2) of them to one subscriber, so one that hangs does not hold up the others. - **Cost:** an event no subscription wants writes nothing; the list of enabled subscriptions is cached for `Identity:Delivery:SubscriptionCache` (default 30 s; a change through the management API applies at once on the node that made it). Meter `RedbIdentity`: `identity.delivery.attempts` (tags `kind`, `result`) and `identity.delivery.enqueue_failures` (tags `event_type`, `kind`). ### Audit targets The external audit targets of `Identity:Audit:Targets` (Kafka, Elasticsearch, RabbitMQ, an SQL table, a log) get their events through the same outbox and worker, one row per event and enabled target, with `kind` `audit` and the target's `Name` as the destination. A target that is down or slow therefore holds up nothing and loses nothing: its rows wait and are retried while the events route goes on. The same rules as for webhooks apply: at least once (a consumer deduplicates by `eventId`, or by the `event_id` header in an SQL target with a unique key on it), no order, and the fairness limits per target. - Every enabled target needs a `Name`, unique among them (at most 200 characters); the start stops otherwise. - Per target: `TimeoutMs` (default 10000) bounds an attempt, `MaxAttempts` (default 10) and `RetryBackoffMs` (default 1000, doubling, at most 60 s between attempts) decide the retries; after the last one the row is `failed`. - A target removed from the configuration or disabled before its delivery gets nothing: its rows end `cancelled`. Renaming a target is the same as removing it for the rows written under the old name. - The message is unchanged: the event as JSON in the body (`application/json`), and the headers `event_id`, `event_type`, `timestamp`, `user_id`, `client_id`, `actor_subject`, `ip_address`, `user_agent`, `details` and `event-type` for parameter binding. `actor_subject` is the subject of the token that made a management change; an SQL target with a table of its own keeps working as before and stores it by adding a column and binding the header. ### Running the outbox - **Size.** One row per event and destination: an event that two subscriptions and one audit target want writes three rows. A row is about 400 bytes of columns plus its payload: the event's JSON for a webhook, about twice that for an audit target (the body and the `details` header are kept as sent). Daily volume is events per day times destinations per event; 100 000 events a day with three destinations each make 300 000 rows a day. - **Retention.** The timer route `identity-delivery-cleanup` (hourly, `Identity:Delivery:CleanupInterval`, leader-only) deletes delivered rows after `DeliveredRetention` (default 7 days) and failed or cancelled rows after `FailedRetention` (default 30 days), `CleanupBatchSize` rows per statement (default 1000). A pending row is never deleted, however old. With the defaults the table holds about a week of traffic. - **Inspection and redelivery.** `GET /api/v1/identity/webhooks/deliveries` lists the rows newest first, without their payload; filters `status`, `kind` (`webhook`, `audit`), `destination` (a subscription id or a target name), `offset`, `count` (at most 200). `POST /api/v1/identity/webhooks/deliveries/{id}/redeliver` sends a failed or cancelled row again from its first attempt; `409` for a pending or delivered row, `404` for an unknown id. A redelivery is audited as `WebhookDeliveryRedelivered` (category `admin`, details carry the row id `OutboxId`). Scopes: `identity:webhooks:read` and `identity:webhooks:write`. - **Backlog.** Gauges `identity.delivery.pending` (rows not finished) and `identity.delivery.oldest_pending_age` (seconds since the oldest of them was written), read from the table at most every 15 s on every node. The module reports `Degraded` when the oldest pending row is older than `Identity:Delivery:DegradedAfter` (default 5 minutes): the worker is not running, or a destination has been failing that long. Nothing is lost while it is degraded. - **Back pressure.** Events leave their routes on wire taps that share the thread pool profile `identity-audit`: at most `Identity:Audit:TapConcurrency` (default 8) events per route in the events route at once, up to 1000 more waiting; past that the request that raised the event runs it itself, so a slow audit write slows requests down instead of piling up work. > Notable security events to wire into your SIEM first: `LoginFailed`, `MfaVerifyFailed`, `MfaWebAuthnSignCounterAnomaly`, `DpopReplayDetected`, `FederationStateValidationFailed`, `FederatedEmailConflict`, `ClientSecretRotated`, `AllSessionsRevoked`, `AllConsentsRevoked`. --- ## Runnable demos (`demos/`) Beyond the xUnit suite, `demos/` holds **self-contained PowerShell probes** that drive a **live** Identity server over its real HTTP surface — one `demo_*.ps1` per protocol contract. They double as executable RFC documentation and as a black-box regression net: each script sets up its own client (via DCR), runs the flow end-to-end, and asserts the wire-level result (status codes, headers, token/JWKS shape, replay rejection, …). Most print an `N/N PASS` line and exit non-zero on the first broken assertion. A sampling of what they pin (see the directory for the full set): | Demo | Contract exercised | |---|---| | `demo_discovery_jwks.ps1` | OIDC Discovery + JWKS shape, RFC 8414 metadata | | `demo_client_credentials.ps1` / `demo_password_ropc.ps1` / `demo_authcode_pkce.ps1` | Core grants + PKCE (`S256`) | | `demo_private_key_jwt.ps1` | `private_key_jwt` client auth (RFC 7521 / 7523) | | `demo_dpop.ps1` | DPoP proof binding + replay (RFC 9449) | | `demo_par.ps1` / `demo_par_per_client.ps1` | Pushed Authorization Requests (RFC 9126) | | `demo_throttle_rfc6585.ps1` | `429 Too Many Requests` + `Retry-After` (RFC 6585) | | `demo_backchannel_logout.ps1` | OIDC Back-Channel Logout + `logout_token` fan-out | | `demo_scim.ps1` / `demo_scim_bulk.ps1` / `demo_scim_etag.ps1` | SCIM 2.0 CRUD + Bulk + ETag concurrency (RFC 7643 / 7644) | | `demo_mfa_totp.ps1` / `demo_mfa_recovery_codes.ps1` | TOTP (RFC 6238) + one-shot recovery codes | | `demo_federation_e2e.ps1` / `demo_federation_github.ps1` | OIDC + GitHub federation, provision-on-first-login | | `demo_jwks_rotation.ps1` | Live JWKS key rotation / retire against a running server | | `demo_roles_registry.ps1` / `demo_claim_definitions.ps1` / `demo_webhooks.ps1` | Roles, declarative claim schema, signed outbound webhooks | ### Run them all ```pwsh cd demos pwsh -File .\run_all.ps1 # run every demo_*.ps1 in canonical order pwsh -File .\run_all.ps1 -Only mfa # only demos whose name matches "mfa" pwsh -File .\run_all.ps1 -StopOnFail # bail out on the first failing demo ``` `run_all.ps1` executes each demo in its own `pwsh` child process (a hard failure in one can't abort the rest), streams stdout live, captures a per-demo transcript to `demos/_logs/.log`, and prints a final pass/fail summary table. Browser-in-the-loop demos (e.g. `demo_device_code.ps1`) are skipped unless `-IncludeInteractive` is passed. Point the demos at a running server with `IDENTITY_BASE` (default `https://127.0.0.1:5002`), started per the [Quick start](#quick-start) above. --- ## Typed SDK (`IIdentityClient`) `BaseUrl` is the address of the management API (`/api/v1/identity/*`); `Authority` is the issuer, and the token and every other protocol address (introspection, revocation, userinfo, discovery, JWKS) come from its discovery document. They may be the same address; with a separate management port they differ. `Authority` is required: without it the host does not start. ```csharp services.AddIdentityClient(options => { options.BaseUrl = new Uri("https://id.example.org"); // the management API (/api/v1/identity/*) options.Authority = new Uri("https://id.example.org"); // the issuer: token and the other protocol endpoints options.ClientId = "my-svc"; options.ClientSecret = builder.Configuration["IdentitySvcSecret"]!; options.Scopes = ["identity:manage"]; }); services.AddClientCredentialsTokenProvider(); public class UserSync(IIdentityClient identity) { private DateTimeOffset? _cursor; public async Task RunAsync(CancellationToken ct) { var page = await identity.ListUsersAsync(offset: 0, count: 100, ct: ct); foreach (var user in page.Items) Console.WriteLine(user.Login); // Backchannel revocations: pull the entries since the last cursor var since = await identity.GetRevokedSidsSinceAsync(_cursor, ct); foreach (var entry in since.Entries) Console.WriteLine(entry.Sid); _cursor = since.NextCursor; } } ``` Partial classes group endpoints by area: `Users`, `Groups`, `Applications`, `Scopes`, `ClaimMappers`, `Federation`, `Sessions`, `Tokens`, `Mfa`, `Audit`, `Account`, `Token`, `Scim`, `Info`, `RevokedSids`. The client sends the token of the registered `IAccessTokenProvider`. `AddClientCredentialsTokenProvider()` registers `ClientCredentialsAccessTokenProvider`, for daemons, CLIs and hosted services; a host that acts for a signed-in user registers its own provider (the console of the `full` and `web` images replays the user's bearer). Every HTTP error is normalized to RFC 7807 `ProblemDetails` and surfaced as `ApiException`. --- ## Reference BFF + admin UI (`redb.Identity.Web`) A reference Blazor Server app demonstrating the HARDLINE BFF pattern: - Project references **only** `redb.Identity.Contracts` + `redb.Identity.Client` — no `Identity.Core`, no `Identity.Http` - All Identity calls go through `IIdentityClient` — **never** a raw `HttpClient` - OIDC Authorization Code + PKCE, `SaveTokens=true`, `SameSite=Lax` - Backchannel logout sink + `IRevokedSidsCache` (push + 60s poll fallback for multi-replica RPs) Pages cover both self-service (`/Me/*`) and admin (`/Admin/*`) surfaces: | Self-service | Admin | |---|---| | Profile, Password, MFA (TOTP), WebAuthn credentials, Sessions, Federated identities, Consents | Users (CRUD + password reset), Groups (tree + members), Applications (CRUD + scopes), Scopes, Claim Mappers, Federation providers, Sessions (revoke single/all), Tokens (prune), Audit (15 event types + JsonViewer), SCIM browser, Settings (health / discovery / JWKS) | --- ## Testing ```pwsh # default provider (SQLite) dotnet test tests\redb.Identity.Tests\redb.Identity.Tests.csproj --nologo # pick the storage engine with one env-var — the same suite runs on all three $env:REDB_PROVIDER = "postgres" # or "mssql" or "sqlite" (default) $env:REDB_USE_PRO = "true" # Pro tier (ChangeTracking); "false" for Free dotnet test tests\redb.Identity.Tests\redb.Identity.Tests.csproj --nologo ``` Provider selection is a runtime env-var; no Identity source changes between providers. | Project | Notes | |---|---| | `redb.Identity.Tests` | Unit + integration; real PostgreSQL / MSSQL / SQLite via `HttpIdentityFixture` for HTTP E2E | | `redb.Identity.Client.Tests` | SDK transport / serialization contract | | `redb.Identity.Web.Tests` | BFF smoke acceptance | Key invariants pinned by tests (non-exhaustive): - **Cluster-route marking**: only cleanup routes are `.Cluster(true)` (`ClusteredRouteMarkingTests`) - **Multi-replica key-ring**: two `RedbXmlRepository` instances against the same DB see each other's keys - **Key-ring import**: a file key ring from before the move into redb is imported once, and only keys older than the move - **MFA concurrency**: parallel verify never double-spends a recovery code, atomic `FailedAttempts++` - **TOTP replay**: identical code rejected within RFC 6238 §5.2 window - **DataProtection at rest**: AES-GCM via DP, not plaintext PEMs - **Project-reference isolation**: zero `using redb.Identity.Core;` under `redb.Identity.Http/` - **DTO validation boundary**: comprehensive `DtoValidationTests` over every wire DTO --- ## Roadmap (excerpt) Shipped today: HTTP facade, **gRPC facade**, **SOAP / WS-Trust facade**, LDAP / Active Directory federation, full management API, SCIM 2.0, MFA (TOTP / SMS / Email OTP / WebAuthn), federation (OIDC + GitHub), backchannel logout (push + pull), DPoP, PAR, DCR, JAR (opt-in), impersonation, outgoing webhooks, audit (`identity_audit_log` + external targets through the outbox), NuGet packages, signed Docker images and release archives. Planned facades & integrations (same `.tpkg` pattern, no Core changes): - `redb.Identity.Rmq` / `.Amqp` / `.IbmMq` — message-bus RPC facades - `redb.Identity.SignalR` — push of audit events to subscribed clients - `redb.Identity.Kafka` — event-only sink (Kafka has no RPC) Planned protocol work, in rough order of demand: - Formal [OpenID Certification](https://openid.net/certification/) submission; conformance results in [`OPENID_CERTIFICATION.md`](OPENID_CERTIFICATION.md) - SAML 2.0 — **not implemented** in either direction (no IdP, no SP) - Risk-adaptive authentication and trusted-device records — the inputs (session IP, user agent, device label, failure counters, audit trail) are already stored; the scoring and step-up policy on top of them are not - The RFCs listed under *Not implemented yet* above --- ## Contributing & license - License: [Apache 2.0](https://github.com/redbase-app/redb-identity/blob/main/LICENSE) - Engine: [OpenIddict](https://documentation.openiddict.com/) (Apache 2.0) - Runtime: [redb.Route](https://github.com/redbase-app/redb-route) - Container: [redb.Tsak](https://github.com/redbase-app/redb-tsak) - Storage: [redb.Core](https://github.com/redbase-app/redb) Contributions are welcome: see [CONTRIBUTING.md](CONTRIBUTING.md). Report vulnerabilities as described in [SECURITY.md](SECURITY.md). Path: redb-identity/SECURITY.md Snapshot: redb-identity, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/SECURITY.md ---- # Security Policy ## Supported Versions | Version | Supported | |---------|-----------| | 4.7.x and later | :white_check_mark: | | < 4.7 | :x: | Fixes go into a patch of the supported lines; upgrade from an older version to get them. ## Reporting a Vulnerability redb.Identity is an OAuth 2.0 / OpenID Connect authorization server. A defect here can compromise every application that trusts it, so please report privately rather than in a public issue. Two channels, either is fine: 1. **GitHub private advisory** (preferred) — [Report a vulnerability](https://github.com/redbase-app/redb-identity/security/advisories/new). Anyone with a GitHub account can file one; it stays private between you and the maintainer. 2. **Email** — **support@redbase.app** Please include: - Affected package(s) and version - Description of the vulnerability - Steps to reproduce, or a proof-of-concept request/response pair - Potential impact assessment We will acknowledge receipt within 48 hours and provide a timeline for a fix. What happens next: the report stays private while we confirm and fix it. The fix ships in a patch release; then we publish a GitHub security advisory on this repository that names the affected and patched versions and credits you, unless you ask not to be named. We request a CVE through GitHub for the advisory; if none has been assigned by the disclosure date agreed with you, the advisory is published under its GHSA ID and the CVE is added when it arrives. **Do NOT** open a public GitHub issue for a security problem. Everything else — bugs, questions, feature requests — belongs in the public tracker and is welcome from anyone. ## Scope This policy covers the redb.Identity family: - `redb.Identity.Core` (authorization server, token issuance, key management) - `redb.Identity.Core.Module`, `redb.Identity.Contracts` - `redb.Identity.Http`, `redb.Identity.Grpc`, `redb.Identity.Management` - `redb.Identity.Client`, `redb.Identity.Web` - `redb.Identity.DataProtection`, `redb.Identity.Ldap` - `redb.Identity.Resource.Dpop` Especially in scope: token issuance and validation, PKCE, redirect-URI handling, scope and consent enforcement, refresh-token rotation and reuse detection, DPoP proof validation, introspection and revocation, JWKS exposure and key rotation, MFA enrolment and recovery codes, SCIM and Management API authorization, LDAP federation, session and cookie handling. Out of scope: findings that require an already-compromised host or database, missing hardening headers on the demo web UI, and rate-limit tuning of a deployment you control. ## Security Notes for Operators ### Signing keys across replicas Signing keys live in the shared redb database when the persistent key store is enabled. With more than one replica, enable it explicitly — the option defaults to `false`: ```csharp services.Configure(o => { o.UsePropsSigningKeyStore = true; // shared JWKS across replicas o.AllowEphemeralKeys = false; // never in production }); ``` Leaving `UsePropsSigningKeyStore = false` on a multi-replica deployment gives each replica its own key set, so tokens issued by one replica fail validation at another. Verify by hitting `/.well-known/jwks` on every replica and comparing the `kid` sets. Key material is encrypted at rest with ASP.NET Core Data Protection. Configure a persistent, shared Data Protection key ring for any deployment with more than one replica, otherwise the keys become unreadable after a restart. ### Ephemeral keys `AllowEphemeralKeys = true` generates a throwaway key pair per process. It exists for local development only. A production start-up with ephemeral keys enabled is a misconfiguration. ### TLS Run the authorization server behind TLS. OpenID Connect discovery, token endpoints and cookies assume `https`; plain `http` is acceptable only on `localhost` during development. See `HTTPS.md` for the local certificate setup. ### Client secrets and registration Confidential clients must use a real secret or private-key JWT authentication. Public clients must use PKCE with `S256`. Registered redirect URIs are matched exactly — do not add wildcard or open-ended entries. ### Rate limiting Token, authorization and MFA endpoints are throttled. Keep throttling enabled in production and size it for your traffic rather than turning it off. Path: redb-identity/UPGRADING.md Snapshot: redb-identity, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/UPGRADING.md ---- # Upgrading redb.Identity What to check and change when moving to a new version. Each section lists the changes that need action; [CHANGELOG.md](CHANGELOG.md) has the full list of what changed. ## 4.8.0 ### .NET 10 and .NET 11 only The redb.Identity packages target `net10.0` and `net11.0`. The `net8.0` and `net9.0` builds are gone: .NET 8 and .NET 9 reached end of support on 10 November 2026. The Docker images, the archives, the Tsak modules and `redb.Identity.Web` run on .NET 10 as before. Action: an application that hosts or calls redb.Identity on .NET 8 or .NET 9 either stays on 4.7.x or moves its target framework to `net10.0` (or `net11.0`) before taking this version. Nothing changes in the API or the configuration. ### Group names are unique A group name is now unique across the whole group tree. Names are compared without surrounding whitespace, letter case or Unicode form, so `Admins`, `admins` and ` ADMINS ` are one name. The name keeps the spelling it was given; the comparison key is stored next to it. Creating a group, a child group or a SCIM group with a name that another group already has, and renaming a group to such a name, is refused with `409` (`scimType: "uniqueness"` on SCIM). The `displayName eq` filter of SCIM `/Groups` now compares the same way. LDAP group sync maps a group CN onto the existing group of that name in any case instead of creating a second one. Existing groups get their key at the first start of this version, oldest first. A group whose name another, older group already has keeps working without a key, and every start logs an error that names both groups by id and name. What to do: 1. Before or after the upgrade, list the groups that share a name. On PostgreSQL: ```sql SELECT o._id, o._name, o._date_create FROM _objects o JOIN _schemes s ON s._id = o._id_scheme WHERE s._name = 'redb.Identity.Core.Models.GroupProps' AND lower(btrim(o._name)) IN ( SELECT lower(btrim(o2._name)) FROM _objects o2 JOIN _schemes s2 ON s2._id = o2._id_scheme WHERE s2._name = 'redb.Identity.Core.Models.GroupProps' GROUP BY lower(btrim(o2._name)) HAVING count(*) > 1) ORDER BY lower(btrim(o._name)), o._id; ``` On SQL Server use `lower(ltrim(rtrim(o._name)))` in place of `lower(btrim(o._name))`; on SQLite `lower(trim(o._name))`. These compare case and whitespace only; a pair that differs only in Unicode form shows up in the start log. 2. For every pair, rename or remove all but one group (`PUT /api/v1/identity/groups/{id}` or the admin console). Remember that the `groups` claim and `ScopeRequiredGroups` name a group by its name: check which of the two your scope gates and token consumers mean before you rename. 3. Restart. The renamed groups get their key; the start log has no group-name errors left. ### Own host: one start call A process that runs Identity without a Tsak worker starts it with one call. The older entry point `redb.Identity.Core.InitRoute` is removed, and the modules no longer read options the host registered in its own container: `AddRedbIdentityServer(...)` on the host's services, or `IdentityTransportOptions`, `IdentityGrpcTransportOptions` and `IdentitySoapTransportOptions` configured there. Every module reads the `Identity` and `IdentityTransport` configuration sections, in an own host as in a worker. A host container that still registers `AddRedbIdentityServer` is refused at start with a message that says so. Replace the hand-built route context with: ```csharp services.AddLogging(); services.AddSingleton(configuration); services.AddRedb...(...); // your redb provider, as before services.AddRedbIdentityHost(); // HTTP server manager and direct-vm registry await using var provider = services.BuildServiceProvider(); await using var identity = await RedbIdentityHost.StartAsync(provider, configuration, redb.Identity.Http.InitRoute.main); ``` with the settings moved into the configuration: ```json { "Identity": { "Issuer": "https://id.example.com/", "UsePropsSigningKeyStore": true }, "IdentityTransport": { "Http": { "PublicPort": 5002 } } } ``` `StartAsync` fails before anything listens when logging or `AddRedbIdentityHost()` is missing, when `Identity:Issuer` is missing or not an absolute URI, when neither `Identity:UsePropsSigningKeyStore` nor `Identity:AllowEphemeralKeys` is set, or when a facade is given without the `IdentityTransport` section. Dispose the returned host to stop it. A deployment in a Tsak worker needs no change. ### Audit targets go through the outbox The external audit targets of `Identity:Audit:Targets` are no longer sent from the events route but through the delivery outbox (`identity_delivery_outbox`, created at start), by the same worker as webhooks, with retries. What to check: 1. Give every enabled target a `Name`, unique among the enabled ones, at most 200 characters. The start stops with a message naming `Identity:Audit:Targets:N:Name` when one is missing or taken twice. 2. Delivery is at least once and unordered: after a failure the event is sent again, and two events may arrive in either order. Consumers that must not see one event twice deduplicate by `eventId` (body) or `event_id` (header); an SQL target does it with a unique key on `event_id`, which then refuses the repeat. 3. Retries are per target: `TimeoutMs` (default 10000), `MaxAttempts` (default 10), `RetryBackoffMs` (default 1000, doubling, at most 60 s). Set them on the targets whose consumer is slow or often down. 4. Events arrive a few seconds later than before: the worker polls every `Identity:Delivery:PollInterval` (default 2 s). The body and the headers a target receives are unchanged. ### Admin TOTP confirm sends the setup token Confirming a TOTP enrollment through the management API failed with `400 invalid_request "Missing setup_token"` since the setup token was introduced: neither `POST /api/v1/identity/mfa/totp/confirm` nor `IdentityClient.ConfirmUserTotpAsync` passed it. The request now carries it, and the client method takes it. Before: ```csharp var setup = await client.SetupUserTotpAsync(userId, username); await client.ConfirmUserTotpAsync(userId, code); ``` After: ```csharp var setup = await client.SetupUserTotpAsync(userId, username); await client.ConfirmUserTotpAsync(userId, code, setup.GetProperty("setup_token").GetString()!); ``` Action: pass the `setup_token` of the setup answer to `ConfirmUserTotpAsync`, or add `"setupToken"` to the body of `POST /api/v1/identity/mfa/totp/confirm`. A confirm without it is refused with `400` (`setupToken is required.`). ### E-mail MFA enrollment sends the code E-mail MFA could not be enrolled: setup sent nothing to the address, and confirm needed a code that only a sign-in challenge to an already confirmed address produced. Setup now sends the one-time code to the new address and answers with `mfa_state` next to `setup_token`; confirm takes the code with both. This applies to the admin endpoints (`POST /api/v1/identity/mfa/email/setup` and `/email/confirm`) and to self-service (`POST /api/v1/identity/me/mfa/setup` and `/confirm` with `"method": "email"`). The code goes out through the e-mail channel: the SMTP channel when `Smtp.Enabled` is on, or an `IEmailNotificationChannel` the host registers. Without one, setup answers `501 no_channel`. A second code inside `OtpCooldown` answers `429 rate_limited`, a failed delivery `502 delivery_failed`. Before: ```csharp var setup = await client.SetupUserEmailAsync(userId, username, address); await client.ConfirmUserEmailAsync(userId, code, mfaState); ``` After: ```csharp var setup = await client.SetupUserEmailAsync(userId, username, address); // the code is now e-mailed to address await client.ConfirmUserEmailAsync(userId, code, setup.GetProperty("mfa_state").GetString()!, setup.GetProperty("setup_token").GetString()!); ``` Action: pass `mfa_state` and `setup_token` of the setup answer to `ConfirmUserEmailAsync`, or add `"mfaState"` and `"setupToken"` to the body of `POST /api/v1/identity/mfa/email/confirm` (self-service: `mfa_state` and `setup_token`). A confirm without the setup token is refused with `400` (`setupToken is required.`). Make sure the e-mail channel is configured where e-mail MFA is offered. ### The client needs the authority `redb.Identity.Client` used to build every protocol address from `BaseUrl`: `/connect/token`, `/connect/introspect`, `/connect/revocation`, `/connect/userinfo`, `/.well-known/openid-configuration` and `/.well-known/jwks`. With the management API on a port of its own (`IdentityTransport:Http:ManagementPort`) none of them is there, and each answered `404`. The client now follows one rule: `BaseUrl` is the address of the management API, `Authority` is the issuer, and every protocol address comes from the discovery document at `{Authority}/.well-known/openid-configuration`. The two may be the same address. This covers `AddIdentityClient` (`IdentityClientOptions`: `ClientCredentialsAccessTokenProvider`, `RequestTokenAsync`, `IntrospectTokenAsync`, `RevokeOAuthTokenAsync`, `GetUserInfoAsync`, `GetDiscoveryDocumentAsync`, `GetJwksAsync`) and `AddBackchannelIdentityClient` (`BackchannelIdentityClientOptions`). `Authority` has no default. A host that does not set it fails at start with an `OptionsValidationException`: `IdentityClientOptions.Authority is required: set it to the issuer of the Identity server ...` (or `BackchannelIdentityClientOptions.Authority ...`). The discovery document is read at the first use, not at start, and kept for the life of the client. If the server cannot be reached then, that call fails as a call to an unreachable server did before, and the next one reads the document again; the host keeps running. Action: set `Authority` to the issuer, the value of the server's `Identity:Issuer`. ```csharp services.AddIdentityClient(o => { o.BaseUrl = new Uri("https://id.example.org"); o.Authority = new Uri("https://id.example.org"); // new, required o.ClientId = "my-service"; o.ClientSecret = secret; o.Scopes = ["identity:manage"]; }); services.AddClientCredentialsTokenProvider(); services.AddBackchannelIdentityClient(o => { o.BaseUrl = new Uri("https://id.example.org"); o.Authority = new Uri("https://id.example.org"); // new, required o.ClientId = "identity-backchannel"; o.ClientSecret = secret; }); ``` The console of the `full` and `web` images sets both from `Identity:Authority`, which it already requires; nothing to do there. ### The client asks for identity:manage by default `IdentityClientOptions.Scopes` defaulted to `identity.admin`. The server has no such scope: a client credentials request that kept the default was answered `400 invalid_scope`, so no working setup relied on it. The default is now `identity:manage`, the scope `BackchannelIdentityClientOptions` already asks for. `identity:manage` is the master management scope: a token that holds it passes every management endpoint, reads and changes alike. A client that sets no scopes now receives such a token when its service account is allowed to request `identity:manage`, and still gets `invalid_scope` when it is not. Action: none for a client that sets `Scopes`. A client that relied on the default and needs less sets a narrower scope, for example `o.Scopes = ["identity:read"]` for read-only access or a resource scope such as `identity:users:read`; the full list is `IdentityScopes` in `redb.Identity.Contracts` and the server's `scopes_supported`. ### Back-channel logout addresses must be public https Not affected: relying parties whose `backchannel_logout_uri` is an `https` address on the public internet, and clients without a back-channel logout URI. Affected: a relying party reached on an internal network (a container network name, a private subnet, `localhost`) or over plain HTTP. From 4.8.0 the server checks every `backchannel_logout_uri` by default, with the same outbound rules as client keys and request objects: when it is registered through the management API or dynamic registration (refused with `validation_error` or `invalid_client_metadata`), and before every logout notification, also for clients registered by an earlier version. A refused notification is skipped and logged once per relying party and logout as `Backchannel logout to {client_id} refused: {reason}.`; the user's logout completes as before. Action, when such relying parties are expected: set the options for the cases you have, on every node. ```json "Identity": { "BackchannelLogout": { "AllowPrivateNetworkTargets": true, "RequireHttps": false } } ``` With dynamic registration open (no `Identity:DynamicRegistrationInitialAccessToken`), allowing private targets lets any registrant choose such an address; set an initial access token in that case. 4.7.8 has the same two options with open defaults (`RequireHttps=false`, `AllowPrivateNetworkTargets=true`); a deployment that set them there keeps its behaviour, and 4.8.0 makes the strict values the defaults. ### request_uri needs registered addresses Not affected: a server with JAR off (`Features.EnableJar=false`, the default), clients that send the request object inline as `request`, and PAR (`urn:ietf:params:oauth:request_uri:` values). Nothing changes for them. Affected: a server with JAR on whose clients pass the request object by reference, as `request_uri`. From 4.8.0 the address is fetched only when it equals one of the client's registered `request_uris` (OIDC Dynamic Client Registration 1.0 §2), compared exactly: the whole value, query and fragment included. Any other address is answered `invalid_request_uri` and is never contacted. Discovery publishes `require_request_uri_registration: true`. Action, either of the two: 1. Register each client's addresses before or right after the upgrade, through the management API, the console (application, Protocol tab, "Request URIs") or, for a client that registered itself, its RFC 7592 update: ```http PUT /api/v1/identity/applications/{id} Content-Type: application/json { "requestUris": ["https://client.example.com/requests/authorize.jwt"] } ``` 2. Or move with `Identity:Jar:RequireRequestUriRegistration=false`. A client without registered addresses then keeps working as before, and every such request is logged as a warning naming its `client_id`. Register the clients the log names, then remove the setting. A client that has registered addresses is held to them either way. ### Webhook deliveries go through the outbox Webhook deliveries are no longer sent from memory but written to `identity_delivery_outbox` (created at start) and sent by the delivery worker, so they survive a restart. No setting has to change; the `Identity:Delivery` section tunes the worker, and its defaults are listed in the README, "Webhook delivery". What a receiver sees: 1. A delivery may arrive more than once: every attempt of one delivery carries the same `X-RedbIdentity-Delivery` id, and the body carries the event's `eventId`. Deduplicate by either. 2. Two events may arrive in either order. Order by the event's `timestamp`, not by arrival. 3. Events arrive up to `Identity:Delivery:PollInterval` (default 2 s) later than before. 4. At most `Identity:Delivery:MaxParallelPerDestination` (default 2) deliveries to one subscriber are in flight at once, and a delivery to a subscription that was deleted or disabled in the meantime is not sent. ### Bounded client key cache The fetched key sets of `jwks_uri` addresses are now kept for at most `Identity:ClientKeys:MaxCachedKeySets` addresses (default 256; before, there was no bound). An address dropped from the cache is fetched again when it is needed next. Raise the value only when more than 256 clients authenticate with keys at their `jwks_uri`. ### A jwks_uri registered through dynamic registration before 4.8.0 Before 4.8.0, dynamic registration did not store a `jwks_uri`: 4.7.7 and earlier echoed it in the answer, 4.7.8 leaves it out. From 4.8.0 it is stored and used: the keys at a `private_key_jwt` client's `jwks_uri` verify its client assertions. Action: a client that registered a `jwks_uri` before 4.8.0 and wants to use it sends it again in a registration update (`PUT /connect/register/{client_id}` with its registration access token). A request that carries both `jwks` and `jwks_uri` is refused with `invalid_client_metadata`. ## 4.7.5 ### Idempotency records keep no secrets An answer that carries a secret shown once is no longer kept in the `Idempotency-Key` cache: webhook create and rotate-secret, client secret rotation, MFA enrollment and recovery codes. A repeat with the same key is not carried out again and answers `{"replayed":true,"secretWithheld":true,...}` with the status of the first answer. A client that lost the first answer rotates the secret again. Dynamic client registration (`/connect/register`) no longer takes part in the cache: a repeated registration registers another client. Records stored by an earlier version keep the full answer, secret included, and earlier versions never deleted expired records. After the upgrade the cleanup (`identity-idempotency-cleanup`, hourly) deletes every expired record at its first run. A record still inside its time to live (`Identity:Idempotency:Ttl`, 24 hours by default) that was stored with a secret replays it to a repeat with its key until it expires, and goes at the next run after. Action: none is required. To have the records of these operations gone at once, delete them right after the upgrade; a repeat of such a request in the following 24 hours then runs the operation again. The same statements work on PostgreSQL, SQL Server and SQLite (in `sqlcmd`, run `SET QUOTED_IDENTIFIER ON;` first): ```sql DELETE FROM _values WHERE _id_object IN ( SELECT o._id FROM _objects o JOIN _schemes s ON s._id = o._id_scheme WHERE s._name = 'redb.Identity.Core.Models.IdempotencyRecordProps' AND (o._name LIKE 'idem:manage-webhooks:%' OR o._name LIKE 'idem:manage-apps:%' OR o._name LIKE 'idem:mfa-manage:%' OR o._name LIKE 'idem:dynamic-register:%')); DELETE FROM _objects WHERE _id_scheme = (SELECT _id FROM _schemes WHERE _name = 'redb.Identity.Core.Models.IdempotencyRecordProps') AND (_name LIKE 'idem:manage-webhooks:%' OR _name LIKE 'idem:manage-apps:%' OR _name LIKE 'idem:mfa-manage:%' OR _name LIKE 'idem:dynamic-register:%'); ``` Nothing else changes: the other records keep replaying whole. ## 4.7.4 ### Dynamic client registration: check the initial access token A `DynamicRegistrationInitialAccessToken` that is empty or whitespace now counts as not configured: registration is open and an anonymous registrant is refused the administrative scopes. Decide which of the two you want and set it explicitly. With the images, environment variables do it without rebuilding: - registration off: Tsak__Contexts__identity.core__Override__Identity__Features__EnableDynamicRegistration=false Tsak__Contexts__identity.http__Override__IdentityTransport__Features__EnableDynamicRegistration=false - registration only with a token the deployment issued (a long random value): Tsak__Contexts__identity.core__Override__Identity__DynamicRegistrationInitialAccessToken= Then review the registered applications for `client_credentials` clients nobody created on purpose. ### Image defaults from 4.7.4 The images and archives start with dynamic client registration off. To turn it on, set both switches and give it an initial access token (a long random value), so that registration is not open: Tsak__Contexts__identity.core__Override__Identity__Features__EnableDynamicRegistration=true Tsak__Contexts__identity.http__Override__IdentityTransport__Features__EnableDynamicRegistration=true Tsak__Contexts__identity.core__Override__Identity__DynamicRegistrationInitialAccessToken= A JAR `request_uri` is fetched only over https and not from private network addresses. For a client that hosts its request objects over http or on a private address: Tsak__Contexts__identity.core__Override__Identity__Jar__RequestUriAllowPrivateNetworkTargets=true Tsak__Contexts__identity.core__Override__Identity__Jar__RequestUriRequireHttps=false ## 4.6.2 ### DPoP-bound access tokens at userinfo and the management API This applies only when DPoP is enabled (`Dpop.Enabled = true`; it is off by default). Security fix, see [GHSA-vmj2-8phj-mfxf](https://github.com/redbase-app/redb-identity/security/advisories/GHSA-vmj2-8phj-mfxf). An access token bound to a DPoP key (its `cnf` claim holds `jkt`, RFC 9449) is now accepted at `/connect/userinfo` and at the management and self-service API (`/api/v1/identity/...`, SCIM) only when the request carries: - `Authorization: DPoP `, not `Bearer`; - a `DPoP` header with a fresh proof signed by the bound key, whose `htm` and `htu` match the request and whose `ath` is the base64url SHA-256 of the access token, inside the `Dpop.IatToleranceSeconds` window, never reused. Otherwise the answer is 401 `invalid_token` with `WWW-Authenticate: DPoP error="invalid_token", ...`. An access token without `jkt` sent under the `DPoP` scheme is refused the same way. Plain Bearer tokens and certificate-bound tokens (`x5t#S256`) work as before. What to do: 1. Clients that obtain DPoP-bound tokens and call userinfo or the management API: send the `DPoP` scheme and a proof with `ath` on every such call. Clients that already do this need no change. 2. The gRPC and SOAP management surfaces cannot carry a DPoP proof, so a DPoP-bound token is refused there. Use a Bearer token (a token request without a `DPoP` header) for those calls, or call the HTTP management API. 3. `Dpop.RequireNonce` still applies to the token endpoint only. ## 4.5.0 ### Role scopes only when the client asks for them A scope attached to a role is no longer added to the user's tokens on its own. A token carries the scopes the client requested, which OpenIddict checks against the client's `scp:` permissions; for a scope that `AdminScopeEntitlement` gates (`identity:*`, `scim`, and whatever `GatedScopes` lists) the user's roles then decide whether it stays. The role is the entitlement, the request is still needed. Up to 4.4.2 every scope of the user's roles went into every token of that user, for any client and without the client's permission being checked. An administrator signing in to any application handed it a token with `identity:manage` and Identity's own audience, which the management API accepted. Who notices: a client that relied on receiving a role's scope without asking for it. Add the scope to the client's request (`scope=` of the authorization or token request) and make sure the client has the `scp:` permission for it. The Identity Web console, the `redb-identity-app` template and the Tsak dashboard are not affected: the first two request their scopes explicitly, the dashboard does not sign in through Identity. Tokens issued before the upgrade keep their scopes until they expire; a refresh issues the new set. A scope that only a role should open, for example an application's administrative scope, must be listed in `Identity:AdminScopeEntitlement:GatedScopes`; otherwise the client's permission alone decides, for every user. ## 4.4 ### OpenIddict 7 redb.Identity runs on OpenIddict 7.7 (was 6.3), with Microsoft.Extensions and ASP.NET Core 10.0.13, Microsoft.IdentityModel 8.23.0 and DataProtection 10.0.13 on every target framework. **Existing sessions survive the upgrade.** Access and refresh tokens issued by 6.3 keep validating: their JWT `typ` header is unchanged, and stored token rows keep their short type (`refresh_token`), which OpenIddict 7 maps on read. New rows store the URI form (`urn:ietf:params:oauth:token-type:refresh_token`); the token management API filter accepts either spelling and matches both. A tool of your own that reads the token store directly has to accept both. **Token exchange (RFC 8693)** runs on OpenIddict's built-in grant. Subject, actor and requested token types stay limited to access tokens. When the subject (or actor) token is bound to both audiences and a presenter, the calling client must be one of them: a token minted for client A can no longer be exchanged by an unrelated client B. A subject or actor token of a disabled or deleted user is rejected with `invalid_grant`. The response carries `issued_token_type`. An `audience` parameter is validated by OpenIddict and rejected unless registered. Check that the clients which exchange tokens are the ones the tokens were issued to. ### Client assertions (private_key_jwt, client_secret_jwt) OpenIddict 7 implements the client assertion rules of draft-ietf-oauth-rfc7523bis, which close a vulnerability of `private_key_jwt`, and offers no way back. A client that authenticates with a JWT assertion must now send: - `typ` header `client-authentication+jwt` (a plain `JWT` is rejected with `invalid_client`, "The specified token is not of the expected type"); - `aud` equal to the issuer (`issuer` of the discovery document), for every endpoint: the token endpoint URL, or the URL of the introspection or revocation endpoint, is no longer accepted. Clients built on OpenIddict 7 do this already. Update the others before upgrading the server; clients that use `client_secret_basic` or `client_secret_post` are not affected. ### DPoP-bound access tokens at third-party resource servers DPoP-bound access tokens carry `cnf.jkt` (RFC 9449). OpenIddict 7's own validation checks `cnf` and knows only the certificate-bound form (`x5t#S256`, RFC 8705): it fails with an internal error (ID2196) on a `jkt`. Identity itself handles this; a resource server of your own that validates Identity's tokens with OpenIddict.Validation 7 needs the same treatment (set `DisableProofOfPossessionValidation` for tokens whose `cnf` holds only `jkt`, and check the DPoP proof itself, for example with `redb.Identity.Resource.Dpop`). ### resource parameter `resource` (RFC 8707) is validated on `/connect/authorize`, `/connect/par` and token exchange; OpenIddict 6 ignored it. A `resource` must be an absolute URI without a fragment, must be listed in the `Resources` of at least one scope (`invalid_target` otherwise), and the client needs the `rsrc:` permission. Before upgrading, list in the scopes every resource your clients send, and grant those clients the matching `rsrc:` permission; a client that sends no `resource` is not affected. ### DataProtection key ring **What was wrong.** Up to 4.3 the server's DataProtection key ring was meant to live in redb (`DataProtectionKeyProps`) but did not: the repository was registered in DI only, and ASP.NET Core ignored it and kept the ring in the default directory of the process user (`/root/.aspnet/DataProtection-Keys` in the Docker images, `%LOCALAPPDATA%\ASP.NET\DataProtection-Keys` on Windows). Everything Identity protects with that ring, the signing and encryption keys of tokens in redb, TOTP secrets, client secrets of federation providers, session and federation state cookies, depended on that directory. A container recreated without it could not decrypt its signing keys and the server did not start (`failed to decrypt signing key`, then `At least one encryption key must be registered`). Each node of a cluster had a ring of its own. **What 4.4 does.** The ring lives in redb. The first start of 4.4 on a database records the moment the ring moved (redb scheme `identity.dp_key_import`). On every start, before the first request, Identity imports into redb the keys of the old file ring that were created before that moment and that redb does not hold yet: the default directory above, plus `Identity:DataProtection:ImportKeysFromPath` when the old ring was somewhere else. The log shows a warning with the number of keys and the directory. Keys already in redb are skipped, so the next start imports nothing; the files are left in place and are no longer read or written. Encrypted keys are copied as they are and stay encrypted. The import reads only a ring that still exists when 4.4 starts. If the 4.3 ring lived only inside the container (no volume on `/root/.aspnet/DataProtection-Keys`), copy it out before the container is replaced (`docker cp :/root/.aspnet/DataProtection-Keys ./dp-keys-4.3`), mount the copy into the 4.4 container and point `Identity:DataProtection:ImportKeysFromPath` at it for the first start. After the move the Identity server needs no file ring; the `managed` and `full` compose files keep a named volume `dp_keys` there for the Tsak worker and dashboard. Keys of those programs present before the move are imported too and are unused; later ones are not. **Clusters.** Nodes that each kept their own file ring each add theirs on their first start of 4.4 (their keys predate the move): the ring in redb becomes the union, every node reads every node's data, and new keys are shared from then on. Two nodes importing the same key at once leave two rows for it, which is handled (one key per id is loaded). Data a node protected before 4.4 stays readable only if that node starts 4.4 with its old ring present. **If a container was already recreated without the old ring.** The keys are gone and the data protected with them cannot be decrypted. Recover as follows: 1. Stop the server. Delete the objects of the redb scheme `redb.Identity.Core.Models.SigningKeyProps` (alias `identity.signing_key`). On the next start Identity creates new signing and encryption keys. Every issued token becomes invalid: users sign in again, clients request new tokens. (With the server running, `POST /api/v1/identity/signing-keys/rotate` replaces keys, but a server that cannot decrypt any key does not start.) 2. Users with TOTP cannot pass the TOTP check: an administrator removes it with `DELETE /api/v1/identity/mfa/totp/{userId}` and the user enrols again. Recovery codes, WebAuthn and SMS or e-mail codes are not affected. 3. Enter the client secrets of federation providers again (management API, federation providers). Path: redb-identity/context.sample.json Snapshot: redb-identity, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/context.sample.json ---- { "//": [ "redb.Identity — UNIFIED external context.json (Tsak Layer 3).", "", "PER-CONTEXT format (introduced together with TsakCoordinator support for", "'Contexts:' root section): every key is scoped to a specific context (or the", "shared 'default' bucket). Mirrors the host-appsettings shape exactly:", " Tsak:Contexts:default ↔ Contexts.default", " Tsak:Contexts:{ctxName} ↔ Contexts.{ctxName}", "", "Devops single source of truth for both .tpkg modules:", " - redb.Identity.Core.Module.tpkg (context 'identity.core')", " - redb.Identity.Http.tpkg (context 'identity.http')", "", "DEPLOY: copy this file into the same Libs/ folder as the .tpkg files.", "TsakCoordinator.LoadModuleConfigFiles parses {Libs}/context.json once per module:", " 1. merge Contexts.default (shared by every context),", " 2. merge Contexts.{moduleContextName} on top (context-specific overrides win).", "Sections for OTHER contexts are simply ignored when loading a given module.", "", "LEGACY-FALLBACK: if 'Contexts:' is absent, all root keys are merged flat for", "every module (old behaviour) — keeps existing context.json files working.", "", "5-LAYER PIPELINE:", " L1 host appsettings: Tsak:Contexts:default:*", " L2 host appsettings: Tsak:Contexts:{ctxName}:*", " L3 THIS file: Contexts.default + Contexts.{ctxName}", " L4 in-tpkg stub: ContextName + AutoStart only (module identity)", " L5 Override (wins): Tsak:Contexts:{ctxName}:Override:*", "", "Environment-variable overrides (.NET IConfiguration mapping):", " Tsak__Contexts__identity.core__Override__Identity__AccessTokenLifetime=01:00:00", " Tsak__Contexts__identity.core__Override__Identity__RateLimit__Enabled=true", " Tsak__Contexts__identity.http__Override__IdentityTransport__Http__PublicPort=5002", "", "SECRETS — never commit real secrets to this file. Supply via L5 Override:", " Identity:RecoveryCodePepper (base64 random)", " Identity:SeedBackchannelClient:ClientSecret (base64 random; SAME value also set as Identity__BackchannelClient__ClientSecret on the Web BFF)", " Identity:DynamicRegistrationInitialAccessToken (bearer token)", " Identity:FederationProviders[i]:ClientSecret (per provider)", " Identity:Ldap:Providers[i]:BindPassword (per provider)", " Identity:RateLimit:RedisConnectionString (if Redis backend)", " Identity:FederationState:RedisConnectionString (if Redis backend)", " Redb:{instance}:ConnectionString (DB credentials)", "", "LOGGING — log-level overrides DO NOT belong in this file. Serilog is wired in", "redb.Tsak.Worker/Program.cs via UseSerilog(.ReadFrom.Configuration(...)) and reads", "from the ROOT 'Serilog:*' section of the host configuration. TsakCoordinator merges", "context.json only into the per-context bucket 'Tsak:Contexts:{ctxName}:*' (which", "then binds the module Options classes), so anything written here under a 'Serilog'", "key — or as an L5 Override env-var like Tsak__Contexts__identity.core__Override__Serilog__... —", "lands in a namespace Serilog doesn't read. Identity-stack noise (OpenIddict per-", "request INF, etc.) is silenced in:", " redb.Tsak/src/redb.Tsak.Worker/appsettings.json -> Serilog:MinimumLevel:Override", "Or as an env-var directly on the root key:", " Serilog__MinimumLevel__Override__OpenIddict=Warning" ], "Contexts": { "//default": [ "Shared bucket: keys here are merged into EVERY context loaded from this folder.", "Use only for things that genuinely need to be the same across contexts:", " • Redb named instances (DataProtection key-ring lives in this DB — must match).", " • RedbInstanceName (HTTP facade reads it as a top-level property)." ], "default": { "Redb": { "identity-pg": { "Provider": "postgres", "UsePro": true, "PropsSaveStrategy": "ChangeTracking", "ConnectionString": "Host=localhost;Port=5432;Username=postgres;Password=;Database=redb;Pooling=true;Include Error Detail=true;Options=-c jit=off", "EnsureCreated": true }, "identity-mssql": { "Provider": "mssql", "UsePro": true, "PropsSaveStrategy": "ChangeTracking", "ConnectionString": "Server=127.0.0.1,1433;Database=redb;User Id=sa;Password=;TrustServerCertificate=true;Command Timeout=600;", "EnsureCreated": true }, "identity-sqlite": { "//": "SQLite mirror — toggle 'RedbInstanceName' below to switch the whole Identity stack to SQLite. EnsureCreated bootstraps the schema on first run. Pro tier so PropsSaveStrategy=ChangeTracking works.", "Provider": "sqlite", "UsePro": true, "PropsSaveStrategy": "ChangeTracking", "ConnectionString": "Data Source=identity-redb.db;Mode=ReadWriteCreate", "EnsureCreated": true } }, "//RedbInstanceName": "Switch this between 'identity-pg' and 'identity-sqlite' to flip the entire Identity stack between providers. The Identity:RedbInstanceName under identity.core defaults to the same name.", "RedbInstanceName": "identity-sqlite" }, "//identity.core": [ "Read by IdentityModuleConfigBinder.Bind → RedbIdentityOptions.", "Identity:* keys live here. The HTTP facade (identity.http) ignores this section." ], "identity.contracts": { "//": [ "The contracts CARRIER (redb.Identity.Contracts.tpkg) - an empty module whose payload is", "redb.Identity.Contracts.dll, the one process-wide instance of the DTO assembly all Identity", "modules resolve against. It has NO settings: this section exists so the operator's single", "source of truth lists every Identity context. Deployment rule: redeploy this package only", "when the contracts change, and then redeploy every Identity module after it - a contract", "change requires that in any architecture. Reloading core/facades alone never touches it." ] }, "identity.core": { "Identity": { "//RedbInstanceName": "Must match Contexts.default.RedbInstanceName above. Flip between 'identity-pg' and 'identity-sqlite' (or any other instance you register in Contexts.default.Redb) to switch the whole Identity stack between providers.", "RedbInstanceName": "identity-sqlite", "Issuer": "https://host.docker.internal:5002", "//IssuerNote": "MUST match redb.Identity.Web appsettings.json -> Identity:Authority / Identity:ApiBaseUrl and the Issuer claim emitted in id_token. PROD: front with a TLS-terminating reverse proxy and set Issuer to the public https URL.", "//RequirePkce": "Mandatory PKCE (OAuth 2.1) is the in-code default (true). Set false to ALSO accept plain authorization_code without a code_challenge — required to certify the OpenID 'Basic OP' profile, whose non-PKCE tests expect the OP to accept such requests. PKCE, when sent, is still S256-only. PROD: leave true (or omit).", "RequirePkce": false, "AllowEphemeralKeys": false, "//UsePropsSigningKeyStore": [ "When true, signing keys are persisted in the props store (DataProtection-encrypted)", "and the JWKS endpoint serves them live from the store on every request —", "admin /signing-keys/rotate + /retire reflect in the JWKS immediately without", "process restart. Required for the demo_jwks_rotation probe.", "Caveat: OpenIddict still picks the signing credential for NEW tokens from its", "frozen options.SigningCredentials list, populated at startup. After admin rotate,", "new tokens continue using the OLD kid until the OpenIddict cache refreshes", "(process restart, or a future IOptionsMonitor wiring — separate batch).", "Dev relaxes DataProtection.RequireAtRestEncryption because no MasterKey is", "configured locally — production deployments MUST configure one of:", "DataProtection.MasterKey (32-byte base64), .Certificate.Thumbprint,", ".Certificate.PfxPath, or .CustomEncryptorFactory." ], "UsePropsSigningKeyStore": true, "DataProtection": { "RequireAtRestEncryption": false }, "AccessTokenLifetime": "01:00:00", "RefreshTokenLifetime": "14.00:00:00", "RefreshTokenReuseLeeway": "00:00:00", "AuthorizationCodeLifetime": "00:05:00", "IdentityTokenLifetime": "00:05:00", "DisableAccessTokenEncryption": false, "TokenThrottleMaxPerPeriod": 10, "TokenThrottlePeriod": "00:00:01", "//DynamicRegistrationThrottle": [ "DCR rate-limit (per remote IP). The in-code default of 5 per 10 s now ships with", "RFC 6585 semantics (the throttle was switched to .RejectOnOverflow() — overflow", "returns 429 + Retry-After instead of silently semaphore-waiting). Dev still bumps", "the budget so the run_all suite, which DCRs many clients back-to-back from the", "same loopback IP, doesn't trip the rate limit during normal development. A", "dedicated demo (demo_throttle_rfc6585) exercises the 429 contract.", "Production should KEEP the in-code default 5/10 s (or tighter) for security." ], "DynamicRegistrationThrottleMaxPerPeriod": 100, "DynamicRegistrationThrottlePeriod": "00:00:01", "TokenRetentionDays": 30, "TokenCleanupInterval": "01:00:00", "TokenCleanupBatchSize": 50, "SessionRetentionDays": 14, "SessionCleanupInterval": "01:00:00", "SessionCookieLifetime": "08:00:00", "ManagementScope": "identity:manage", "AccountScope": "identity:account", "//Features": [ "Single source of truth for module-level on/off toggles. Both Core (DI / direct-vm)", "and Http (HTTP endpoint mounting) read this same section — one declaration", "drives both modules. Toggle here, never in IdentityTransport:Features below." ], "Features": { "EnableScim": true, "EnableScimBulk": true, "EnableFederation": true, "EnableDynamicRegistration": true, "EnablePushedAuthorization": true, "EnableDeviceCodeFlow": true, "EnableJar": true }, "Jar": { "//": "Dev/conformance only: the request_uri is fetched from the suite or a demo HTTP listener on loopback, so private targets and plain http are allowed. PROD: remove this section (defaults refuse both).", "RequestUriAllowPrivateNetworkTargets": true, "RequestUriRequireHttps": false }, "BackchannelLogout": { "//": "Dev/demo only: demo_backchannel_logout registers a receiver on a loopback HTTP listener, so private targets and plain http are allowed. PROD: remove this section (defaults require https to a public address).", "AllowPrivateNetworkTargets": true, "RequireHttps": false }, "DynamicRegistrationAllowedGrantTypes": [ "authorization_code", "refresh_token", "password", "client_credentials", "urn:ietf:params:oauth:grant-type:device_code", "urn:ietf:params:oauth:grant-type:token-exchange" ], "//DynamicRegistrationAllowedScopesSecurity": [ "Widened to include every granular identity:: scope so the included", "demo suite can probe each admin surface independently.", "This list alone no longer opens anything: an administrative scope is refused unless the", "registration is authenticated (DynamicRegistrationInitialAccessToken, set below), and", "that rule lives in code — the list can widen policy for authenticated registrations, not", "hand administration to an anonymous caller. Which scopes count as administrative is", "Identity:AdminScopeEntitlement.", "Production hosts that do not register administrative clients dynamically should trim this", "list back to the user-info scopes (openid, profile, email, phone, address,", "offline_access, groups, roles, identity:account) and leave the token null.", "'identity:manage' (master) and 'identity:impersonate' remain excluded by default —", "those carry the highest blast radius (full admin / act-as-another-user)." ], "DynamicRegistrationAllowedScopes": [ "openid", "profile", "email", "phone", "address", "offline_access", "groups", "roles", "identity:account", "identity:read", "identity:users:read", "identity:users:write", "identity:groups:read", "identity:groups:write", "identity:consents:read", "identity:consents:write", "identity:mfa:read", "identity:mfa:write", "identity:applications:read", "identity:applications:write", "identity:scopes:read", "identity:scopes:write", "identity:roles:read", "identity:roles:write", "identity:claims:read", "identity:claims:write", "identity:federation:read", "identity:federation:write", "identity:webhooks:read", "identity:webhooks:write", "identity:signing-keys:read", "identity:signing-keys:write", "identity:sessions:read", "identity:sessions:write", "identity:tokens:read", "identity:tokens:write", "identity:audit:read", "scim" ], "//DynamicRegistrationInitialAccessToken": [ "RFC 7591 §1.2 protected registration. Two modes, and the difference is the whole point:", " set — POST /connect/register requires this bearer for every registration, and the", " allow-list below governs what those authenticated registrations may ask for;", " null — registration is open, and an open registration can never obtain an", " administrative scope, whatever the allow-list says. That floor is in code", " (DynamicRegistrationProcessor), so no configuration mistake can hand", " administration to an anonymous caller.", "The value below is a DEV CREDENTIAL, shipped for the same reason the seeded admin", "password and the dev pepper above are: the demo suite registers clients carrying granular", "admin scopes, and this is what authorises it. It is as public as this file.", "PRODUCTION: rotate it (or set it to null and trim DynamicRegistrationAllowedScopes to the", "user-info scopes). Generate: [Convert]::ToBase64String((1..32 | %{Get-Random -Max 256})).", "Supply via L5 Override env-var:", " Tsak__Contexts__identity.core__Override__Identity__DynamicRegistrationInitialAccessToken=" ], "DynamicRegistrationInitialAccessToken": "dev-only-initial-access-token-not-for-production", "DeviceCodeLifetime": "00:10:00", "DeviceCodePollingInterval": 5, "RequirePushedAuthorizationRequests": false, "PushedAuthorizationRequestLifetime": "00:01:30", "Dpop": { "Enabled": true, "RequireForAccessTokens": false, "AllowedSigningAlgorithms": [ "ES256", "ES384", "PS256", "RS256" ], "IatToleranceSeconds": 60, "RequireNonce": false, "ReplayStore": { "Backend": "memory", "MemorySweepInterval": "00:01:00" } }, "//WebAuthn": [ "MFA-3 (FIDO2 / Passkeys). When Enabled=true the self-service /me/webauthn route", "and the MFA assert route are exposed. RpId and Origins are CRYPTO-BOUND to every", "registered credential \u2014 changing them after registrations breaks all keys.", "Dev defaults below match the BFF on https://localhost:7000." ], "WebAuthn": { "Enabled": true, "RpId": "localhost", "RpName": "redb.Identity (dev)", "Origins": [ "https://localhost:7000", "http://localhost:5000" ], "TimeoutMs": 60000, "ChallengeTtlSeconds": 300, "UserVerification": "preferred", "Attestation": "none", "UseFidoMetadataService": false, "AaguidBlocklist": null, "ChallengeCleanupInterval": "01:00:00" }, "Ldap": { "//": [ "Variant B integration — opt-in. When Enabled=true, each entry in Providers[]", "is registered as an IExternalUserProvider in the Identity child SP.", "BindPassword is a SECRET — supply via L5 Override:", " Tsak__Contexts__identity.core__Override__Identity__Ldap__Providers__0__BindPassword=", "Presets: OpenLDAP (UserFilter '(uid={0})') | ActiveDirectory ('(&(objectClass=user)(sAMAccountName={0}))').", "Multiple providers tried in Priority order (lower = first). Domains[] routes", "user@example.com / EXAMPLE\\user to a specific provider." ], "Enabled": false, "Providers": [ { "//": "OpenLDAP example — REMOVE or REPLACE before enabling.", "ProviderName": "ldap-corp", "Priority": 100, "Server": "REPLACE_ME.example.com", "Port": 389, "UseSsl": false, "UseStartTls": true, "SkipCertificateValidation": false, "BindDn": "cn=svc-identity,ou=service-accounts,dc=example,dc=com", "BindPassword": null, "OperationTimeoutSeconds": 10, "ConnectTimeoutSeconds": 10, "MaxConnections": 5, "UserBaseDn": "ou=users,dc=example,dc=com", "UserFilter": "(uid={0})", "SearchScope": "Subtree", "Domains": [ "example.com" ], "CheckAccountStatus": false, "AttributeMap": { "externalId": "uid", "displayName": "cn", "email": "mail", "phone": "telephoneNumber", "givenName": "givenName", "familyName": "sn" }, "AdditionalClaimsMap": { "department": "departmentNumber", "title": "title" } }, { "//": "Active Directory (LDAPS) example — REMOVE or REPLACE before enabling. CheckAccountStatus reads userAccountControl bits.", "ProviderName": "ad-internal", "Priority": 200, "Server": "dc01.corp.local", "Port": 636, "UseSsl": true, "UseStartTls": false, "SkipCertificateValidation": false, "BindDn": "CN=svc-identity,OU=Service Accounts,DC=corp,DC=local", "BindPassword": null, "OperationTimeoutSeconds": 10, "ConnectTimeoutSeconds": 10, "MaxConnections": 5, "UserBaseDn": "OU=Users,DC=corp,DC=local", "UserFilter": "(&(objectClass=user)(sAMAccountName={0}))", "SearchScope": "Subtree", "Domains": [ "corp.local", "CORP" ], "CheckAccountStatus": true, "AttributeMap": { "externalId": "sAMAccountName", "displayName": "displayName", "email": "mail", "phone": "telephoneNumber", "givenName": "givenName", "familyName": "sn" }, "AdditionalClaimsMap": { "department": "department", "title": "title", "upn": "userPrincipalName" } } ] }, "EnablePasswordFlow": true, "EnableTokenExchange": true, "TokenExchangeAllowImpersonation": false, "TokenExchangeMaxDelegationDepth": 5, "LoginPath": "/login", "ConsentPath": "/consent", "MfaPath": "/mfa", "MfaRecoveryPath": "/mfa/recovery", "OtpCooldown": "00:01:00", "OtpMaxPerHour": 5, "MfaLockoutClockSkew": "00:00:05", "//RecoveryCodePepper": [ "SECRET. Generate (PowerShell): [Convert]::ToBase64String((1..32 | %{Get-Random -Max 256})).", "Supply via L5 Override env-var in production. NULL = MFA recovery codes disabled.", "Dev ships a fixed value because AllowEphemeralKeys=false is required for the props", "signing-key store (see UsePropsSigningKeyStore above), and with ephemeral disabled the", "in-code fallback path that generates a random pepper at startup is also disabled." ], "RecoveryCodePepper": "", "RecoveryCodePbkdf2Iterations": 600000, "//SeedBackchannelClient": [ "W6-0 — idempotent client_credentials service account used by the Web BFF", "to push/poll /api/v1/identity/revoked-sids (backchannel logout blacklist).", "Enabled=true: SeedBackchannelClientHostedService creates the OpenIddict", "application on startup if missing. ClientSecret is a SECRET — supply via", "L5 Override env-var (same value must be set for the Web BFF):", " Tsak__Contexts__identity.core__Override__Identity__SeedBackchannelClient__ClientSecret=", " Identity__BackchannelClient__ClientSecret= (set on the BFF process)", "Helper script: redb.Identity/scripts/dev-backchannel-secret.ps1 generates one secret and sets both env-vars.", "When ClientSecret is empty the seeder logs a warning and skips (a confidential client cannot be registered without a secret per RFC 6749 §4.4)." ], "SeedBackchannelClient": { "Enabled": true, "ClientId": "identity-backchannel", "ClientSecret": null, "DisplayName": "Identity Backchannel Service Account", "Scopes": [ "identity:manage" ] }, "LoginTitle": "Sign In", "LogoUrl": null, "PrimaryColor": "#2563eb", "PrimaryColorHover": "#1d4ed8", "CustomCss": null, "ScimScope": "scim", "//FederationProviders": [ "Each entry is registered as an upstream OIDC IdP (login button on /login).", "ClientSecret is a SECRET — supply via L5 Override:", " Tsak__Contexts__identity.core__Override__Identity__FederationProviders__0__ClientSecret=", "AutoProvision=true creates redb users on first successful login. Priority orders the buttons (lower = first)." ], "FederationProviders": [ { "//": "Google OIDC — REMOVE or REPLACE before enabling.", "ProviderId": "google", "DisplayName": "Google", "Authority": "https://accounts.google.com", "ClientId": "REPLACE_ME", "ClientSecret": "", "Scopes": [ "openid", "profile", "email" ], "AutoProvision": true, "Priority": 100 }, { "//": "Microsoft Entra ID (Azure AD) — multi-tenant. For single-tenant use https://login.microsoftonline.com//v2.0.", "ProviderId": "microsoft", "DisplayName": "Microsoft", "Authority": "https://login.microsoftonline.com/common/v2.0", "ClientId": "REPLACE_ME", "ClientSecret": "", "Scopes": [ "openid", "profile", "email" ], "AutoProvision": true, "Priority": 200 }, { "//": "Keycloak — replace {host}/{realm}. Self-hosted IdP, useful for testing or B2B federation.", "ProviderId": "keycloak", "DisplayName": "Keycloak", "Authority": "https://REPLACE_ME.example.com/realms/REPLACE_ME", "ClientId": "REPLACE_ME", "ClientSecret": "", "Scopes": [ "openid", "profile", "email" ], "AutoProvision": true, "Priority": 300 }, { "//": "GitHub OAuth2 (NOT full OIDC — userinfo via /user). Authority points at the OIDC bridge endpoint.", "ProviderId": "github", "DisplayName": "GitHub", "Authority": "https://github.com", "ClientId": "REPLACE_ME", "ClientSecret": "", "Scopes": [ "read:user", "user:email" ], "AutoProvision": true, "Priority": 400 }, { "//": "Mock OIDC IdP for demo_federation_e2e. Points at navikt/mock-oauth2-server running on the dev rinat-net docker network. Accepts any clientId/clientSecret. REMOVE for production deployments.", "ProviderId": "mock-idp-e2e", "DisplayName": "Mock IdP (e2e)", "Authority": "http://127.0.0.1:9199/default", "ClientId": "fed-e2e-client", "ClientSecret": "", "Scopes": [ "openid", "profile", "email" ], "AutoProvision": true, "Priority": 999 }, { "//": "Mock GitHub OAuth2 IdP for demo_federation_github. The demo itself starts a tiny pwsh HttpListener on port 9201 that emulates github.com's /login/oauth/authorize + /login/oauth/access_token + api.github.com's /user + /user/emails. REMOVE for production.", "ProviderId": "mock-github-e2e", "Kind": "github", "DisplayName": "Mock GitHub (e2e)", "Authority": "http://127.0.0.1:9201", "ClientId": "gh-e2e-client", "ClientSecret": "", "Scopes": [ "read:user", "user:email" ], "AutoProvision": true, "Priority": 1000, "Endpoints": { "AuthorizeEndpoint": "http://127.0.0.1:9201/login/oauth/authorize", "TokenEndpoint": "http://127.0.0.1:9201/login/oauth/access_token", "UserEndpoint": "http://127.0.0.1:9201/user", "EmailsEndpoint": "http://127.0.0.1:9201/user/emails" } } ], "ReverseProxies": { "//": [ "Secure-by-default: TrustForwardedFor=false ignores X-Forwarded-For.", "Enable ONLY when behind a trusted proxy listed below.", " KnownProxies — exact IPv4/IPv6 of trusted proxies, e.g. ['10.0.0.1','203.0.113.7']", " KnownNetworks — CIDR ranges, e.g. ['10.0.0.0/8','192.168.0.0/16','fd00::/8']" ], "TrustForwardedFor": false, "KnownProxies": [], "KnownNetworks": [] }, "RateLimit": { "//": [ "C1: per-IP and per-(IP+username) throttling on /connect/token and /login.", "Backend 'memory' = per-process (single-node only — counters are NOT shared).", "Backend 'redis' = cluster-wide. REQUIRED behind multiple instances or LB.", "Redis examples (supply via L5 Override — connection string is a SECRET):", " single : redis://localhost:6379,abortConnect=false", " pwd+db : redis://:password@redis.internal:6379,defaultDatabase=2,abortConnect=false", " cluster : redis-1:6379,redis-2:6379,redis-3:6379,password=", " sentinel: redis-sent-1:26379,redis-sent-2:26379,serviceName=mymaster" ], "Enabled": false, "PerIpPerMinute": 30, "PerIpUsernameFailures": 5, "PerIpUsernameWindow": "00:15:00", "DefaultRetryAfterSeconds": 60, "Backend": "memory", "RedisConnectionString": null, "RedisKeyPrefix": "redb:identity:rl:" }, "Validation": { "//": [ "Server-side input-length limits. Regex overrides: leave null for source-generated defaults.", "Password length/policy lives in 'PasswordPolicy' below." ], "MaxIdentifierLength": 128, "MaxDisplayNameLength": 256, "MaxDescriptionLength": 1024, "MinPasswordLength": 8, "MaxPasswordLength": 512, "IdentifierPattern": null, "//IdentifierPatternDefault": "^[a-zA-Z0-9\\-_.]+$", "EmailPattern": null, "//EmailPatternDefault": "^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$", "PhonePattern": null, "//PhonePatternDefault": "^\\+[1-9]\\d{1,14}$" }, "PasswordPolicy": { "//": [ "H10 — server-side password policy applied by user create/change/SCIM endpoints.", "Defaults are STRICT (NIST SP 800-63B / OWASP ASVS 4.0.3 §2.1).", "HistoryCount=0 disables history; MaxAge='00:00:00' disables expiration.", "BreachCheckEnabled=true requires a registered IPasswordBreachChecker." ], "MinLength": 12, "MaxLength": 512, "RequireDigit": true, "RequireUppercase": true, "RequireLowercase": true, "RequireSpecial": false, "SpecialChars": "!@#$%^&*()-_=+[]{}|;:,.<>?/`~\"'\\\\", "HistoryCount": 5, "MaxAge": "90.00:00:00", "BreachCheckEnabled": false }, "Registration": { "//": [ "N-3 (N3-7) — public self-service account registration. Binds", "direct-vm://identity-account-register and POST /api/v1/identity/account/register.", "ON here on purpose: this context is the showcase one, and an image where a visitor", "can create an account and walk the sign-in, MFA and self-service flows is the point.", "The code default is false — a host that does not set this ships closed.", "What makes it safe to leave open: since 2026-09-21 an administrative scope reaches a", "user only through a role that carries it (RestrictAdminScopesByRoleHandler), so a", "self-registered account holds openid/profile/identity:account and nothing that can", "administer. Before that gate existed, registration was the path from anonymous to full", "administrator in two requests, and it was shipped closed for exactly that reason.", "PRODUCTION: set false unless public sign-up is a feature you want. And note this is", "not the only anonymous door — see DynamicRegistrationAllowedScopes above, which still", "lets any caller mint a client_credentials client carrying granular admin scopes.", "E-mail: registration itself does not touch SMTP. The verify link is sent afterwards by", "the BFF (/api/auth/account/verify-email/send), and an unverified account can sign in,", "so with no reachable relay the account still works — only the letter never arrives." ], "Enabled": true, "SendVerifyEmail": true, "RequireUniqueEmail": true }, "Smtp": { "//": [ "N-4 (Session C) — SMTP transport for password-recovery / verify-email / change-email.", "Dev defaults point at the GreenMail container (route-greenmail) running on the host:", " SMTP 3025 (no auth), REST API on 8080 — used by demos to fetch captured mail.", "Production hosts MUST replace Host/Port with a real relay and set Security=StartTls or Ssl", "with valid credentials. Leave Enabled=false to keep SMTP route + channel unregistered." ], "Enabled": true, "Host": "127.0.0.1", "Port": 3025, "Security": "None", "Username": null, "Password": null, "FromAddress": "noreply@redb.local", "SkipCertificateValidation": false }, "FederationState": { "//": [ "C6 — encrypted federation 'state' parameter hardening.", "Backend 'memory' is per-process; use 'redis' behind multiple instances.", "RedisConnectionString falls back to RateLimit.RedisConnectionString when null", "(set ONE Redis target and both subsystems share it). See RateLimit above for", "connection-string examples." ], "StateMaxAge": "00:05:00", "RequireOneTimeUse": true, "RequireBrowserBinding": false, "BindingCookieName": "redb_fed_b", "Backend": "memory", "RedisConnectionString": null, "RedisKeyPrefix": "redb:identity:fed:nonce:" } } }, "//identity.http": [ "Read by the HTTP facade (IdentityHttpModuleHost + IdentityTransportOptions binder).", "IdentityTransport:* keys live here. Core (identity.core) ignores this section." ], "identity.http": { "IdentityTransport": { "Issuer": "https://host.docker.internal:5002", "//IssuerNote": "Mirror of Identity:Issuer (identity.core context). Tsak isolates context property buckets, so the HTTP facade can't read identity.core's Identity:Issuer directly. Drives discovery URLs + cookie Secure flag (https => Secure).", "Http": { "//": [ "Host — bind address of both ports. Default 0.0.0.0 (every interface);", " 127.0.0.1 keeps them on the loopback behind a local proxy.", "PublicPort — OIDC protocol + discovery (token, userinfo, .well-known/*).", " DEFAULT 5002 chosen to avoid the busy 8080 family (Docker friendly).", " Must match redb.Identity.Web appsettings.json -> Identity:Authority.", "ManagementPort — admin API (/api/v1/identity/*, /scim/*). Null = share PublicPort.", " PROD: separate firewalled port, e.g. 5003.", "CorsEnabled — required for SPA / native PKCE clients calling token from browser.", "CorsRegisteredClientOriginsEnabled — auto-allow origins matching registered client URIs.", "AdditionalAllowedOrigins — CSV fallback origins. NEVER '*'." ], "PublicPort": 5002, "//ManagementPort": "PROD: separate firewalled port, e.g. 5003. Null = share PublicPort (DEV only).", "ManagementPort": null, "//Ssl": [ "Serve the facade over HTTPS natively (Kestrel, via the redb.Route.Http connector).", "When true, SslCertPath MUST point to a PFX and Issuer (both identity.core + identity.http)", "MUST use the matching https URL so discovery, iss claims and the Secure cookie flag are", "emitted correctly. These values are currently set for the LOCAL OpenID conformance suite,", "which runs in Docker and reaches the OP at https://host.docker.internal:5002.", "For plain non-Docker dev, set Ssl=false and Issuer back to http://127.0.0.1:5002.", "SslCertPassword is a SECRET in production — supply via an L5 Override env-var:", " Tsak__Contexts__identity.http__Override__IdentityTransport__Http__SslCertPassword=" ], "Ssl": true, "SslCertPath": "C:/Work/yaml/conformance/certs/redb-identity-dev.pfx", "SslCertPassword": "", "CorsEnabled": false, "CorsRegisteredClientOriginsEnabled": true, "//AdditionalAllowedOrigins": "CSV without trailing slash. Example: 'https://app.dev.local,https://staging.example.com'. NEVER '*'.", "AdditionalAllowedOrigins": null, "FederationCallbackPath": "/connect/federation/callback" }, "Features": { "EnableScim": true, "EnableScimBulk": true, "EnableFederation": true, "EnableDynamicRegistration": true, "EnablePushedAuthorization": true, "EnableDeviceCodeFlow": true, "EnableJar": true }, "Jar": { "//": "Dev/conformance only: the request_uri is fetched from the suite or a demo HTTP listener on loopback, so private targets and plain http are allowed. PROD: remove this section (defaults refuse both).", "RequestUriAllowPrivateNetworkTargets": true, "RequestUriRequireHttps": false }, "//Features": "Mirror of Identity:Features (identity.core context). Tsak isolates context property buckets, so the HTTP facade can't read identity.core's Identity:Features directly — keep this list in sync.", "//FederationProviders": "Mirror of Identity:FederationProviders (identity.core context). Tsak isolates context property buckets, so the HTTP facade can't read identity.core's list directly. The /api/v1/identity/federation-providers/public endpoint and the /login page renderer read from this copy. Keep it in sync with the Core list. ClientSecret is unused by the HTTP facade (login redirects only need ClientId + Authority + Scopes); prod deployments may safely set ClientSecret to empty string here.", "FederationProviders": [ { "ProviderId": "google", "DisplayName": "Google", "Authority": "https://accounts.google.com", "ClientId": "REPLACE_ME", "ClientSecret": "", "Scopes": [ "openid", "profile", "email" ], "AutoProvision": true, "Priority": 100 }, { "ProviderId": "microsoft", "DisplayName": "Microsoft", "Authority": "https://login.microsoftonline.com/common/v2.0", "ClientId": "REPLACE_ME", "ClientSecret": "", "Scopes": [ "openid", "profile", "email" ], "AutoProvision": true, "Priority": 200 }, { "ProviderId": "keycloak", "DisplayName": "Keycloak", "Authority": "https://REPLACE_ME.example.com/realms/REPLACE_ME", "ClientId": "REPLACE_ME", "ClientSecret": "", "Scopes": [ "openid", "profile", "email" ], "AutoProvision": true, "Priority": 300 }, { "ProviderId": "github", "DisplayName": "GitHub", "Authority": "https://github.com", "ClientId": "REPLACE_ME", "ClientSecret": "", "Scopes": [ "read:user", "user:email" ], "AutoProvision": true, "Priority": 400 }, { "//": "Mock OIDC IdP for demo_federation_e2e — mirror of identity.core entry.", "ProviderId": "mock-idp-e2e", "DisplayName": "Mock IdP (e2e)", "Authority": "http://127.0.0.1:9199/default", "ClientId": "fed-e2e-client", "ClientSecret": "", "Scopes": [ "openid", "profile", "email" ], "AutoProvision": true, "Priority": 999 }, { "//": "Mock GitHub OAuth2 IdP for demo_federation_github — mirror of identity.core entry.", "ProviderId": "mock-github-e2e", "Kind": "github", "DisplayName": "Mock GitHub (e2e)", "Authority": "http://127.0.0.1:9201", "ClientId": "gh-e2e-client", "ClientSecret": "", "Scopes": [ "read:user", "user:email" ], "AutoProvision": true, "Priority": 1000 } ] } }, "//identity.grpc": [ "Read by the gRPC facade (IdentityGrpcModuleHost + IdentityGrpcTransportOptions binder).", "Same IdentityTransport:* root as the HTTP facade, different sub-section — one section per", "transport, so operators configure both facades the same way. Core (identity.core) ignores it.", "Scope: the service-to-service subset (token, introspect, revoke, userinfo, discovery, jwks).", "Browser flows and DPoP stay on HTTP by design — see doc/gRPC/README.md." ], "identity.grpc": { "IdentityTransport": { "Grpc": { "//": [ "Host — bind address. 0.0.0.0 to accept from outside the machine.", "PublicPort — protocol surface. NEVER share a port with the HTTP facade: gRPC needs", " HTTP/2 while HTTP serves HTTP/1.1+2, and one Kestrel listener has a", " single protocol set. The shared host throws on that conflict.", "ManagementPort — admin surface. Null = share PublicPort (DEV). PROD: separate firewalled", " port — different consumers, different blast radius.", "Compression — None | Gzip. Inbound gzip is always accepted regardless.", "Health — serve grpc.health.v1.Health/Check for k8s / Consul / Envoy probes.", "EmitHttpCompatHeaders — mirror the client IP into redbHttp.RemoteAddress so Core's per-IP", " throttle and brute-force lockout work behind this facade. Leave ON:", " those protections silently no-op when the header is missing." ], "Host": "0.0.0.0", "PublicPort": 5011, "//ManagementPort": "PROD: separate firewalled port, e.g. 5012. Null = share PublicPort (DEV only).", "ManagementPort": null, "//Ssl": [ "TLS for the gRPC listener. SslCertPassword is a SECRET in production — supply via an L5", "Override env-var:", " Tsak__Contexts__identity.grpc__Override__IdentityTransport__Grpc__SslCertPassword=" ], "Ssl": false, "SslCertPath": null, "SslCertPassword": null, "//ClientCertificateMode": [ "mTLS: NoCertificate | AllowCertificate | RequireCertificate. Requires Ssl=true.", "OFF by default so deployments without a client-certificate PKI are not blocked.", "RECOMMENDED for the management port in production.", "AllowedClientThumbprints — CSV of SHA-1 thumbprints; when set, a certificate outside the", "list is rejected even if its chain validates." ], "ClientCertificateMode": "NoCertificate", "AllowedClientThumbprints": null, "Compression": "None", "MaxMessageSize": 4194304, "Health": true, "EmitHttpCompatHeaders": true } } }, "//identity.soap": [ "Read by the WS-Trust facade (IdentitySoapModuleHost + IdentitySoapTransportOptions binder).", "Same IdentityTransport:* root as the other facades, different sub-section. Core ignores it.", "Scope: Issue, Validate, Cancel, Renew — the service-to-service subset, as on gRPC.", "Browser flows and DPoP stay on HTTP by design — see doc/SOAP/README.md.", "One address serves all four operations: WS-Trust distinguishes them by the WS-Addressing", "Action, which is what generated clients emit." ], "identity.soap": { "IdentityTransport": { "Soap": { "//": [ "Host — bind address. 0.0.0.0 to accept from outside the machine.", "Port — separate from the HTTP facade by default. SOAP is ordinary HTTP/1.1 and could", " technically share a host; a separate port buys something else — WS-Trust can be", " closed off from the internet while plain OIDC stays open, with its own limits", " and its own suspend switch.", "Path — where the STS answers. GET on the same path serves the WSDL.", "Wsdl — publish the contract on GET. Leave ON: this facade's audience builds clients", " with generators, and a generator needs a document to read.", "EmitHttpCompatHeaders — mirror the client IP into redbHttp.RemoteAddress so Core's per-IP", " throttle and brute-force lockout work behind this facade. Leave ON: those", " protections silently no-op when the header is missing." ], "Host": "0.0.0.0", "Port": 5021, "Path": "/sts", "//Ssl": [ "TLS is MANDATORY here, unlike the other facades, and its absence is a refusal to start", "rather than a warning: WS-Security UsernameToken carries the client secret in CLEAR TEXT.", "SslCertPassword is a SECRET in production — supply via an L5 Override env-var:", " Tsak__Contexts__identity.soap__Override__IdentityTransport__Soap__SslCertPassword=", "AllowPlaintext is the single escape hatch, for a connection already terminated by a trusted", "proxy. Setting it is the operator's statement that the wire is protected some other way;", "with Ssl=false and AllowPlaintext=false the facade refuses to start." ], "//DEV-DEFAULT": [ "Ssl=false + AllowPlaintext=true is a DEVELOPMENT value, and it is spelled out rather than", "hidden: it is what lets the module come up on a dev worker that has no certificate.", "PRODUCTION: set Ssl=true with SslCertPath, and remove AllowPlaintext — or leave the", "connection to a proxy that terminates TLS and keep AllowPlaintext as the statement that", "someone else protects the wire. With Ssl=false and AllowPlaintext=false the facade refuses", "to start, which is the intended behaviour and not a fault to work around." ], "Ssl": false, "SslCertPath": null, "SslCertPassword": null, "AllowPlaintext": true, "//ClientCertificateMode": [ "mTLS: NoCertificate | AllowCertificate | RequireCertificate. Requires Ssl=true.", "OFF by default so deployments without a client-certificate PKI are not blocked.", "RECOMMENDED for an STS in a closed contour — WS-Trust callers are known partners.", "AllowedClientThumbprints — CSV of SHA-1 thumbprints; when set, a certificate outside the", "list is rejected even if its chain validates.", "An unrecognised value here is refused at start rather than read as NoCertificate: a typo", "must not turn mTLS off on an endpoint whose operator believes it is on." ], "ClientCertificateMode": "NoCertificate", "AllowedClientThumbprints": null, "Wsdl": true, "EmitHttpCompatHeaders": true } } } } } Path: redb-identity/redb.Identity.slnx Snapshot: redb-identity, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/redb.Identity.slnx ----