Skip to content

[CXP-295] fix: support authSetting profile field as fallback when IDP discovery fails#40

Merged
luisina-santos merged 1 commit intomainfrom
luisinasantos/add-auth-setting-fallback
Mar 12, 2026
Merged

[CXP-295] fix: support authSetting profile field as fallback when IDP discovery fails#40
luisina-santos merged 1 commit intomainfrom
luisinasantos/add-auth-setting-fallback

Conversation

@luisina-santos
Copy link
Copy Markdown
Contributor

Summary

  • Adds authSetting as an optional account profile field in CreateAccount
  • When IDP auto-discovery yields no result (e.g. site-auth-configurations returns 404 on older on-premises Tableau Server <2023.3), the caller can now pass "authSetting": "SAML" (or "OPENID") in the profile to control the auth method directly
  • Without this fallback, Tableau defaults to TableauIDWithMFA when no idpConfigurationId is provided — wrong for customers using SAML/Okta (CXP-295, Zscaler)

Context

This is a follow-up to the v0.1.9 fix (commit 8c28935) which absorbed the 404 from site-auth-configurations gracefully. That fix stopped the hard failure but introduced silent wrong behavior: users were provisioned with TableauIDWithMFA instead of the site's SAML IDP.

Test plan

  • BUG-03 reproduced on v0.1.9: --api-version 3.21 forces 404 → user created with authSetting=TableauIDWithMFA (wrong)
  • FIX-05 verified on this branch: same --api-version 3.21 + "authSetting":"SAML" in profile → sync confirms authSetting=SAML
  • FIX-03 regression: normal IDP discovery still works when endpoint is available (sync confirms authSetting=SAML via idpConfigurationId)
  • No change to withMFA=true path or multi-IDP error path

QA plan: https://www.notion.so/31f4694ad846811db45be8d39ab5a7ca

🤖 Generated with Claude Code

… fails

When site-auth-configurations returns 404 (e.g. older on-premises Tableau
Server <2023.3), ListIdpConfigurations returns an empty list and
CreateAccount proceeds without an idpConfigurationId. Tableau then defaults
to TableauIDWithMFA, which is wrong for customers using SAML/OIDC.

This adds an authSetting profile field fallback: if IDP discovery yields no
result and the caller provides "authSetting" in the account profile (e.g.
"SAML", "OPENID"), it is passed directly to AddUserToSite, bypassing
discovery entirely.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@luisina-santos luisina-santos requested a review from a team March 10, 2026 17:58
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 10, 2026

Claude finished @luisina-santos's task in 1m 30s —— View job


PR Review: authSetting fallback support

  • Gather context and read changed files
  • Review code changes
  • Post review feedback

Overall: Looks good. The change is minimal, well-placed, and solves a real problem for older on-prem Tableau Server environments where IDP discovery isn't available.

What works well

  • Correct fallback ordering: The else if placement ensures IDP auto-discovery is always attempted first, and authSetting is only used when discovery returns nothing — this avoids any regression for environments where the endpoint works.
  • Minimal blast radius: 5 lines added, no structural changes, no new dependencies.
  • Good comment: The inline comment clearly explains when and why this branch is taken.

Suggestion: validate authSetting value

The authSetting value from the profile is passed directly to the Tableau API without validation. The codebase already has isAllowedAuthSetting() in pkg/client/helpers.go:115 that validates against ["SAML", "OPENID"]. Consider using it to reject invalid values early with a clear error, rather than letting Tableau return a potentially confusing API error:

} else if authSetting, _ := pMap["authSetting"].(string); authSetting != "" {
    if !client.IsAllowedAuthSetting(authSetting) {
        return nil, nil, nil, fmt.Errorf("baton-tableau: unsupported authSetting %q (allowed: SAML, OPENID)", authSetting)
    }
    reqBody.AuthSetting = authSetting
}

This would require exporting isAllowedAuthSetting (capitalize it), but it's a small change that improves the user experience. That said, this is a minor nit — Tableau's API will reject invalid values regardless, so the current code is functionally correct.

Fix this →

No issues found

  • No regressions to the withMFA path or multi-IDP error handling
  • The CreateUserRequest.AuthSetting field already has omitempty, so when neither path sets it, the field is correctly omitted from the API request
  • The type assertion pMap["authSetting"].(string) safely handles missing/wrong-type values via the blank identifier

@luisina-santos luisina-santos changed the title fix: support authSetting profile field as fallback when IDP discovery fails [CXP-254] fix: support authSetting profile field as fallback when IDP discovery fails Mar 10, 2026
@linear
Copy link
Copy Markdown

linear Bot commented Mar 10, 2026

@luisina-santos luisina-santos changed the title [CXP-254] fix: support authSetting profile field as fallback when IDP discovery fails [CXP-295] fix: support authSetting profile field as fallback when IDP discovery fails Mar 10, 2026
@luisina-santos luisina-santos merged commit 7abeaef into main Mar 12, 2026
7 checks passed
@luisina-santos luisina-santos deleted the luisinasantos/add-auth-setting-fallback branch March 12, 2026 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants