Repository navigation
feat: seed Enterprise SSO (SAML) login IDP in auth_providers (OHE-4193) - #1445
Merged
Merged
Conversation
Adds migration 218, modelled on 189, which seeds a Keycloak-routed login IDP row (kc_idp_hint=enterprise_sso) when ENABLE_ENTERPRISE_SSO is set. Resolves OHE-4193 Co-authored-by: openhands <openhands@all-hands.dev>
Contributor
|
|
Contributor
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
tofarr
marked this pull request as ready for review
November 18, 2026 14:02
Contributor
|
🚀 Released in 1.95.0. |
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.
HUMAN:
I tested this on shared-2 - I set up an SAML idp in replicated and then deployed the new version and saw the values copied.
AGENT:
Why
Migration 189 seeds
auth_providerslogin rows for GitHub/GitLab/Bitbucket so the OAuth v2 login page keeps the buttons the legacy login page had. The legacy page also showed an Enterprise SSO button whenENABLE_ENTERPRISE_SSOis set (the Replicated "Enterprise SSO (SAML)" option), but nothing seeds a row for it, so those installs lose the SAML button once OAuth v2 login is on. John Mason and Alona asked for this.Summary
218_seed_enterprise_sso_login_idp.py, modelled on 189. WhenENABLE_ENTERPRISE_SSOistrue/1andKEYCLOAK_CLIENT_IDis set, it seeds oneis_idpOAuthProviderDetailsrow (provider_type='enterprise_sso') that reuses the Keycloak client and appendskc_idp_hint=enterprise_ssoto the authorization URL. The chart'skeycloak-configinit container already creates that Keycloak SAML identity provider.enabled = trueexplicitly. Migration 196 made the column default tofalse, so omitting it (as 189 could) would hide the button.kc_idp_hint=enterprise_ssomarker rather thanprovider_type, so an admin-added direct OIDCenterprise_ssorow neither blocks nor gets removed. Downgrade deletes only the hinted row.legacy_keycloak_type: its validator only allows git providers, and there is no git token behind an SSO login.is_sso_provideralready excludes rows withclient_id == KEYCLOAK_CLIENT_ID, so licensing is unaffected.ENTERPRISE_SSO_DISPLAY_NAME, falling back toCompany SSO(the Replicated default). Icon and colour are a generic shield and indigo, as there is no legacy button to copy.Issue Number
Linear OHE-4193
How to Test
uv run pytest tests/unit/test_migration_218_seed_enterprise_sso_login_idp.py tests/unit/test_migration_graph.py(needs Docker). The new tests run real Alembic up/down against PostgreSQL and cover:true/1/TRUE, disabled values, missing Keycloak client, idempotency, coexistence with a direct OIDC row, secret encryption round-trip throughAuthProvider, and downgrade. 22 tests pass together with the 189 migration tests; pre-commit passes. Not tested against a real Keycloak/Replicated install.Video/Screenshots
I had this config in replicated...

When the cluster was updated, this became a config in Auth providers:
It is an OAuth provider - because it just connects to keycloak. The login flow works as previously...
Screen.Recording.2026-11-18.at.2.01.13.PM.mov
Type
Notes
ENTERPRISE_SSO_DISPLAY_NAMEis currently only set on thekeycloak-configinit container in OpenHands-Cloud'sdeployment.yaml, not onmigrate-db. Until the chart also puts it inopenhands.env, the row is titledCompany SSO; admins can rename it. That follow-up is a chart change in OpenHands-Cloud.This PR was created by an AI agent (OpenHands) on behalf of Tim O'Farrell.
@tofarr can click here to continue refining the PR
Enterprise server image for this PR: