Architecture Decision Record
ADR-004: Cross-Service Token Validation via JWKS / OIDC Discovery
Status
Accepted. Updated 2026-09-03 (JwtSettings / JwtSigningAlgorithm cited at their real Auth/
paths, and the validator registration described with its current signature and secure-by-default
RequireHttpsMetadata resolution). Revised 2026-10-07: gateway-routed discovery is scoped to the
local Aspire wiring (production ACA validators in ADC and Store use the direct internal-ingress
Identity authority), and the resilience claim now says the Polly pipeline covers the warmup prefetch
but not the JwtBearer middleware's own discovery fetch. Revised 2026-10-21: anchors refreshed after
the ADC and Store service, AppHost and Bicep edits and the Common warmup-task change moved them; no
decision or behavior changed. Revised 2026-10-26: anchors refreshed after the ADC and Store
service, AppHost and Bicep edits and the Common hosting and warmup-task edits moved them; no decision
or behavior changed. Revised 2026-10-28: the validator bullet now records that the JWT authority is
resolved fail-closed through GetRequiredJwtAuthority(), alongside the audience, and the ADC and
Store Bicep anchors are refreshed. Revised 2026-11-04: the JWKS document can publish more than one
public key (JwksSettings.AdditionalKeys, MMCA.Common 1.277.0), every local validator accepts the
published set, and the Rationale and Trade-offs now describe the staged signing-key rotation that
makes possible (see Revision below). Revised 2026-11-23: the validator bullet now records that the
five validating services register AddForwardedJwtBearer through the composed
AddMmcaServiceHost start-up rather than calling it directly, and that the two Identity services
take its TokenIssuer branch to AddCommonAuthentication; the remaining anchors are refreshed.
Context
When the modular monolith is extracted into per-module service hosts behind a gateway (ADR-008), every service must authenticate the same end-user JWT, but only one service (Identity) issues tokens. In the monolith, issuer and validator are the same process, so a single symmetric secret (HMAC-SHA256) suffices: the secret that signs a token also validates it. Once Identity is a separate process, sharing that symmetric secret with every other service means every service can also mint tokens, and rotating the secret becomes a coordinated multi-service change. We needed a way for extracted services to validate Identity's tokens without holding any signing key material, and without pinning configuration that breaks when the internal service-discovery hostname differs from the public issuer URL.
Decision
Validate cross-service tokens with asymmetric (RS256) signatures plus JWKS / OIDC discovery,
keeping the symmetric (HS256) shared-secret path as the in-process monolith option. The signing
mode is a single configuration switch (JwtSettings.SigningAlgorithm), and it defaults to RS256
(MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Auth/JwtSettings.cs:30, reasoning at :24-29):
a host that never sets the key gets the algorithm that survives extraction. A single-process monolith
opts into HS256 explicitly, alongside the Jwt:SecretForKey that choice requires
(.../Auth/JwtSigningAlgorithm.cs:14-19).
Issuer side (Identity service).
- Identity signs access tokens with its RSA private key (RS256) and publishes only the matching
public key (ADC's Identity service sets
"SigningAlgorithm": "RS256"). IJwksProvider/RsaJwksProvidermaterialize aJsonWebKeySetfrom PEM public keys: the current key first (JwksSettings:Enableddefaults tofalse,KeyIddefaults to"default", key supplied inline viaRsaPublicKeyPemor byRsaPublicKeyPath), then everyJwksSettings.AdditionalKeysentry (akidplus an inline PEM or a path) in order (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Auth/RsaJwksProvider.cs:43,:47-50;.../Auth/JwksSettings.cs:70). An additional key is never used to sign: it is the next key staged for a rotation or the previous key while its tokens are still live (JwksSettings.cs:20-22). When publishing is disabled or no current key is configured, the provider returns an empty key set, so the endpoint stays queryable (RsaJwksProvider.cs:29-40).- Two well-known endpoints are mapped centrally for every host (
MapJwksEndpoint,MapOidcDiscoveryEndpoint), both anonymous:/.well-known/jwks.jsonand/.well-known/openid-configuration. The discovery document advertises the validation-relevantissuer+jwks_uri(plus minimal OIDC metadata:response_types_supported,subject_types_supported,id_token_signing_alg_values_supported) and returns404whenJwt:Issueris unset, so a non-Identity host serving the same route exposes nothing.
Validator side (every other service).
AddForwardedJwtBearer(authority, audience, configuration, environment, requireHttpsMetadata: null)points the JWT bearer middleware at anAuthority, so it fetches{authority}/.well-known/openid-configuration, followsjwks_uri, and validates the token signature against the published key (MMCA.Common/Source/Presentation/MMCA.Common.API/Startup/WebApplicationBuilderExtensions.Authentication.cs:52-57). No service except Identity holds key material. ADC's Conference, Engagement, and Notification services and Store's Catalog and Sales services all use this path through the composed Common service host: each callsbuilder.AddMmcaServiceHost(new() ...)(.../MMCA.ADC.Conference.Service/Program.cs:82,.../MMCA.ADC.Engagement.Service/Program.cs:58,.../MMCA.ADC.Notification.Service/Program.cs:58;.../MMCA.Store.Catalog.Service/Program.cs:32,.../MMCA.Store.Sales.Service/Program.cs:51), whose defaultForwardedJwtBearerauthentication (MMCA.Common/Source/Hosting/MMCA.Common.ServiceHost/MmcaServiceHostOptions.cs:52) callsAddForwardedJwtBearerwith the host'sIConfigurationandIHostEnvironment, leavingrequireHttpsMetadataat its default (MMCA.Common/Source/Hosting/MMCA.Common.ServiceHost/ServiceHostBuilderExtensions.cs:136-140). The two Identity services setServiceHostAuthentication.TokenIssuerinstead (.../MMCA.ADC.Identity.Service/Program.cs:120,.../MMCA.Store.Identity.Service/Program.cs:67), which routes to the in-processAddCommonAuthentication(ServiceHostBuilderExtensions.cs:130-132). The composed host resolves the authority fail-closed through the Commonconfiguration.GetRequiredJwtAuthority()(ServiceHostBuilderExtensions.cs:137;MMCA.Common/Source/Presentation/MMCA.Common.API/Startup/Auth/JwtAuthorityExtensions.cs:36, keyAuthentication:JwtBearer:Authorityat:21, throw at:41-43), and the audience fail-closed through the CommonJwtAudience.RequireConfigured(configuration[JwtAudience.ConfigKey])(ServiceHostBuilderExtensions.cs:138;MMCA.Common/Source/Presentation/MMCA.Common.API/Startup/Auth/JwtAudience.cs:17, keyJwt:Audienceat:20, guard at:28), so a host with no configured authority or audience fails at startup instead of booting against a hard-coded default.GetRequiredJwtAuthority()throws only on a missing value; a blank authority is rejected byAddForwardedJwtBeareritself (ArgumentException.ThrowIfNullOrWhiteSpace(authority)at.../WebApplicationBuilderExtensions.Authentication.cs:59).- The metadata fetch is HTTPS-only by default, and the caller supplies configuration and environment
so the framework can resolve that: the explicit
requireHttpsMetadataargument when it is not null, then theAuthentication:JwtBearer:RequireHttpsMetadataconfiguration key, thentrueeverywhere except Development (.../WebApplicationBuilderExtensions.Authentication.cs:64-66, key declared at:25). Resolving tofalseoutside Development stays legal, because an internal-ingress h2c authority is a real deployment shape, but it registersInsecureJwtMetadataWarningStartupFilterso the host logs one startup warning naming the key (.../WebApplicationBuilderExtensions.Authentication.cs:68-72). ValidIssueris deliberately not pinned: the middleware takes the issuer from the discovery document, because theauthorityneed not be the token'sissorigin. Locally the authority is the gateway's HTTPS endpoint (MMCA.Common/Source/Hosting/MMCA.Common.Aspire.Hosting/Extensions.cs:392-395); in ADC's production deployment it is Identity's internal-ingress URLhttp://${identityApp.name}(MMCA.ADC/infra/main.bicep:2484) while Identity issues tokens withissset to the public gateway origin (MMCA.ADC/infra/main.bicep:2229).- Both validators pin
TokenValidationParameters.ValidAlgorithmsso an attacker cannot force an algorithm swap (for example, signing an HS256 token using the RSA public key as the HMAC secret): the forwarded JWKS validator (AddForwardedJwtBearer) pins[RS256](the JWKS path only ever validates Identity's asymmetric tokens), and the in-process validator (AddCommonAuthentication→BuildValidationParameters) pins[RS256]for the asymmetric path or[HS256]for the symmetric one. AddCommonAuthentication(configuration)remains the in-process path: HS256 with the shared Base64 secret (the monolith option), or RS256 validating against a locally configured public-key PEM (no JWKS fetch). It requiresRsaPublicKeyPemwhen RS256 is selected and directs extracted services toAddForwardedJwtBearerinstead. In RS256 mode it also accepts everyJwks:AdditionalKeysentry, the same set the JWKS document publishes (.../WebApplicationBuilderExtensions.Authentication.cs:151,:248), and so doesTokenService's refresh-flow validation of the expired access token it signed (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Auth/TokenService.cs:98,:217).
Discovery routing and fallback.
- Discovery is wired by the AppHost helper
WithJwksDiscovery(identity, gateway?). Because the extracted REST services listen HTTP/2-only on cleartext for h2c gRPC (ADR-012), the default HTTP/1.1 JwtBearer backchannel cannot reach Identity directly, so the authority is set to the gateway HTTPS origin; the gateway terminates TLS, speaks HTTP/1.1 and HTTP/2 via ALPN, and forwards/.well-known/*on to Identity. When no gateway is passed, it falls back to Identity's HTTPS endpoint directly (HTTP/2-only, so the gateway form is preferred). ADC's AppHost uses the two-argument gateway form for all three validating services (MMCA.ADC/Source/Hosting/MMCA.ADC.AppHost/Program.cs:370-372). - That gateway routing is the local Aspire wiring only; Store's AppHost uses the same gateway form
for Catalog and Sales (
MMCA.Store/Source/Hosting/MMCA.Store.AppHost/Program.cs:337-338). In the Azure Container Apps deployments the validators setAuthentication__JwtBearer__Authorityto Identity's internal-ingress URLhttp://${identityApp.name}directly (ADC:MMCA.ADC/infra/main.bicep:2484,:2623,:2789; Store:MMCA.Store/infra/main.bicep:2113,:2249), where TLS terminates at the platform edge, and pair it withAuthentication__JwtBearer__RequireHttpsMetadata=false(ADC::2488,:2627,:2793; Store::2118,:2254), which is the shape the startup warning above exists for. OpenIdConnectMetadataWarmupTask(MMCA.Common.Aspire) pre-fetches the discovery document at startup through anIHttpClientFactoryclient (MMCA.Common/Source/Hosting/MMCA.Common.Aspire/Warmup/OpenIdConnectMetadataWarmupTask.cs:49), aimed at the classic "first request fails, second succeeds" pattern on a cold, CPU-throttled Azure Container Apps Consumption replica. It warms the issuer and the discovery path, but it does not populate the JwtBearer middleware'sConfigurationManager, which caches discovery state separately and still performs its own fetch on the first authenticated request (.../Warmup/OpenIdConnectMetadataWarmupTask.cs:18-23).- SignalR cannot send an
Authorizationheader on the WebSocket upgrade, so both registration paths read the token from theaccess_tokenquery string for/hubsrequests.
Rationale
- No shared signing key. Only Identity can mint tokens; every other service holds only the public key it fetched, so a compromised non-Identity service cannot forge tokens, and key rotation is configured at the issuer alone.
- Rotation without a 401 wave. Because the key set can hold more than one key, the issuer stages
the next public key in
AdditionalKeysbefore switching to it (so a validator that caches the JWKS document already knows it), switches signing, then keeps the previous public key published until every token it signed has expired (JwksSettings.cs:151-153). No live token is rejected at the switch. - Discovery over hard-coded keys. Fetching the key set via OIDC discovery means consumers need no per-service key configuration, and rotation does not require redeploying every validator.
- Origin-aligned issuer. Deriving the issuer from the discovery document rather than pinning it keeps validation working when the internal hostname and the public issuer differ, which is the normal case behind a gateway.
- RS256 is the default, HS256 the monolith option. A single-process deployment whose issuer and validators live in one host can share the symmetric key and skip RSA key management entirely, so the algorithm switch lets the same code run either way. The default is the asymmetric one because it is the choice whose token format does not change when that host is later extracted, and because a host that never thought about the setting should not be the one holding a key that mints tokens.
Trade-offs
- More moving parts than a shared secret. RS256 needs key generation, distribution of the public half, a JWKS endpoint, and discovery wiring, versus one symmetric string.
- Discovery is a startup dependency. A validator cannot verify tokens until it has fetched the key
set. The warmup task reduces the cold-start cost without removing it: the middleware's own fetch
uses its own
HttpClient(noBackchannelis set, see below), so it does not reuse the warmup client's connection pool, and only issuer-side and process-wide state is shared. The middleware caches the key set after its first fetch. The Polly pipeline only partly covers this:AddServiceDefaults()attachesAddStandardResilienceHandlerthroughConfigureHttpClientDefaults(MMCA.Common/Source/Hosting/MMCA.Common.Aspire/Extensions.cs:57-68), which reaches onlyIHttpClientFactoryclients, so the warmup prefetch is covered (.../Warmup/OpenIdConnectMetadataWarmupTask.cs:26,:49). The JwtBearer middleware's ownConfigurationManagerfetch is separate (OpenIdConnectMetadataWarmupTask.cs:18-23), andAddForwardedJwtBearerCoresets noBackchannelorBackchannelHttpHandler(.../WebApplicationBuilderExtensions.Authentication.cs:83-114), so that fetch does not run through a Common-registered resilience pipeline; what retry, if any, applies to it is left to the framework's default backchannel. ADR-009 itself does not address discovery. - Transport coupling. Locally, the HTTP/2-only cleartext endpoints (ADR-012) force discovery through the gateway; the direct-Identity fallback exists but is HTTP/2-only, so the AppHost prefers the gateway form. In production the internal-ingress authority removes that coupling at the cost of a cleartext metadata fetch inside the environment.
- Endpoint hygiene is on the issuer. JWKS and discovery are anonymous by definition; the discovery
doc returns
404on non-issuer hosts and the JWKS provider returns an empty set when unconfigured, so only the real issuer advertises a key. - Retiring a key runs on two clocks. In-process validators (
AddCommonAuthentication, theTokenServicerefresh flow) build their key list once, so removing an additional key takes effect when the process restarts; forwarded validators drop it when they next refresh the JWKS document, on the JWT bearer handler's metadata refresh interval (JwksSettings.cs:64-68). A rotation is therefore a sequence of configuration deploys, not one change.
Revision (2026-10-01)
Anchor-only refresh; no decision or rationale changed. The AddForwardedJwtBearer registration
lives in the partial file
MMCA.Common/Source/Presentation/MMCA.Common.API/Startup/WebApplicationBuilderExtensions.Authentication.cs,
so its citations are re-anchored there: the signature at :51-56, the RequireHttpsMetadata
resolution at :63-65, the config key at :24, and the InsecureJwtMetadataWarningStartupFilter
registration at :67-71.
Revision (2026-10-06)
Anchor-only refresh; no decision, rationale or behavior changed.
- The
AddForwardedJwtBearercitations in the Decision section moved down one line inWebApplicationBuilderExtensions.Authentication.cs: the signature is now at:52-57, theRequireHttpsMetadataresolution at:64-66, the config key at:25, and theInsecureJwtMetadataWarningStartupFilterregistration at:68-72(the filter class itself is declared atStartup/Auth/InsecureJwtMetadataWarningStartupFilter.cs:15). - The ADC Conference service call is cited at
Program.cs:329, whereservices.AddForwardedJwtBearer(starts. - All other anchors in the live sections were re-verified against current source and are unchanged.
Revision (2026-10-07)
Re-verified against current source. The signing model, the validator registration, the
RequireHttpsMetadata resolution and the decision not to pin ValidIssuer are unchanged; three
statements about discovery routing, the warmup task and discovery resilience were overstated and
are now scoped to what source shows.
- Gateway-routed discovery is the local Aspire wiring
(
MMCA.ADC/Source/Hosting/MMCA.ADC.AppHost/Program.cs:368-370,MMCA.Store/Source/Hosting/MMCA.Store.AppHost/Program.cs:357-358). The production validators use Identity's internal-ingress authority directly (ADC:MMCA.ADC/infra/main.bicep:2003,:2139,:2293; Store:MMCA.Store/infra/main.bicep:1684,:1819) withRequireHttpsMetadata=false(ADC::2007,:2143,:2297; Store::1689,:1824). The Decision bullet, theValidIssuerbullet (whose example authority was the Aspire service-discovery URL; it now names the gateway endpoint locally and the internal-ingress URL in production, against the publicJwt__IssueratMMCA.ADC/infra/main.bicep:1769), the Transport coupling trade-off and the ADR-012 entry under Related now say so. - The warmup bullet no longer says the first authenticated request skips the discovery round trip:
the middleware's
ConfigurationManagerstill performs its own fetch (MMCA.Common/Source/Hosting/MMCA.Common.Aspire/Warmup/OpenIdConnectMetadataWarmupTask.cs:16-19), and the Discovery trade-off now says the warmup reduces rather than absorbs the cold-start cost. - The Discovery trade-off no longer credits ADR-009 with covering the discovery fetch. The
standard resilience handler is attached through
ConfigureHttpClientDefaults(MMCA.Common/Source/Hosting/MMCA.Common.Aspire/Extensions.cs:39-49) and so reaches theIHttpClientFactoryclient the warmup task uses (.../Warmup/OpenIdConnectMetadataWarmupTask.cs:45);AddForwardedJwtBearerCoresets no backchannel (MMCA.Common/Source/Presentation/MMCA.Common.API/Startup/WebApplicationBuilderExtensions.Authentication.cs:83-114), so the middleware's ownConfigurationManagerfetch is outside that pipeline. The ADR-009 entry under Related now says so. - Anchors re-verified against current source: the ADC Conference service call moved to
MMCA.ADC/Source/Services/MMCA.ADC.Conference.Service/Program.cs:331; theAddForwardedJwtBearersignature (:52-57),RequireHttpsMetadataresolution (:64-66) and warning-filter registration (:68-72) inWebApplicationBuilderExtensions.Authentication.csare unchanged.
Revision (2026-10-21)
Re-verified against current source. The signing model, the validator registration, the
RequireHttpsMetadata resolution, the local gateway-routed discovery, the production
internal-ingress authority and the warmup task's scope are unchanged; only anchors in the live
sections moved. The 2026-10-07 revision above keeps the anchors that were true on that date.
- Anchors re-verified against current source:
services.AddForwardedJwtBearer(starts atMMCA.ADC/Source/Services/MMCA.ADC.Conference.Service/Program.cs:333,MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Program.cs:179,MMCA.ADC/Source/Services/MMCA.ADC.Notification.Service/Program.cs:169andMMCA.Store/Source/Services/MMCA.Store.Sales.Service/Program.cs:180; Store Catalog stays atMMCA.Store/Source/Services/MMCA.Store.Catalog.Service/Program.cs:205.WithJwksDiscoveryselects the gateway (or Identity)httpsendpoint and setsAuthentication__JwtBearer__AuthorityatMMCA.Common/Source/Hosting/MMCA.Common.Aspire.Hosting/Extensions.cs:344-347.- The two-argument gateway form is called at
MMCA.ADC/Source/Hosting/MMCA.ADC.AppHost/Program.cs:373-375andMMCA.Store/Source/Hosting/MMCA.Store.AppHost/Program.cs:377-378. - ADC Bicep: Identity's
Jwt__IssueratMMCA.ADC/infra/main.bicep:1919; the validators'Authentication__JwtBearer__Authorityat:2159,:2295,:2449andRequireHttpsMetadata=falseat:2163,:2299,:2453. Store Bicep: Authority atMMCA.Store/infra/main.bicep:1775,:1911andRequireHttpsMetadata=falseat:1780,:1916. OpenIdConnectMetadataWarmupTasktakes itsIHttpClientFactoryatMMCA.Common/Source/Hosting/MMCA.Common.Aspire/Warmup/OpenIdConnectMetadataWarmupTask.cs:23-24, creates the client at:47, and its remarks on the middleware's separateConfigurationManagerfetch run:16-21.
Revision (2026-10-26)
Re-verified against current source. The signing model, the validator registration (all five services
still pass JwtAudience.RequireConfigured(builder.Configuration[JwtAudience.ConfigKey]), the host
configuration and environment, and leave requireHttpsMetadata at its default), the
RequireHttpsMetadata resolution, the local gateway-routed discovery, the production
internal-ingress authority, the public Jwt__Issuer and the warmup task's scope are unchanged; only
anchors in the live sections moved. The 2026-10-21 revision above keeps the anchors that were true
on that date.
- Anchors re-verified against current source:
services.AddForwardedJwtBearer(starts atMMCA.ADC/Source/Services/MMCA.ADC.Conference.Service/Program.cs:339,MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Program.cs:185,MMCA.ADC/Source/Services/MMCA.ADC.Notification.Service/Program.cs:175,MMCA.Store/Source/Services/MMCA.Store.Catalog.Service/Program.cs:211andMMCA.Store/Source/Services/MMCA.Store.Sales.Service/Program.cs:186.WithJwksDiscovery(declared atMMCA.Common/Source/Hosting/MMCA.Common.Aspire.Hosting/Extensions.cs:322) selects the gateway (or Identity)httpsendpoint at:345-347and setsAuthentication__JwtBearer__Authorityat:348.- The two-argument gateway form is called at
MMCA.ADC/Source/Hosting/MMCA.ADC.AppHost/Program.cs:374-376andMMCA.Store/Source/Hosting/MMCA.Store.AppHost/Program.cs:379-380. - ADC Bicep: Identity's
Jwt__IssueratMMCA.ADC/infra/main.bicep:1955; the validators'Authentication__JwtBearer__Authorityat:2195,:2331,:2485andRequireHttpsMetadata=falseat:2199,:2335,:2489. Store Bicep: Authority atMMCA.Store/infra/main.bicep:1781,:1917andRequireHttpsMetadata=falseat:1786,:1922. AddServiceDefaults()callsConfigureHttpClientDefaultsatMMCA.Common/Source/Hosting/MMCA.Common.Aspire/Extensions.cs:50and attachesAddStandardResilienceHandlerat:60.OpenIdConnectMetadataWarmupTasktakes itsIHttpClientFactoryatMMCA.Common/Source/Hosting/MMCA.Common.Aspire/Warmup/OpenIdConnectMetadataWarmupTask.cs:26, creates the client at:49, and its remarks on the middleware's separateConfigurationManagerfetch run:18-23.
Revision (2026-10-28)
Re-verified against current source. The signing model, the validator registration, the
RequireHttpsMetadata resolution, the local gateway-routed discovery, the production
internal-ingress authority, the public Jwt__Issuer and the warmup task's scope are unchanged; the
Decision section now records that the authority, like the audience, is resolved fail-closed, and the
Bicep anchors moved. The 2026-10-26 revision above keeps the anchors that were true on that date.
- The validator bullet now names the authority guard. All five services resolve the
authority through
builder.Configuration.GetRequiredJwtAuthority()(the ADC services pass it inline as theauthority:argument; the Store services first assign it to a localjwtAuthority) (MMCA.ADC/Source/Services/MMCA.ADC.Conference.Service/Program.cs:340,MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Program.cs:186,MMCA.ADC/Source/Services/MMCA.ADC.Notification.Service/Program.cs:176,MMCA.Store/Source/Services/MMCA.Store.Catalog.Service/Program.cs:210,MMCA.Store/Source/Services/MMCA.Store.Sales.Service/Program.cs:185), and that method throwsInvalidOperationExceptionwhenAuthentication:JwtBearer:Authorityis absent (MMCA.Common/Source/Presentation/MMCA.Common.API/Startup/Auth/JwtAuthorityExtensions.cs:35, key at:21, throw at:39-42); a blank value passes that method and is rejected byAddForwardedJwtBeareratMMCA.Common/Source/Presentation/MMCA.Common.API/Startup/WebApplicationBuilderExtensions.Authentication.cs:59. - Anchors re-verified against current source:
- ADC Bicep: Identity's
Jwt__IssueratMMCA.ADC/infra/main.bicep:1952; the validators'Authentication__JwtBearer__Authorityat:2192,:2328,:2482andRequireHttpsMetadata=falseat:2196,:2332,:2486. Store Bicep: Authority atMMCA.Store/infra/main.bicep:1782,:1918andRequireHttpsMetadata=falseat:1787,:1923. services.AddForwardedJwtBearer(still starts at the fiveProgram.cslines the Decision section cites;WithJwksDiscoveryis still declared atMMCA.Common/Source/Hosting/MMCA.Common.Aspire.Hosting/Extensions.cs:322and sets the authority at:348; the AppHost calls stay atMMCA.ADC/Source/Hosting/MMCA.ADC.AppHost/Program.cs:374-376andMMCA.Store/Source/Hosting/MMCA.Store.AppHost/Program.cs:379-380; theAddForwardedJwtBearersignature (:52-57),RequireHttpsMetadataresolution (:64-66) and warning-filter registration (:68-72) inWebApplicationBuilderExtensions.Authentication.csare unchanged.
- ADC Bicep: Identity's
Revision (2026-11-04)
MMCA.Common 1.277.0 lets the JWKS document publish more than one key. The signing model, the validator registration, discovery and the pinned algorithms are unchanged.
JwksSettings.AdditionalKeyslists further public keys, each aJwksAdditionalKeywith akidand an inline PEM or a path (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Auth/JwksSettings.cs:70,:162).RsaJwksProviderpublishes the current key first and the additional keys after it, in order (.../Auth/RsaJwksProvider.cs:43,:47-50); signing stays on the current key (.../Auth/TokenService.cs:268).- Every local validator accepts the published set: the RS256 in-process validator
(
MMCA.Common/Source/Presentation/MMCA.Common.API/Startup/WebApplicationBuilderExtensions.Authentication.cs:151,:248) andTokenService's refresh-flow validation (TokenService.cs:98,:194). Forwarded validators see the extra keys through the JWKS document they already fetch. JwksSettingsimplementsIValidatableObject(JwksSettings.cs:25): an additional key with a missing or over-64-characterkid, akidthat repeats another entry or the currentKeyId, or key material that is absent or does not load fails options validation at startup (JwksSettings.cs:79-116).- The HS256 service-token path has no published key set and is unchanged
(
MMCA.Common/Source/Presentation/MMCA.Common.Grpc/Authentication/ServiceTokenServiceCollectionExtensions.cs:141,:144). - ADC's operational rotation procedure is its runbook (
MMCA.ADC/infra/OPERATIONS.md:618). - The other anchors in this ADR were not re-verified in this revision; the changes to
WebApplicationBuilderExtensions.Authentication.cssit after line 146, so the:52-72and:83-114ranges cited above are unaffected.
Revision (2026-11-23)
Re-verified against current source. The signing model, the pinned algorithms, the fail-closed
authority and audience guards, the RequireHttpsMetadata resolution, the local gateway-routed
discovery, the production internal-ingress authority and the published key set are unchanged; the
place the validating services register the JWT bearer moved, and the anchors moved with it. The
earlier revisions above keep the anchors that were true on their dates.
- The five validating services no longer call
AddForwardedJwtBearerfrom their ownProgram.cs. Each callsbuilder.AddMmcaServiceHost(new() ...)(MMCA.ADC/Source/Services/MMCA.ADC.Conference.Service/Program.cs:82,MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Program.cs:58,MMCA.ADC/Source/Services/MMCA.ADC.Notification.Service/Program.cs:58,MMCA.Store/Source/Services/MMCA.Store.Catalog.Service/Program.cs:32,MMCA.Store/Source/Services/MMCA.Store.Sales.Service/Program.cs:51), and the composed host callsAddForwardedJwtBearerwithGetRequiredJwtAuthority(),JwtAudience.RequireConfigured(...), the configuration and the environment, leavingrequireHttpsMetadataat its default (MMCA.Common/Source/Hosting/MMCA.Common.ServiceHost/ServiceHostBuilderExtensions.cs:136-140). That branch is the default (MMCA.Common/Source/Hosting/MMCA.Common.ServiceHost/MmcaServiceHostOptions.cs:52). The 2026-10-28 statement that the call still starts at the fiveProgram.cslines no longer holds. - The Identity services take the other branch: they set
ServiceHostAuthentication.TokenIssuer(MMCA.ADC/Source/Services/MMCA.ADC.Identity.Service/Program.cs:120,MMCA.Store/Source/Services/MMCA.Store.Identity.Service/Program.cs:67), which registersAddCommonAuthentication(ServiceHostBuilderExtensions.cs:130-132). The validator bullet in the Decision section now says so. - Anchors re-verified against current source:
GetRequiredJwtAuthorityis declared atMMCA.Common/Source/Presentation/MMCA.Common.API/Startup/Auth/JwtAuthorityExtensions.cs:36, key at:21, throw at:41-43;JwtAudiencestays at:17,:20,:28.TokenServicebuilds the additional validation keys atMMCA.Common/Source/Core/MMCA.Common.Infrastructure/Auth/TokenService.cs:98and applies them asIssuerSigningKeysinGetPrincipalFromExpiredTokenat:217(declared:204); signing stays on the current key, built byBuildRsaCredentials(:273,SigningCredentialsat:293).WithJwksDiscoveryis declared atMMCA.Common/Source/Hosting/MMCA.Common.Aspire.Hosting/Extensions.cs:369-371, picks the gateway (or Identity)httpsendpoint at:392-394and setsAuthentication__JwtBearer__Authorityat:395.- The two-argument gateway form is called at
MMCA.ADC/Source/Hosting/MMCA.ADC.AppHost/Program.cs:370-372andMMCA.Store/Source/Hosting/MMCA.Store.AppHost/Program.cs:337-338. - ADC Bicep: Identity's
Jwt__IssueratMMCA.ADC/infra/main.bicep:2229; the validators'Authentication__JwtBearer__Authorityat:2484,:2623,:2789andRequireHttpsMetadata=falseat:2488,:2627,:2793. Store Bicep: Authority atMMCA.Store/infra/main.bicep:2113,:2249andRequireHttpsMetadata=falseat:2118,:2254. AddServiceDefaults()callsConfigureHttpClientDefaultsatMMCA.Common/Source/Hosting/MMCA.Common.Aspire/Extensions.cs:57and attachesAddStandardResilienceHandlerat:68.- The HS256 service-token validator sets its
SymmetricSecurityKeyatMMCA.Common/Source/Presentation/MMCA.Common.Grpc/Authentication/ServiceTokenServiceCollectionExtensions.cs:148and pinsValidAlgorithms = [HmacSha256]at:151, insideConfigureServiceTokenBearer(:138); there is still no published key set. - ADC's rotation runbook is the
## JWKS signing-key rotationsection atMMCA.ADC/infra/OPERATIONS.md:746.
Related
ADR-007 (gRPC calls forward the validated JWT downstream via JwtForwardingClientInterceptor),
ADR-008 (the extraction that split issuer and validator into separate processes), ADR-012 (the
HTTP/2-only transport that forces gateway-routed discovery in the local Aspire wiring), ADR-009
(resilience; its Polly pipeline covers the warmup prefetch, not the middleware's own discovery
fetch).