feat(keycloak): add keycloak to docker-compose and enable sso by default for development testing#2949
Merged
crivetimihai merged 2 commits intomainfrom Feb 15, 2026
Merged
feat(keycloak): add keycloak to docker-compose and enable sso by default for development testing#2949crivetimihai merged 2 commits intomainfrom
crivetimihai merged 2 commits intomainfrom
Conversation
250d25d to
1581e4a
Compare
…sting - Add Keycloak service to docker-compose.yml (pinned to v26.1) with pre-configured realm export for local SSO development - Add docker-compose.sso.yml overlay for SSO-specific configuration - Add "sso" to testing and inspector service profiles so --profile sso brings up the full dev stack (Keycloak + testing + inspector) - Implement SSO bootstrap utility for automatic Keycloak realm/client setup - Add Keycloak discovery helper with well-known endpoint support - Enhance SSO service with id_token claims fallback for split-host configurations (restricted to 401 + split-host detection only) - Improve admin.py SSO logout with proper id_token_hint RP-initiated flow - Skip expired id_token_hint in logout URL to avoid Keycloak rejection - Add cookie size validation for id_token storage (>3.8KB warning) - Use dynamic max_age for SSO cookies matching token_expiry setting - Improve error handling and logging throughout SSO flows - Add sso-keycloak-tutorial and developer workstation documentation - Add test-sso-flow.sh script for manual SSO flow verification - Add Makefile targets for Keycloak lifecycle management Closes #2949 Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
- Add SSO service tests for Keycloak userinfo fallback, callback error handling, personal team resolution, and user authentication flows - Add Keycloak discovery and SSO bootstrap unit tests - Update SSO router tests to use handle_oauth_callback_with_tokens - Update admin module tests for Keycloak-aware logout behavior with separate coverage for keycloak-enabled and keycloak-disabled paths - Add expired id_token_hint omission test - Add id_token cookie size and max_age validation tests Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
1581e4a to
5a171c6
Compare
suciu-daniel
pushed a commit
that referenced
this pull request
Feb 16, 2026
…ult for development testing (#2949) * feat(keycloak): add Keycloak SSO to docker-compose for development testing - Add Keycloak service to docker-compose.yml (pinned to v26.1) with pre-configured realm export for local SSO development - Add docker-compose.sso.yml overlay for SSO-specific configuration - Add "sso" to testing and inspector service profiles so --profile sso brings up the full dev stack (Keycloak + testing + inspector) - Implement SSO bootstrap utility for automatic Keycloak realm/client setup - Add Keycloak discovery helper with well-known endpoint support - Enhance SSO service with id_token claims fallback for split-host configurations (restricted to 401 + split-host detection only) - Improve admin.py SSO logout with proper id_token_hint RP-initiated flow - Skip expired id_token_hint in logout URL to avoid Keycloak rejection - Add cookie size validation for id_token storage (>3.8KB warning) - Use dynamic max_age for SSO cookies matching token_expiry setting - Improve error handling and logging throughout SSO flows - Add sso-keycloak-tutorial and developer workstation documentation - Add test-sso-flow.sh script for manual SSO flow verification - Add Makefile targets for Keycloak lifecycle management Closes #2949 Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> * test(keycloak): add and update tests for Keycloak SSO integration - Add SSO service tests for Keycloak userinfo fallback, callback error handling, personal team resolution, and user authentication flows - Add Keycloak discovery and SSO bootstrap unit tests - Update SSO router tests to use handle_oauth_callback_with_tokens - Update admin module tests for Keycloak-aware logout behavior with separate coverage for keycloak-enabled and keycloak-disabled paths - Add expired id_token_hint omission test - Add id_token cookie size and max_age validation tests Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> --------- Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
vishu-bh
pushed a commit
that referenced
this pull request
Feb 18, 2026
…ult for development testing (#2949) * feat(keycloak): add Keycloak SSO to docker-compose for development testing - Add Keycloak service to docker-compose.yml (pinned to v26.1) with pre-configured realm export for local SSO development - Add docker-compose.sso.yml overlay for SSO-specific configuration - Add "sso" to testing and inspector service profiles so --profile sso brings up the full dev stack (Keycloak + testing + inspector) - Implement SSO bootstrap utility for automatic Keycloak realm/client setup - Add Keycloak discovery helper with well-known endpoint support - Enhance SSO service with id_token claims fallback for split-host configurations (restricted to 401 + split-host detection only) - Improve admin.py SSO logout with proper id_token_hint RP-initiated flow - Skip expired id_token_hint in logout URL to avoid Keycloak rejection - Add cookie size validation for id_token storage (>3.8KB warning) - Use dynamic max_age for SSO cookies matching token_expiry setting - Improve error handling and logging throughout SSO flows - Add sso-keycloak-tutorial and developer workstation documentation - Add test-sso-flow.sh script for manual SSO flow verification - Add Makefile targets for Keycloak lifecycle management Closes #2949 Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> * test(keycloak): add and update tests for Keycloak SSO integration - Add SSO service tests for Keycloak userinfo fallback, callback error handling, personal team resolution, and user authentication flows - Add Keycloak discovery and SSO bootstrap unit tests - Update SSO router tests to use handle_oauth_callback_with_tokens - Update admin module tests for Keycloak-aware logout behavior with separate coverage for keycloak-enabled and keycloak-disabled paths - Add expired id_token_hint omission test - Add id_token cookie size and max_age validation tests Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> --------- Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> Signed-off-by: Vishu Bhatnagar <vishu.bhatnagar@ibm.com>
kcostell06
pushed a commit
to kcostell06/mcp-context-forge
that referenced
this pull request
Feb 24, 2026
…ult for development testing (IBM#2949) * feat(keycloak): add Keycloak SSO to docker-compose for development testing - Add Keycloak service to docker-compose.yml (pinned to v26.1) with pre-configured realm export for local SSO development - Add docker-compose.sso.yml overlay for SSO-specific configuration - Add "sso" to testing and inspector service profiles so --profile sso brings up the full dev stack (Keycloak + testing + inspector) - Implement SSO bootstrap utility for automatic Keycloak realm/client setup - Add Keycloak discovery helper with well-known endpoint support - Enhance SSO service with id_token claims fallback for split-host configurations (restricted to 401 + split-host detection only) - Improve admin.py SSO logout with proper id_token_hint RP-initiated flow - Skip expired id_token_hint in logout URL to avoid Keycloak rejection - Add cookie size validation for id_token storage (>3.8KB warning) - Use dynamic max_age for SSO cookies matching token_expiry setting - Improve error handling and logging throughout SSO flows - Add sso-keycloak-tutorial and developer workstation documentation - Add test-sso-flow.sh script for manual SSO flow verification - Add Makefile targets for Keycloak lifecycle management Closes IBM#2949 Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> * test(keycloak): add and update tests for Keycloak SSO integration - Add SSO service tests for Keycloak userinfo fallback, callback error handling, personal team resolution, and user authentication flows - Add Keycloak discovery and SSO bootstrap unit tests - Update SSO router tests to use handle_oauth_callback_with_tokens - Update admin module tests for Keycloak-aware logout behavior with separate coverage for keycloak-enabled and keycloak-disabled paths - Add expired id_token_hint omission test - Add id_token cookie size and max_age validation tests Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> --------- Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This epic adds a complete local Keycloak development path for SSO testing in compose, and hardens the SSO callback path so local auth-code login is reliable by default when the SSO profile is enabled.
Closes #2875
What Changed
1) Compose + Keycloak dev profile
docker-compose.sso.ymlas an overlay for local SSO testing.infra/keycloak/realm-export.json.compose-sso/sso-test-loginworkflows.2) Keycloak discovery/bootstrap wiring
localhost:8180) for auth redirectkeycloak:8080) for backchannel calls3) SSO callback reliability fixes
SSOService:id_tokenclaims.authenticate_or_create_userby snapshotting resolved values before commit/await boundaries.4) Test coverage and smoke checks
id_tokenfallback behaviorscripts/test-sso-flow.shand wiredmake sso-test-loginto validate:/adminwith auth cookie set5) Documentation
error=sso_failedChanged Files (High-Level)
docker-compose.yml,docker-compose.sso.yml,.env.example,mcpgateway/config.py,mcpgateway/utils/keycloak_discovery.py,mcpgateway/utils/sso_bootstrap.pymcpgateway/services/sso_service.pytests/unit/mcpgateway/services/test_sso_service.py,tests/unit/mcpgateway/utils/test_keycloak_discovery.py,tests/unit/mcpgateway/utils/test_sso_bootstrap.pyscripts/test-sso-flow.shdocs/docs/deployment/compose.md,docs/docs/development/developer-workstation.md,docs/docs/development/index.md,docs/docs/manage/sso.md,docs/docs/manage/sso-keycloak-tutorial.mddocs/docs/design/images/classes.svg,docs/docs/design/images/code2flow.svg,docs/docs/design/images/packages.svgValidation Performed
pytest tests/unit/mcpgateway/services/test_sso_service.py -qpytest tests/unit/mcpgateway/routers/test_sso_router.py -qpytest tests/unit/mcpgateway/utils/test_keycloak_discovery.py tests/unit/mcpgateway/utils/test_sso_bootstrap.py -qmake sso-test-login(includes browser callback check)docker compose -f docker-compose.yml -f docker-compose.sso.yml --profile sso up -d --buildNotes / Follow-up