Skip to content

✨(backend) populate User.teams from a configurable OIDC claim#763

Open
maartendra wants to merge 1 commit into
suitenumerique:mainfrom
maartendra:feat/configurable-oidc-teams-claim
Open

✨(backend) populate User.teams from a configurable OIDC claim#763
maartendra wants to merge 1 commit into
suitenumerique:mainfrom
maartendra:feat/configurable-oidc-teams-claim

Conversation

@maartendra

Copy link
Copy Markdown

Purpose

User.teams was a hardcoded return [], so every deployer who wants team-based access had to fork or monkeypatch the model to wire it to their identity provider's groups. This makes it config-driven, matching the existing OIDC_STORE_CLAIMS mechanism.

What changes

  • New setting OIDC_TEAMS_CLAIM (default None, fully backward-compatible).
  • When set, get_extra_claims stores that claim and User.teams returns self.claims[OIDC_TEAMS_CLAIM].
  • No behaviour change when unset.

Usage

OIDC_TEAMS_CLAIM=groups

With an IdP emitting a groups claim, User.teams returns the user's groups, enabling ItemAccess(team=…) team workspaces out of the box.

Tests

  • User.teams: unset → []; configured → the claim list; configured-but-absent/null → [].
  • Auth backend: the team claim is stored even when not listed in OIDC_STORE_CLAIMS, and surfaces via User.teams.

Docs (docs/env.md) and CHANGELOG updated.

Closes #762.

User.teams shipped as a hardcoded empty list, so deployers had to patch the
model to wire team-based access to their identity provider's groups. Add an
OIDC_TEAMS_CLAIM setting: when set, that claim is stored on the user (alongside
OIDC_STORE_CLAIMS) and read by User.teams. Defaults to None, preserving the
previous behaviour. Companion to the existing OIDC_STORE_CLAIMS mechanism.
@sonarqubecloud

sonarqubecloud Bot commented Jul 7, 2026

Copy link
Copy Markdown

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.

Make User.teams populatable from an OIDC claim (config-driven)

1 participant