Add JWT/OIDC authentication support to Hashicorp Vault provider#61439
Conversation
This adds JWT/OIDC authentication method support to the Hashicorp Vault provider, enabling token-less authentication through identity federation. Key features: - New 'jwt' auth_type for VaultClient, VaultHook, and VaultBackend - Support for jwt_token parameter or automatic token retrieval from jwt_path - Configurable jwt_role for Vault role binding - Full backwards compatibility with existing auth methods Use cases enabled: - Kubernetes workload identity with projected service account tokens - Cloud provider identity (AWS IAM roles, GCP Workload Identity, Azure AD) - CI/CD pipelines (GitHub Actions OIDC, GitLab CI) - External identity providers (Auth0, Okta, Keycloak) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
|
67cfccc to
e41fbc4
Compare
This adds JWT/OIDC authentication method support to the Hashicorp Vault provider, enabling token-less authentication through identity federation. Key features: - New 'jwt' auth_type for VaultClient, VaultHook, and VaultBackend - Support for jwt_token parameter or automatic token retrieval from jwt_token_path - Default jwt_token_path set to /var/run/secrets/kubernetes.io/serviceaccount/token (standard Kubernetes service account token path) - Configurable jwt_role for Vault role binding - Full backwards compatibility with existing auth methods Use cases enabled: - Kubernetes workload identity with projected service account tokens - Cloud provider identity (AWS IAM roles, GCP Workload Identity, Azure AD) - CI/CD pipelines (GitHub Actions OIDC, GitLab CI) - External identity providers (Auth0, Okta, Keycloak) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
e41fbc4 to
8c4b25a
Compare
…client/vault_client.py Co-authored-by: Wei Lee <weilee.rx@gmail.com>
…t.py Co-authored-by: Wei Lee <weilee.rx@gmail.com>
…client/vault_client.py Co-authored-by: Wei Lee <weilee.rx@gmail.com>
Lee-W
left a comment
There was a problem hiding this comment.
a few nits, but overall looks good
Pass it might be better as it doesn't always goes with k8s |
Replace assert_called_with with call_args_list assertions in JWT tests to verify exact number of calls. Inline kwargs dicts directly into VaultHook() constructor calls where they are only used once. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@jason810496 would appreciate a second pair of eyes. Thanks! |
jason810496
left a comment
There was a problem hiding this comment.
Thank you for the PR! LGTM overall.
- fix documentaion - minor fiex
JWT is a general-purpose Vault auth method, not tied to Kubernetes. Remove the DEFAULT_JWT_TOKEN_PATH constant (which pointed to the K8s service account token path) and its fallback in VaultHook. Users must now explicitly provide either jwt_token or jwt_token_path when using JWT auth, otherwise _VaultClient raises a clear validation error. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
…he#61439) * Add JWT/OIDC authentication support to Hashicorp Vault provider This adds JWT/OIDC authentication method support to the Hashicorp Vault provider, enabling token-less authentication through identity federation. Key features: - New 'jwt' auth_type for VaultClient, VaultHook, and VaultBackend - Support for jwt_token parameter or automatic token retrieval from jwt_path - Configurable jwt_role for Vault role binding - Full backwards compatibility with existing auth methods Use cases enabled: - Kubernetes workload identity with projected service account tokens - Cloud provider identity (AWS IAM roles, GCP Workload Identity, Azure AD) - CI/CD pipelines (GitHub Actions OIDC, GitLab CI) - External identity providers (Auth0, Okta, Keycloak) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Update providers/hashicorp/src/airflow/providers/hashicorp/_internal_client/vault_client.py Co-authored-by: Wei Lee <weilee.rx@gmail.com> * Update providers/hashicorp/src/airflow/providers/hashicorp/hooks/vault.py Co-authored-by: Wei Lee <weilee.rx@gmail.com> * update the args order for methods * Update providers/hashicorp/src/airflow/providers/hashicorp/_internal_client/vault_client.py Co-authored-by: Wei Lee <weilee.rx@gmail.com> * apply fixes for oorder in new jwt parameter for docsstring * Address PR review: use stricter mock assertions and inline kwargs Replace assert_called_with with call_args_list assertions in JWT tests to verify exact number of calls. Inline kwargs dicts directly into VaultHook() constructor calls where they are only used once. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * - remove jwt token defaults - fix documentaion - minor fiex * Remove DEFAULT_JWT_TOKEN_PATH constant and K8s fallback from JWT auth JWT is a general-purpose Vault auth method, not tied to Kubernetes. Remove the DEFAULT_JWT_TOKEN_PATH constant (which pointed to the K8s service account token path) and its fallback in VaultHook. Users must now explicitly provide either jwt_token or jwt_token_path when using JWT auth, otherwise _VaultClient raises a clear validation error. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Wei Lee <weilee.rx@gmail.com>
…he#61439) * Add JWT/OIDC authentication support to Hashicorp Vault provider This adds JWT/OIDC authentication method support to the Hashicorp Vault provider, enabling token-less authentication through identity federation. Key features: - New 'jwt' auth_type for VaultClient, VaultHook, and VaultBackend - Support for jwt_token parameter or automatic token retrieval from jwt_path - Configurable jwt_role for Vault role binding - Full backwards compatibility with existing auth methods Use cases enabled: - Kubernetes workload identity with projected service account tokens - Cloud provider identity (AWS IAM roles, GCP Workload Identity, Azure AD) - CI/CD pipelines (GitHub Actions OIDC, GitLab CI) - External identity providers (Auth0, Okta, Keycloak) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Update providers/hashicorp/src/airflow/providers/hashicorp/_internal_client/vault_client.py Co-authored-by: Wei Lee <weilee.rx@gmail.com> * Update providers/hashicorp/src/airflow/providers/hashicorp/hooks/vault.py Co-authored-by: Wei Lee <weilee.rx@gmail.com> * update the args order for methods * Update providers/hashicorp/src/airflow/providers/hashicorp/_internal_client/vault_client.py Co-authored-by: Wei Lee <weilee.rx@gmail.com> * apply fixes for oorder in new jwt parameter for docsstring * Address PR review: use stricter mock assertions and inline kwargs Replace assert_called_with with call_args_list assertions in JWT tests to verify exact number of calls. Inline kwargs dicts directly into VaultHook() constructor calls where they are only used once. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * - remove jwt token defaults - fix documentaion - minor fiex * Remove DEFAULT_JWT_TOKEN_PATH constant and K8s fallback from JWT auth JWT is a general-purpose Vault auth method, not tied to Kubernetes. Remove the DEFAULT_JWT_TOKEN_PATH constant (which pointed to the K8s service account token path) and its fallback in VaultHook. Users must now explicitly provide either jwt_token or jwt_token_path when using JWT auth, otherwise _VaultClient raises a clear validation error. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Wei Lee <weilee.rx@gmail.com>
…he#61439) * Add JWT/OIDC authentication support to Hashicorp Vault provider This adds JWT/OIDC authentication method support to the Hashicorp Vault provider, enabling token-less authentication through identity federation. Key features: - New 'jwt' auth_type for VaultClient, VaultHook, and VaultBackend - Support for jwt_token parameter or automatic token retrieval from jwt_path - Configurable jwt_role for Vault role binding - Full backwards compatibility with existing auth methods Use cases enabled: - Kubernetes workload identity with projected service account tokens - Cloud provider identity (AWS IAM roles, GCP Workload Identity, Azure AD) - CI/CD pipelines (GitHub Actions OIDC, GitLab CI) - External identity providers (Auth0, Okta, Keycloak) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Update providers/hashicorp/src/airflow/providers/hashicorp/_internal_client/vault_client.py Co-authored-by: Wei Lee <weilee.rx@gmail.com> * Update providers/hashicorp/src/airflow/providers/hashicorp/hooks/vault.py Co-authored-by: Wei Lee <weilee.rx@gmail.com> * update the args order for methods * Update providers/hashicorp/src/airflow/providers/hashicorp/_internal_client/vault_client.py Co-authored-by: Wei Lee <weilee.rx@gmail.com> * apply fixes for oorder in new jwt parameter for docsstring * Address PR review: use stricter mock assertions and inline kwargs Replace assert_called_with with call_args_list assertions in JWT tests to verify exact number of calls. Inline kwargs dicts directly into VaultHook() constructor calls where they are only used once. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * - remove jwt token defaults - fix documentaion - minor fiex * Remove DEFAULT_JWT_TOKEN_PATH constant and K8s fallback from JWT auth JWT is a general-purpose Vault auth method, not tied to Kubernetes. Remove the DEFAULT_JWT_TOKEN_PATH constant (which pointed to the K8s service account token path) and its fallback in VaultHook. Users must now explicitly provide either jwt_token or jwt_token_path when using JWT auth, otherwise _VaultClient raises a clear validation error. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Wei Lee <weilee.rx@gmail.com>
…he#61439) * Add JWT/OIDC authentication support to Hashicorp Vault provider This adds JWT/OIDC authentication method support to the Hashicorp Vault provider, enabling token-less authentication through identity federation. Key features: - New 'jwt' auth_type for VaultClient, VaultHook, and VaultBackend - Support for jwt_token parameter or automatic token retrieval from jwt_path - Configurable jwt_role for Vault role binding - Full backwards compatibility with existing auth methods Use cases enabled: - Kubernetes workload identity with projected service account tokens - Cloud provider identity (AWS IAM roles, GCP Workload Identity, Azure AD) - CI/CD pipelines (GitHub Actions OIDC, GitLab CI) - External identity providers (Auth0, Okta, Keycloak) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Update providers/hashicorp/src/airflow/providers/hashicorp/_internal_client/vault_client.py Co-authored-by: Wei Lee <weilee.rx@gmail.com> * Update providers/hashicorp/src/airflow/providers/hashicorp/hooks/vault.py Co-authored-by: Wei Lee <weilee.rx@gmail.com> * update the args order for methods * Update providers/hashicorp/src/airflow/providers/hashicorp/_internal_client/vault_client.py Co-authored-by: Wei Lee <weilee.rx@gmail.com> * apply fixes for oorder in new jwt parameter for docsstring * Address PR review: use stricter mock assertions and inline kwargs Replace assert_called_with with call_args_list assertions in JWT tests to verify exact number of calls. Inline kwargs dicts directly into VaultHook() constructor calls where they are only used once. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * - remove jwt token defaults - fix documentaion - minor fiex * Remove DEFAULT_JWT_TOKEN_PATH constant and K8s fallback from JWT auth JWT is a general-purpose Vault auth method, not tied to Kubernetes. Remove the DEFAULT_JWT_TOKEN_PATH constant (which pointed to the K8s service account token path) and its fallback in VaultHook. Users must now explicitly provide either jwt_token or jwt_token_path when using JWT auth, otherwise _VaultClient raises a clear validation error. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Wei Lee <weilee.rx@gmail.com>
…he#61439) * Add JWT/OIDC authentication support to Hashicorp Vault provider This adds JWT/OIDC authentication method support to the Hashicorp Vault provider, enabling token-less authentication through identity federation. Key features: - New 'jwt' auth_type for VaultClient, VaultHook, and VaultBackend - Support for jwt_token parameter or automatic token retrieval from jwt_path - Configurable jwt_role for Vault role binding - Full backwards compatibility with existing auth methods Use cases enabled: - Kubernetes workload identity with projected service account tokens - Cloud provider identity (AWS IAM roles, GCP Workload Identity, Azure AD) - CI/CD pipelines (GitHub Actions OIDC, GitLab CI) - External identity providers (Auth0, Okta, Keycloak) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Update providers/hashicorp/src/airflow/providers/hashicorp/_internal_client/vault_client.py Co-authored-by: Wei Lee <weilee.rx@gmail.com> * Update providers/hashicorp/src/airflow/providers/hashicorp/hooks/vault.py Co-authored-by: Wei Lee <weilee.rx@gmail.com> * update the args order for methods * Update providers/hashicorp/src/airflow/providers/hashicorp/_internal_client/vault_client.py Co-authored-by: Wei Lee <weilee.rx@gmail.com> * apply fixes for oorder in new jwt parameter for docsstring * Address PR review: use stricter mock assertions and inline kwargs Replace assert_called_with with call_args_list assertions in JWT tests to verify exact number of calls. Inline kwargs dicts directly into VaultHook() constructor calls where they are only used once. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * - remove jwt token defaults - fix documentaion - minor fiex * Remove DEFAULT_JWT_TOKEN_PATH constant and K8s fallback from JWT auth JWT is a general-purpose Vault auth method, not tied to Kubernetes. Remove the DEFAULT_JWT_TOKEN_PATH constant (which pointed to the K8s service account token path) and its fallback in VaultHook. Users must now explicitly provide either jwt_token or jwt_token_path when using JWT auth, otherwise _VaultClient raises a clear validation error. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Wei Lee <weilee.rx@gmail.com>
…he#61439) * Add JWT/OIDC authentication support to Hashicorp Vault provider This adds JWT/OIDC authentication method support to the Hashicorp Vault provider, enabling token-less authentication through identity federation. Key features: - New 'jwt' auth_type for VaultClient, VaultHook, and VaultBackend - Support for jwt_token parameter or automatic token retrieval from jwt_path - Configurable jwt_role for Vault role binding - Full backwards compatibility with existing auth methods Use cases enabled: - Kubernetes workload identity with projected service account tokens - Cloud provider identity (AWS IAM roles, GCP Workload Identity, Azure AD) - CI/CD pipelines (GitHub Actions OIDC, GitLab CI) - External identity providers (Auth0, Okta, Keycloak) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Update providers/hashicorp/src/airflow/providers/hashicorp/_internal_client/vault_client.py Co-authored-by: Wei Lee <weilee.rx@gmail.com> * Update providers/hashicorp/src/airflow/providers/hashicorp/hooks/vault.py Co-authored-by: Wei Lee <weilee.rx@gmail.com> * update the args order for methods * Update providers/hashicorp/src/airflow/providers/hashicorp/_internal_client/vault_client.py Co-authored-by: Wei Lee <weilee.rx@gmail.com> * apply fixes for oorder in new jwt parameter for docsstring * Address PR review: use stricter mock assertions and inline kwargs Replace assert_called_with with call_args_list assertions in JWT tests to verify exact number of calls. Inline kwargs dicts directly into VaultHook() constructor calls where they are only used once. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * - remove jwt token defaults - fix documentaion - minor fiex * Remove DEFAULT_JWT_TOKEN_PATH constant and K8s fallback from JWT auth JWT is a general-purpose Vault auth method, not tied to Kubernetes. Remove the DEFAULT_JWT_TOKEN_PATH constant (which pointed to the K8s service account token path) and its fallback in VaultHook. Users must now explicitly provide either jwt_token or jwt_token_path when using JWT auth, otherwise _VaultClient raises a clear validation error. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Wei Lee <weilee.rx@gmail.com>
…he#61439) * Add JWT/OIDC authentication support to Hashicorp Vault provider This adds JWT/OIDC authentication method support to the Hashicorp Vault provider, enabling token-less authentication through identity federation. Key features: - New 'jwt' auth_type for VaultClient, VaultHook, and VaultBackend - Support for jwt_token parameter or automatic token retrieval from jwt_path - Configurable jwt_role for Vault role binding - Full backwards compatibility with existing auth methods Use cases enabled: - Kubernetes workload identity with projected service account tokens - Cloud provider identity (AWS IAM roles, GCP Workload Identity, Azure AD) - CI/CD pipelines (GitHub Actions OIDC, GitLab CI) - External identity providers (Auth0, Okta, Keycloak) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Update providers/hashicorp/src/airflow/providers/hashicorp/_internal_client/vault_client.py Co-authored-by: Wei Lee <weilee.rx@gmail.com> * Update providers/hashicorp/src/airflow/providers/hashicorp/hooks/vault.py Co-authored-by: Wei Lee <weilee.rx@gmail.com> * update the args order for methods * Update providers/hashicorp/src/airflow/providers/hashicorp/_internal_client/vault_client.py Co-authored-by: Wei Lee <weilee.rx@gmail.com> * apply fixes for oorder in new jwt parameter for docsstring * Address PR review: use stricter mock assertions and inline kwargs Replace assert_called_with with call_args_list assertions in JWT tests to verify exact number of calls. Inline kwargs dicts directly into VaultHook() constructor calls where they are only used once. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * - remove jwt token defaults - fix documentaion - minor fiex * Remove DEFAULT_JWT_TOKEN_PATH constant and K8s fallback from JWT auth JWT is a general-purpose Vault auth method, not tied to Kubernetes. Remove the DEFAULT_JWT_TOKEN_PATH constant (which pointed to the K8s service account token path) and its fallback in VaultHook. Users must now explicitly provide either jwt_token or jwt_token_path when using JWT auth, otherwise _VaultClient raises a clear validation error. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Wei Lee <weilee.rx@gmail.com>
This adds JWT/OIDC authentication method support to the Hashicorp Vault provider, enabling token-less authentication through identity federation.
Key features:
Use cases enabled:
Was generative AI tooling used to co-author this PR?
{pr_number}.significant.rstor{issue_number}.significant.rst, in airflow-core/newsfragments.