
Chris CoutinhoandClaude
0ff85dbe4f
feat: implement RFC 8693 Standard Token Exchange for Keycloak
Configure Keycloak 26.4.2 realm to support Standard Token Exchange V2,
enabling the MCP server to exchange client tokens (aud: nextcloud-mcp-server)
for Nextcloud-scoped tokens (aud: nextcloud) via RFC 8693.
Changes:
- Remove duplicate audience workarounds from realm configuration
- Add token-exchange-nextcloud client scope with audience mapper
- Configure scope as default for nextcloud-mcp-server client
- Enable standard.token.exchange.enabled on both clients
- Add comprehensive integration tests (7 tests, all passing)
Token Exchange Flow:
1. Client obtains token with aud: [nextcloud-mcp-server, nextcloud]
2. Server exchanges to aud: nextcloud, azp: nextcloud-mcp-server
3. Exchanged token used for Nextcloud API calls
4. Each request gets fresh ephemeral token (stateless)
Key Implementation Details:
- Uses Keycloak 26.2+ scope-based authorization (no FGAP required)
- Target audiences must be in client's default/optional scopes
- Protocol mappers alone don't grant exchange permission
- Tokens expire after 300s (5 minutes)
Tests validate:
- Basic token exchange flow
- Nextcloud API integration (Capabilities, Notes)
- CRUD operations with exchanged tokens
- Multiple stateless exchanges from same client token
- Token claims preservation (aud, azp, sub)
- Scope configuration validation
See docs/ADR-004-progressive-consent.md for architecture details.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 02:30:37 +01:00
..
2025-10-24 05:50:25 +02:00
2025-10-17 04:30:03 +02:00
2025-11-04 02:30:37 +01:00
2025-11-02 22:03:20 +01:00
2025-11-03 02:18:30 +01:00
2025-11-04 00:26:07 +01:00
2025-10-24 04:38:49 +02:00
2025-11-03 07:51:07 +01:00
2025-10-24 01:04:30 +02:00
2025-11-02 22:03:22 +01:00
2025-11-02 22:03:21 +01:00
2025-10-14 01:23:39 +02:00