Skip to content

feat: Extract groups and namespaces claims from JWT in OidcTokenParser#6089

Draft
aniketpalu wants to merge 22 commits intofeast-dev:masterfrom
aniketpalu:oidc-support
Draft

feat: Extract groups and namespaces claims from JWT in OidcTokenParser#6089
aniketpalu wants to merge 22 commits intofeast-dev:masterfrom
aniketpalu:oidc-support

Conversation

@aniketpalu
Copy link
Contributor

@aniketpalu aniketpalu commented Mar 10, 2026

What this PR does / why we need it:

Extracts groups and namespaces claims from the decoded JWT in OidcTokenParser.user_details_from_access_token() and passes them to the User object.

Previously, the OIDC token parser only read preferred_username and resource_access roles from the JWT, always returning User(username, roles) with empty groups and namespaces. This meant that GroupBasedPolicy, NamespaceBasedPolicy, and CombinedGroupNamespacePolicy could never grant access for OIDC-authenticated users — even when the JWT contained valid claims.


Server-Side Changes

Files: oidc_token_parser.py, utils.py
When auth.type: oidc, the Feast server now handles two types of incoming tokens:

  • Keycloak JWTs (from human users via UI/Swagger) — validated against Keycloak JWKS, extracts preferred_username, groups, and roles. Used by GroupBasedPolicy.
  • Kubernetes SA tokens (from workbench pods) — detected via kubernetes.io claim, delegated to existing KubernetesTokenParser which validates via TokenAccessReview and extracts namespace. Used by NamespaceBasedPolicy.
    Token type detection happens before any cryptographic validation — a lightweight unverified decode checks for the kubernetes.io claim. If the K8s API is unavailable (non-K8s deployment), the server falls back to Keycloak-only mode.

Client-Side Changes

Files: oidc_authentication_client_manager.py, auth_model.py, repo_config.py
OidcAuthClientManager.get_token() now supports multiple token sources with clear priority:

  • Explicit config (exclusive — only one is used): token, token_env_var, or client_secret + IDP network call
  • Bare config fallbacks (when nothing explicit is set): FEAST_OIDC_TOKEN env var, then mounted SA token file
    This means a workbench pod with just auth: {type: oidc} automatically picks up its SA token. Human users can set FEAST_OIDC_TOKEN. Existing client_credentials/ROPG flows are unchanged.

Which issue(s) this PR fixes:

#6088

Misc


Open with Devin

@aniketpalu aniketpalu requested a review from a team as a code owner March 10, 2026 12:50
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View 5 additional findings in Devin Review.

Open in Devin Review

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

…t, reject stray auth_discovery_url/client_id without client_secret

Signed-off-by: Aniket Paluskar <[email protected]>
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

… _is_oidc_client_config helper

Signed-off-by: Aniket Paluskar <[email protected]>
Signed-off-by: Aniket Paluskar <[email protected]>
Signed-off-by: Aniket Paluskar <[email protected]>
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

View 18 additional findings in Devin Review.

Open in Devin Review

Signed-off-by: Aniket Paluskar <[email protected]>
@aniketpalu aniketpalu marked this pull request as draft March 11, 2026 10:54
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

View 20 additional findings in Devin Review.

Open in Devin Review

Signed-off-by: Aniket Paluskar <[email protected]>
…eQL substring sanitization check

Signed-off-by: Aniket Paluskar <[email protected]>
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.

1 participant