Skip to content

feat(sso): add SSO_ENTRA_TEAM_MAPPING env var for declarative team mapping#3999

Closed
ecthelion77 wants to merge 1 commit intoIBM:mainfrom
forterro:feat/sso-entra-team-mapping-upstream
Closed

feat(sso): add SSO_ENTRA_TEAM_MAPPING env var for declarative team mapping#3999
ecthelion77 wants to merge 1 commit intoIBM:mainfrom
forterro:feat/sso-entra-team-mapping-upstream

Conversation

@ecthelion77
Copy link
Copy Markdown
Contributor

✨ Feature / Enhancement PR

🔗 Epic / Issue

Closes #3997


🚀 Summary

Add SSO_ENTRA_TEAM_MAPPING environment variable to declaratively configure Entra ID group-to-team mapping, enabling GitOps workflows for Kubernetes/Helm deployments. This brings Entra ID to parity with Okta, which already has SSO_OKTA_TEAM_MAPPING.


💡 Implementation

config.py: New sso_entra_team_mapping field (Dict[str, Any], default {}). Pydantic handles JSON parsing from the env var automatically.

sso_bootstrap.py:

  1. Entra provider definition uses settings.sso_entra_team_mapping instead of hardcoded {}
  2. Bootstrap merge logic upgraded from simple preservation to smart merge (same strategy already used for provider_metadata): env provides the base mapping, DB values override — so Admin API changes survive pod restarts while the env-defined base mapping is always present

Usage example (Helm values):

env:
  SSO_ENTRA_TEAM_MAPPING: '{"ab12cd34-group-id": {"team_id": "dev-team", "role": "member"}}'

🧪 Checks

  • make lint passes — ⚠️ Not run (no local dev env)
  • make test passes — ⚠️ Not run (no local dev env)
  • Tested in production Kubernetes (3+ weeks) with multiple Entra ID group mappings

📓 Notes

✅ Checklist

  • DCO Signed-off-by included
  • No secrets/credentials committed

…pping

Add a new SSO_ENTRA_TEAM_MAPPING setting (JSON dict) to configure
Entra ID group-to-team mapping declaratively via environment variable,
enabling GitOps workflows for Kubernetes/Helm deployments.

Previously, team_mapping for the Entra provider was hard-coded to {}
in get_predefined_sso_providers(), making it impossible to set via env.
The existing preservation logic only kept DB mappings when env was
empty — it could not merge env + DB mappings.

Changes:
- config.py: Add sso_entra_team_mapping field (Dict[str, Any],
  default={})
- sso_bootstrap.py: Use settings.sso_entra_team_mapping instead of {}
  for the Entra provider definition
- sso_bootstrap.py: Replace simple preservation with smart merge
  (env base + DB override) — same strategy already used for
  provider_metadata. Admin API changes survive restarts while env
  provides the base mapping.

This brings Entra ID to parity with Okta, which already supports
SSO_OKTA_TEAM_MAPPING.

Fixes IBM#3997

Signed-off-by: Olivier Gintrand <olivier.gintrand@forterro.com>
@ecthelion77
Copy link
Copy Markdown
Contributor Author

Closing in favor of #4149 which includes this change as part of the comprehensive team management feature (role hierarchy, OIDC group sync, admin UI team scoping, team ownership isolation).

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.

[FEATURE]: Add SSO_ENTRA_TEAM_MAPPING env var for declarative team mapping

2 participants