Protect an API
Session token, introspected
A signed-in page calls the API with its own token; the API asks the provider about it.
Client
Patrq7JZRCb2OeoGlDcC6KWgQT…
Firewall "main", calling /api/v1
How the API reads a token that is not addressed to it: config/packages/security.yaml
access_token: token_handler: oauth2: http_client: App\Api\WhicheverClientKnowsTheToken issuer: '%env(OIDC_PROVIDER_URI)%' audience: - '%env(OIDC_CLIENT_ID)%' - '%env(DEMO_OPAQUE_CLIENT_ID)%' - '%env(DEMO_RAR_CLIENT_ID)%' cache: id: cache.app ttl: '%app.api.introspection_cache_ttl%'
Proof
17:39:33
It works
- GET /api/v1/account → 200 introspected at the provider (RFC 7662), scope openid profile email invoices.read invoices.pay, 17:39:33