Keycloak architecture ideas and best practices for unifying multiple Keycloak realms #51006
Replies: 1 comment 1 reply
|
Yes, a backend can trust more than one issuer, but that should be an explicit multi-issuer trust configuration—not “decode the JWT, read For this architecture I would choose between these models:
Whichever model you choose, avoid validating only the signature and issuer. A token issued for frontend/client A should not be accepted by backend B unless B is an intended audience. Also avoid putting all target audiences and privileges into one long-lived “universal” browser token; per-API, short-lived, least-privilege tokens limit the blast radius. So the blue-arrow design is plausible. If this is one organization with one user population, I would normally consolidate the applications into one realm and model the stacks as clients. If the realm separation represents real tenant/security boundaries, keep it and use an allow-listed multi-issuer validator or a BFF/token-chaining design, plus explicit claim-to-local-permission mapping in every backend. If this answers the architecture question, please mark it as the accepted answer so future readers can find the security trade-offs quickly. |
Yes, a backend can trust more than one issuer, but that should be an explicit multi-issuer trust configuration—not “decode the JWT, read
iss, then accept whatever keys that URL advertises.” The unverifiedissvalue may only select an entry from a fixed allow-list. The backend must then validate the signature with that issuer's configured JWKS and validate the exactiss, the API'saud, expiry/not-before, and the scopes/roles used for authorization.For this architecture I would choose between these models:
One realm, multiple clients/resources when all stacks are in the same security domain. Keycloak realms are intentionally isolated; clients are the normal boundary for multiple applicat…