From b5aad8588102eddf480dabcdc64f50f9e9df7fbe Mon Sep 17 00:00:00 2001 From: pieroviano Date: Sun, 13 Sep 2026 08:26:23 +0300 Subject: [PATCH] Track P11.2 dynamic providers in the parity plan and report - Progress row and deviations table - Gap matrix, implemented phases and remaining work updated --- docs/plans/duende-parity-plan.md | 18 +++++++++++++++++- docs/reports/duende-parity-report.md | 12 ++++++------ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/docs/plans/duende-parity-plan.md b/docs/plans/duende-parity-plan.md index 3d7ba7b1..a1b8990a 100644 --- a/docs/plans/duende-parity-plan.md +++ b/docs/plans/duende-parity-plan.md @@ -33,7 +33,8 @@ Baseline `dev@dd0d5d7d` (8.0.0-preview.5, fork of upstream). **Plan only — do | P10 key management | ✅ | `4d19d539` | RSA-2048 sig (RS256) + enc (RSA-OAEP) keys. Key entity in EF Core/EF6/MongoDB. `OpenIddictServerKeyRing` resolves credentials per transaction (`Transaction.Credentials`). Protector: `IOpenIddictServerKeyProtector` (in `OpenIddict.Server`, default via `UseDataProtection()`). Quartz pruning is opt-in (`EnableKeyPruning`). | | P5 DPoP | ✅ server + validation + client | `0dae3a9d`, `0a732595`, `dbc144f5` | Opt-in (`EnableDPoPSupport`, `EnableDPoPTokenBinding`). Shared helper `shared/OpenIddict.Extensions/IdentityModel/OpenIddictDPoPHelpers.cs`. Server replay: redeemed token entry (reference id = `jkt.jti`). Nonces: signed JWT (server keys), server only. Validation replay: optional `IDistributedCache`. See deviations below. | | P12 JWT introspection | ✅ server + client + validation | `f1ff44d8`, `811b913a`, `a2c44c5a`, `9d913f9a`, `0152298e`, `f1a9a312` | Opt-in (`EnableJsonWebTokenIntrospectionResponses`, `RequireJsonWebTokenIntrospectionResponses`). Token generated through `GenerateTokenContext` (`TokenTypeIdentifiers.Private.IntrospectionResponse`), signed with the first asymmetric key from `OpenIddictServerKeyRing.ResolveCredentialsAsync`. See deviations below. | -| P11.x | ⏳ | — | — | +| P11.2 dynamic providers | ✅ client + ASP.NET Core + OWIN | `ad43bd3a`, `5315d310` | `IOpenIddictClientRegistrationProvider` (`AddRegistrationProvider`), static provider registered by default. Registration init/validation extracted to `OpenIddictClientConfiguration.ConfigureRegistration`/`ValidateRegistration`. See deviations below. | +| P11.x (others) | ⏳ | — | — | **P5 deviations** @@ -60,6 +61,21 @@ Baseline `dev@dd0d5d7d` (8.0.0-preview.5, fork of upstream). **Plan only — do | Client/validation | Decryption uses the client/validation encryption credentials; `Accept` is replaced (not appended); JSON error responses still accepted; `introspection_signing_alg_values_supported` not enforced | | Review fixes (`f1a9a312`) | Encryption made opt-in (was automatic when an RSA `enc` key existed); A128CBC-HS256 default; response body trimmed; tests for local-key-signed and unsigned JWE tokens | +**P11.2 deviations** + +| Item | Behaviour | +|---|---| +| Persistence | No `ClientRegistration` entity: custom (e.g. DB-backed or in-memory) providers only | +| Provider lifetime | Resolved from the root container (singleton); scoped dependencies need `IServiceScopeFactory` | +| Resolution order | Static options first; id lookups: static → cache → providers in registration order. Issuer/provider-name/list lookups query every provider each time | +| Cache | By `RegistrationId`, `DynamicRegistrationCacheLifetime` (default 30 min, `null`/zero disables). Keeps the configuration manager. No invalidation API: removed/changed registrations live until expiry | +| Validation | Same per-registration checks as static ones, plus: `RedirectUri`/`PostLogoutRedirectUri` must be in `RedirectionEndpointUris`/`PostLogoutRedirectionEndpointUris` (ID0555/ID0556), id must not match a static one (ID0557, case-insensitive), id returned for `FindByIdAsync` must match (ID0558). Failure → `InvalidOperationException` ID0554 | +| Demand validation | Sync "0 or >1 registrations" checks removed from `Validate*Demand`; the resolve handlers throw the same ID0304/ID0305/ID0355 | +| Web providers | `ConfigureProvider`/`ValidateProvider` now `[EditorBrowsable(Advanced)]`; dynamic web-provider registrations must call them (not idempotent: once per instance) | +| ASP.NET Core | `IAuthenticationSchemeProvider` decorated (`OpenIddictClientAspNetCoreSchemeProvider`): unknown scheme → forwarder scheme if exactly one registration has that provider name; also listed in `GetAllSchemesAsync`. Off with `DisableAutomaticAuthenticationSchemeForwarding`. Replacing the scheme provider after `UseAspNetCore()` bypasses it | +| OWIN | Forwarded challenge/sign-out/authenticate and `GetAuthenticationTypes()` fall back to dynamic provider names (`OpenIddictClientOwinForwardedTypes`); forwarded challenge lookup now only runs on 401/403 | +| Uniqueness | Dynamic provider-name duplicates aren't rejected at startup; ambiguous names aren't forwarded and fail with ID0409 when used | + ## 0. Blocking — verify before coding | # | Verify | How | diff --git a/docs/reports/duende-parity-report.md b/docs/reports/duende-parity-report.md index b6789779..b3022b91 100644 --- a/docs/reports/duende-parity-report.md +++ b/docs/reports/duende-parity-report.md @@ -37,7 +37,7 @@ Legend: ✅ available · 🟢 implemented in this fork (not upstream) · ⚠️ | Dynamic client registration (RFC 7591) | ✅ (Configuration API) | ❌ | ⏸ P9 (upstream #2404) | | DCR management (RFC 7592) | ❌ | ❌ | Included in P9 | | Automatic key management | ✅ signing keys (90 d rotate / 14 d announce / 14 d retain) | 🟢 signing + encryption | Done (P10) | -| Dynamic external providers (OIDC/SAML) | ✅ | ⚠️ static client registrations | P11.2 | +| Dynamic external providers (OIDC/SAML) | ✅ | 🟢 OIDC via `IOpenIddictClientRegistrationProvider` (no store entity) | Done (P11.2); SAML with P11.6 | | BFF | ✅ Duende.BFF 4.2 | ⚠️ manual token refresh (sample) | P11.3 | | UI templates | ✅ | ⚠️ sandbox only | P11.4 | | Admin UI | ❌ (third-party) | ❌ | P11.5 (API only) | @@ -63,6 +63,7 @@ Legend: ✅ available · 🟢 implemented in this fork (not upstream) · ⚠️ | P8b CIBA (client) | `b67cf1f3` | `AllowClientInitiatedBackchannelAuthenticationFlow()`, `OpenIddictClientService.ChallengeUsingBackchannelAsync` / `AuthenticateWithBackchannelAsync`, discovery extraction. | Poll mode only. PAR requirement now enforced only for interactive flows. | | P5 DPoP | `0dae3a9d` `0a732595` `dbc144f5` | Server: `EnableDPoPSupport()`, `RequireDPoP()`, `RequireDPoPNonces()`, per-client `ft:dpop`, `dpop_jkt`, discovery `dpop_signing_alg_values_supported`. Validation: `DPoP` scheme, optional `IDistributedCache` replay cache. Client: `EnableDPoPTokenBinding()`, `DPoPSigningCredentials`, `CreateDPoPProofAsync`. | Opt-in. `cnf.jkt` on access tokens and public-client refresh tokens; `token_type=DPoP`. Server replay check writes one token entry per proof (token storage only). | | P12 JWT introspection | `f1ff44d8` `811b913a` `a2c44c5a` `0152298e` `f1a9a312` | Server: `EnableJsonWebTokenIntrospectionResponses()`, `application/token-introspection+jwt` in ASP.NET Core/OWIN, discovery `introspection_signing_alg_values_supported` / `introspection_encryption_*`. Client: `OpenIddictClientRegistration.RequireJsonWebTokenIntrospectionResponses`. Validation: `RequireJsonWebTokenIntrospectionResponses()`. | Opt-in. Errors, anonymous and public clients get JSON. Encrypted only if the application sets `intr_rsp:enc_alg` (`RSA-OAEP`) and its JWKS has an RSA `enc` key. | +| P11.2 dynamic providers | `ad43bd3a` `5315d310` | Client: `IOpenIddictClientRegistrationProvider`, `AddRegistrationProvider()`, `SetDynamicRegistrationCacheLifetime()`; all registration lookups go through the providers. ASP.NET Core: decorated `IAuthenticationSchemeProvider`. OWIN: dynamic forwarded authentication types. | No persistence entity (custom providers). Dynamic registrations must use redirect URIs declared in options; cached by id (30 min default). | | P10 automatic key management | `4d19d539` | New **Key** entity (EF Core `OpenIddictKeys` table, EF6, MongoDB `openiddict.keys`), `IOpenIddictKeyManager`. Server: `EnableAutomaticKeyManagement()`, `OpenIddictServerKeyRing`, `IOpenIddictServerKeyProtector` (in `OpenIddict.Server`; Data Protection implementation via `UseDataProtection()`). Local validation follows rotation. Quartz: `EnableKeyPruning()`. | Schema change for every EF user. Static keys still used, after the active auto key. `UseDataProtection()` also switches token formats unless `PreferDefaultTokenFormat()`. | Latest runs, all green (P12 suites from `0152298e`, MongoDB/Quartz/EF/core from `4d19d539`): server unit 706 · ASP.NET Core integration 1,586 · OWIN integration 1,556 · core 661 · client 196 · abstractions 1,451 · MongoDB 36 · Quartz 34 · validation 118 · validation ASP.NET Core / OWIN integration 30 / 30 · EF Core 10 · EF6 7 · Data Protection 1. @@ -71,16 +72,15 @@ Latest runs, all green (P12 suites from `0152298e`, MongoDB/Quartz/EF/core from | # | Phase | Size | Dependency / risk | |---|---|---|---| -| 1 | P11.2 dynamic providers | M | Client registration lifecycle refactor | -| 2 | P11.3 BFF | M | YARP dependency (approved) | -| 3 | P11.4 / P11.5 templates, admin API | M | New template pack (approved) | -| 4 | P11.6 SAML | XL | New package; XML signature attack surface | +| 1 | P11.3 BFF | M | YARP dependency (approved) | +| 2 | P11.4 / P11.5 templates, admin API | M | New template pack (approved) | +| 3 | P11.6 SAML | XL | New package; XML signature attack surface | | — | P1, P2, P4, P9, P11.1 | L | Blocked until upstream `8.0.0-preview.5` is merged | ## 6. Risks - **Divergence from upstream:** keep fork-only features isolated per branch; rebase when preview.5 ships. - **Schema changes** (sessions, keys, provider registrations): batch them into one preview. -- **Behaviour changes** needing release notes: device-flow `interval`/`slow_down`; PAR requirement limited to interactive flows; `OpenIddictKeys` table appears in EF migrations even when key management is off. +- **Behaviour changes** needing release notes: device-flow `interval`/`slow_down`; PAR requirement limited to interactive flows; `OpenIddictKeys` table appears in EF migrations even when key management is off; client `IAuthenticationSchemeProvider` is decorated by `UseAspNetCore()`. - **Key management:** losing the Data Protection key ring makes stored keys unreadable (they are skipped, new ones are created); concurrent first start on several instances can create extra keys (all published, same active key chosen). - **Scope:** every phase is independently shippable, and P11.4–P11.6 can be dropped.