Skip to content

fix: add OKTA and KEYCLOAK to tenant seeding allowlist#6249

Merged
shahargl merged 1 commit into
keephq:mainfrom
QuinnClaw:fix/auth-type-tenant-seeding
Apr 16, 2026
Merged

fix: add OKTA and KEYCLOAK to tenant seeding allowlist#6249
shahargl merged 1 commit into
keephq:mainfrom
QuinnClaw:fix/auth-type-tenant-seeding

Conversation

@QuinnClaw
Copy link
Copy Markdown
Contributor

@QuinnClaw QuinnClaw commented Apr 14, 2026

Summary

Fixes #6246

OKTA and KEYCLOAK auth types were missing from the tenant seeding allowlist in on_starting() (keep/api/config.py), causing the tenant table to remain empty on fresh database deployments. Users experienced an infinite redirect loop between /signin and /incidents after successful SSO login because no tenant row existed.

Changes

  • Added IdentityManagerTypes.KEYCLOAK.value and IdentityManagerTypes.OKTA.value to the auth type allowlist that gates try_create_single_tenant()
  • Added both types to excluded_from_default_user since users authenticate through the external IdP (consistent with OAUTH2PROXY and ONELOGIN behavior)

Root Cause

The allowlist in on_starting() only included DB, NOAUTH, OAUTH2PROXY, and ONELOGIN. OKTA and KEYCLOAK were missing despite being valid single-tenant auth types in the IdentityManagerTypes enum.

Testing

  • Verified the IdentityManagerTypes enum includes both KEYCLOAK and OKTA
  • The change is additive — no existing behavior is modified for other auth types

Note

Low Risk
Low risk, additive change to startup tenant seeding logic; main impact is ensuring fresh deployments using Okta/Keycloak create the expected tenant row and avoid redirect loops.

Overview
Ensures single-tenant seeding runs when AUTH_TYPE is keycloak or okta by adding both to the allowlist gating try_create_single_tenant().

Also excludes these auth types from default-user creation (matching oauth2proxy/onelogin behavior) since users authenticate via the external IdP.

Reviewed by Cursor Bugbot for commit 6eec7d7. Bugbot is set up for automated code reviews on this repo. Configure here.

OKTA and KEYCLOAK auth types were missing from the allowlist in
on_starting(), causing the tenant table to remain empty on fresh
database deployments. This resulted in an infinite redirect loop
between /signin and /incidents after successful SSO authentication.

Also adds both types to excluded_from_default_user since users
authenticate through the external IdP.

Fixes keephq#6246
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Apr 14, 2026
@QuinnClaw
Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 14, 2026

CLA assistant check
All committers have signed the CLA.

@dosubot dosubot Bot added the Bug Something isn't working label Apr 14, 2026
@ahbeigi
Copy link
Copy Markdown
Contributor

ahbeigi commented Apr 14, 2026

Thanks for contributing @QuinnClaw . this PR seems to be a duplication of #6247.

Copy link
Copy Markdown
Member

@shahargl shahargl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Apr 16, 2026
@shahargl shahargl merged commit 4f7981e into keephq:main Apr 16, 2026
10 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

🔥 Fantastic work @QuinnClaw! Your very first PR to keep has been merged! 🎉🥳

You've just taken your first step into open-source, and we couldn't be happier to have you onboard. 🙌
If you're feeling adventurous, why not dive into another issue and keep contributing? The community would love to see more from you! 🚀

For any support, feel free to reach out on the community: https://slack.keephq.dev. Happy coding! 👩‍💻👨‍💻

wsimon1982 pushed a commit to wsimon1982/keep that referenced this pull request May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🐛 Bug]: AUTH_TYPE=OKTA/KEYCLOAK/AZUREAD skips tenant seeding on fresh database → infinite redirect loop

4 participants