Repository navigation
Fixes #28781: Test Configuration option for SSO settings before save - #28780
Conversation
Adds a "Test Configuration" button to Settings > Preferences > SSO that validates SSO settings against the backend (OIDC discovery, JWKS, LDAP bind, SAML cert/connectivity, client credentials) without persisting, surfacing per-field errors before an admin commits a config that could lock them out. Also adds a lockout warning for new configurations and reconciles the SecurityValidationResponse types with the real schema. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
✅ PR checks passedThe linked issue has a description and all required Shipping project fields set. Thanks! |
Replace the English fallback for the four new SSO test/validation message
keys with proper translations in all 18 non-English locales (de, es, fr,
gl, nl, pt-br, pt-pt, ru, tr, ja, ko, zh-cn, zh-tw, th, ar, he, fa, mr),
preserving the {{count}} interpolation placeholder.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🔴 Playwright Results — 1 failure(s), 16 flaky✅ 4278 passed · ❌ 1 failed · 🟡 16 flaky · ⏭️ 88 skipped
Genuine Failures (failed on all attempts)❌
|
…tion Backend (SystemResourceIT): assert POST /v1/system/security/validate is admin-only — admin can validate, a non-admin (user1) is forbidden (403). Extract the shared SecurityConfiguration into a buildBasicSecurityConfig() helper reused by the update + validate tests. UI (SSOConfiguration.spec.ts): cover the Test Configuration flow — button and lockout warning appear for a new config; a mocked successful validate shows the success banner without signing the admin out; a mocked failure surfaces the error banner. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Drop the redundant failure InlineAlert in handleTestConfiguration's catch block; handleApiError already surfaces thrown errors (toast or per-field highlights), so the banner was duplicate messaging. - Reword the success message (all locales) to not reference the not-yet- shipped "Test Login" round-trip, which would point admins at a missing action. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…uilder Re-add `.filter(parts -> parts.length == 2)` to the shared SecurityUtil.buildPrincipalClaimsMapping so a malformed mapping entry (e.g. no ':') is skipped instead of throwing ArrayIndexOutOfBoundsException on s[1]. Because the helper is shared, JwtFilter and the Test Login dry-run still parse identically (valid configs unchanged); a no-colon entry would previously have crashed JwtFilter construction, so live auth is only made more defensive. Also move the mapping/order build inside the try in resolveIdentityFromClaims so a direct caller passing a malformed candidate config (e.g. duplicate mapping keys) gets a graceful failure() result instead of an uncaught exception. Adds a regression test asserting a malformed entry is skipped and resolution still succeeds. TestLoginServiceTest 9/9; mvn spotless applied. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Gate the alerts wrapper so it no longer emits an empty 16px-margin div when no alert is shown, and move inter-alert spacing to a single flex-gap system instead of mixing tw:mt-4 with per-alert m-b-md. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| return listOrEmpty(jwtPrincipalClaimsMapping).stream() | ||
| .map(s -> s.split(":")) | ||
| .filter(parts -> parts.length == 2) | ||
| .collect(Collectors.toMap(s -> s[0], s -> s[1])); |
There was a problem hiding this comment.
Using
split(":") without a limit silently drops any mapping entry that contains more than one colon. With the new filter(parts -> parts.length == 2), an entry like "username:my:claim" is discarded entirely; the old JwtFilter code would have used parts[0] and parts[1] (treating it as username → my). Because buildPrincipalClaimsMapping now backs the live JwtFilter as well, any existing deployment whose jwtPrincipalClaimsMapping contains a claim name with a colon would silently lose that mapping on upgrade. Using split(":", 2) instead preserves the old behaviour and handles such names correctly.
| return listOrEmpty(jwtPrincipalClaimsMapping).stream() | |
| .map(s -> s.split(":")) | |
| .filter(parts -> parts.length == 2) | |
| .collect(Collectors.toMap(s -> s[0], s -> s[1])); | |
| return listOrEmpty(jwtPrincipalClaimsMapping).stream() | |
| .map(s -> s.split(":", 2)) | |
| .filter(parts -> parts.length == 2) | |
| .collect(Collectors.toMap(s -> s[0], s -> s[1])); |
| ): Record<string, string | boolean | WebStorageStateStore> => { | ||
| const { authority = '', clientId = '', callbackUrl, scope } = authClient; | ||
| const testStore = new WebStorageStateStore({ | ||
| store: globalThis.localStorage, | ||
| prefix: SSO_TEST_LOGIN_STORE_PREFIX, | ||
| }); | ||
|
|
||
| return { | ||
| authority, | ||
| client_id: clientId, | ||
| redirect_uri: getRedirectUri(callbackUrl), | ||
| response_type: 'id_token', | ||
| scope: scope || 'openid email profile', | ||
| loadUserInfo: false, | ||
| userStore: testStore, | ||
| stateStore: testStore, | ||
| }; |
There was a problem hiding this comment.
Implicit flow (
id_token) hardcoded — silently fails for Google and default Azure AD configs
getCandidateUserManagerConfig always requests response_type: 'id_token', which is the OAuth 2.0 implicit flow. Google has disabled implicit-flow grants for new (and many existing) app registrations, and Azure AD v2 endpoints disable it by default unless explicitly toggled on in the app manifest. For admins testing either of those providers, signinPopup() will fail and the only feedback is the generic message.sso-test-login-popup-failed message, with no indication that the issue is the flow type. Switching to response_type: 'code' with PKCE (usePkce: true) is supported by all the listed providers and avoids the redirect_uri fragment limitation that blocks implicit flow on some providers.
|
|
Code Review ✅ Approved 8 resolved / 8 findingsImplements an SSO configuration validation and interactive test-login feature to prevent admin lockouts, including comprehensive backend dry-run service and UI modal integration. Multiple issues regarding state management, error handling, and claim mapping logic were addressed during review. ✅ 8 resolved✅ Edge Case: Test result banner goes stale after edits/provider change
✅ Quality: Duplicate notification on test request failure
✅ Quality: Test success message references unimplemented 'Test Login'
✅ Quality: Backend validation failure shown as popup cancellation
✅ Quality: TestLoginResult stage enum doc lists unused stages
...and 3 more resolved from earlier reviews OptionsDisplay: compact → Showing less information. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |



Describe your changes:
Fixes #28781
Adds a Test capability to Settings → Preferences → SSO so admins can verify their SSO settings before committing them — today a wrong config silently locks them out (saving a new config signs them out and redirects to
/signin).Phase 1 — Test Configuration (static): a button that runs the existing, non-persisting
POST /v1/system/security/validate(OIDC discovery/JWKS reachability, LDAP bind, SAML cert/connectivity, client credentials) and surfaces per-field errors inline, plus a lockout warning for new configs.Phase 2 — Test Login (interactive round-trip): for public-client OIDC providers (Google, Okta, Azure, Auth0, AWS Cognito, Custom OIDC) the admin signs in with the candidate (unsaved) settings in an isolated popup; the resulting
id_tokenis sent to a new admin-only endpointPOST /v1/system/security/test-login/validate-tokenthat reports the identity, roles, teams and domain outcome a real login would produce.Security: no new public/unauthenticated endpoint is added (every existing auth servlet is a real login that issues sessions); the only new endpoint is admin-gated (
authorizer.authorizeAdmin). The backendTestLoginServiceis a stateless dry-run that reuses the liveJwtFilter+SecurityUtilresolution but performs zero side effects — no user create/update, no JWT/refresh token, no session. The frontend popup uses a dedicated prefixed token store and a dedicated/sso-test-callbackroute (guarded inindex.tsxso the app never mounts there), so a test never touches the admin's current session.Type of change:
High-level design:
Phase 1 reuses the existing validate endpoint (no backend change). Phase 2 adds
org.openmetadata.schema.system.TestLoginResult/TestLoginTokenRequestschemas,TestLoginService(dry-run identity resolution), and one admin-onlySystemResourceendpoint. The UI adds auseSsoTestLoginhook (oidc-clientsigninPopupagainst a candidate-config UserManager), anSsoTestLoginModal, and an inert popup-callback bootstrap. SAML and LDAP/Basic round-trip are tracked as a follow-up (#28784); their connectivity/credentials are already covered by Phase 1's validator.Tests:
Unit tests
SSOConfigurationForm(Test Configuration),useSsoTestLogin(round-trip wiring + asserts the app token storage is never written),SsoTestLoginModal. SettingsSso suite: 115/115.TestLoginServiceTest(8/8): identity/role/team/domain resolution across Google/Okta/Azure/Auth0/Cognito/Custom-OIDC claim shapes, principal-claims mapping, domain enforcement, and failure paths.Backend integration tests
SystemResourceIT: validate and test-login endpoints are admin-only (non-admin → 403); admin test-login returns a result with no credentials (no access/refresh/JWT token) in the response.Playwright (UI) tests
SSOConfiguration.spec.ts: Test Configuration success/failure (mocked).SSOTestLogin.spec.ts: Test Login offered for every public-client OIDC provider and NOT for confidential/SAML/LDAP; result modal opens (IdP popup stubbed — real provider sign-in isn't possible in CI).Manual testing performed
mvn -pl openmetadata-service test -Dtest=TestLoginServiceTest— 8/8 pass; service + integration-tests modules compile; spotless applied.yarn test src/components/SettingsSso— 115/115; eslint + prettier clean; i18n synced + translated across all locales.UI screen recording / screenshots:
Pending — to be attached on the PR (UI change).
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.🤖 Generated with Claude Code
Greptile Summary
This PR adds a Test Configuration button (Phase 1 — reuses the existing
POST /v1/system/security/validateendpoint) and an interactive Test Login button (Phase 2 — OIDC popup flow + new admin-onlyPOST /v1/system/security/test-login/validate-tokenendpoint) to the SSO settings page, so admins can verify candidate SSO configurations before saving them and risking a lockout.TestLoginServiceperforms a fully stateless dry-run: it constructs a transientJwtFilterfrom the candidate config, validates the browser-suppliedid_tokenagainst the candidate JWKS, and resolves the identity/roles/teams/domain without creating any user, session, or token.omSsoTestLogin.*) andisSsoTestLoginPopup()detection ensures the test flow never touches the admin's live session; theindex.tsxguard prevents the full app from mounting in the popup.split(\":\")without a limit of 2 inbuildPrincipalClaimsMapping(now shared with the productionJwtFilter) silently drops entries containing multiple colons, and the hardcodedresponse_type: 'id_token'(implicit flow) in the popup config fails silently for providers like Google and default Azure AD that have disabled that flow.Confidence Score: 4/5
Safe to merge with the noted caveats; the core lockout-prevention feature works correctly, and the admin-only gate and zero-side-effects guarantee are both verified by integration tests.
The
buildPrincipalClaimsMappingchange now backs the productionJwtFilter, so the subtlesplit(":")vssplit(":", 2)difference could silently drop a valid mapping entry on upgrade for an unusual (but legal) config. The hardcoded implicit flow will make Test Login Phase 2 non-functional for admins whose Google or Azure AD tenant has implicit flow disabled, with no actionable error message.SecurityUtil.java(split limit change now affects the live auth path) andAuthProvider.util.ts(implicit flow config for the popup).Important Files Changed
Sequence Diagram
%%{init: {'theme': 'neutral'}}%% sequenceDiagram participant Admin as Admin Browser participant Popup as Test Popup (isolated) participant IdP as Identity Provider participant BE as Backend /system/security Note over Admin,BE: Phase 1 — Test Configuration (static) Admin->>BE: POST /security/validate (candidate config) BE-->>Admin: SecurityValidationResponse (errors / success) Note over Admin,BE: Phase 2 — Test Login (interactive) Admin->>Popup: Opens popup via signinPopup() Note over Popup: localStorage: omSsoTestLogin.* prefix Popup->>IdP: OIDC authorization request (candidate authority/clientId) IdP-->>Popup: "id_token in fragment (#)" Note over Popup: isSsoTestLoginPopup() → true, app NOT mounted Popup->>Popup: signinPopupCallback() completes handshake Popup-->>Admin: id_token returned to opener Admin->>BE: POST /security/test-login/validate-token (candidate config + id_token) Note over BE: authorizer.authorizeAdmin() check BE->>BE: new JwtFilter(candidate) → validateJwtAndGetClaims() BE->>BE: SecurityUtil: resolve principal/email/roles/teams/domain BE-->>Admin: TestLoginResult (no token, no session, no user created)%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% sequenceDiagram participant Admin as Admin Browser participant Popup as Test Popup (isolated) participant IdP as Identity Provider participant BE as Backend /system/security Note over Admin,BE: Phase 1 — Test Configuration (static) Admin->>BE: POST /security/validate (candidate config) BE-->>Admin: SecurityValidationResponse (errors / success) Note over Admin,BE: Phase 2 — Test Login (interactive) Admin->>Popup: Opens popup via signinPopup() Note over Popup: localStorage: omSsoTestLogin.* prefix Popup->>IdP: OIDC authorization request (candidate authority/clientId) IdP-->>Popup: "id_token in fragment (#)" Note over Popup: isSsoTestLoginPopup() → true, app NOT mounted Popup->>Popup: signinPopupCallback() completes handshake Popup-->>Admin: id_token returned to opener Admin->>BE: POST /security/test-login/validate-token (candidate config + id_token) Note over BE: authorizer.authorizeAdmin() check BE->>BE: new JwtFilter(candidate) → validateJwtAndGetClaims() BE->>BE: SecurityUtil: resolve principal/email/roles/teams/domain BE-->>Admin: TestLoginResult (no token, no session, no user created)Reviews (1): Last reviewed commit: "refactor(ui): consolidate SSO config ale..." | Re-trigger Greptile