Skip to content
System Design Lab
Microservice Patterns

Federated Identity and Access Tokens

Delegate sign-in to an identity provider and pass signed access tokens between services, so applications never handle passwords and can verify who the caller is locally — even when the identity provider is briefly down.

Intermediate 4 min read· Updated 2026-11-18

What you will learn

  • Explain federated identity with OpenID Connect and OAuth 2.0.
  • Compare per-request session introspection with locally validated tokens.
  • Propagate identity between microservices with access tokens.
  • Handle expiry, revocation and key rotation.

Overview

At a festival you show your ID once at the entrance and get a wristband. Every bar and stage checks the wristband, not your passport — and they can do it even if the ticket office is closed.

With federated identity, users sign in at an identity provider (Entra ID, Google, Keycloak, Auth0) via OpenID Connect; your applications never see passwords and get single sign-on for free. The result is an access token — usually a signed JWT with the user id, roles and an expiry. Services verify the signature with the provider's public keys (JWKS), so they do not need to call anyone to know who the caller is.

Run it

The identity provider is unavailable from t = 12 s to 22 s. Compare API calls failed when the API asks the provider on every request (A) and when it validates tokens locally (B).

Loading simulation…

Validating a caller

ApproachPer-request costProvider outageRevocation
Session id + introspection callA network callEverything failsImmediate
Signed JWT, local verificationA signature checkOnly new sign-ins failAt expiry (keep tokens short-lived)
JWT + short cache of introspectionMostly localDegrades graduallyWithin the cache TTL

Resource server configuration

Spring Boot: verify JWTs locally with cached JWKS
spring:
  security:
    oauth2:
      resourceserver:
        jwt:
          issuer-uri: https://login.example.com/realms/shop   # discovers and caches the signing keys
          audiences: [ orders-api ]
# Service-to-service: forward the user's token (or exchange it for a narrower one) on outgoing calls,
# so downstream services can authorise the original user, not just "the orders service".

Trade-offs

BenefitsCosts
SecurityNo passwords in your apps; MFA and policies in one place.The provider is a high-value dependency; tokens must be protected in transit and storage.
AvailabilityLocal validation keeps services working through provider blips.Revoked users keep access until their token expires.
SimplicityStandard protocols and libraries everywhere.OAuth/OIDC flows are easy to misconfigure — follow current best-practice profiles.

Production considerations

  • Rotate signing keys regularly; services must refresh JWKS when they see an unknown key id.
  • Keep tokens small — put identity and coarse roles in them, not every permission.
  • Use Authorization Code + PKCE for browser and mobile apps.
  • Validate tokens at the gatekeeper and again in each service.

Further reading

Related topics