Add JWT/OIDC authentication support to Hashicorp Vault provider#61439
Add JWT/OIDC authentication support to Hashicorp Vault provider#61439jason810496 merged 30 commits intoapache:mainfrom
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
providers/hashicorp/src/airflow/providers/hashicorp/_internal_client/vault_client.py
Outdated
Show resolved
Hide resolved
providers/hashicorp/src/airflow/providers/hashicorp/hooks/vault.py
Outdated
Show resolved
Hide resolved
providers/hashicorp/src/airflow/providers/hashicorp/hooks/vault.py
Outdated
Show resolved
Hide resolved
…client/vault_client.py Co-authored-by: Wei Lee <weilee.rx@gmail.com>
…t.py Co-authored-by: Wei Lee <weilee.rx@gmail.com>
providers/hashicorp/src/airflow/providers/hashicorp/_internal_client/vault_client.py
Show resolved
Hide resolved
providers/hashicorp/src/airflow/providers/hashicorp/hooks/vault.py
Outdated
Show resolved
Hide resolved
…client/vault_client.py Co-authored-by: Wei Lee <weilee.rx@gmail.com>
|
there is still one thing I am not sure, I made the default path for the jwt_token_path like for kubernetes (usually it goes with kubernets), however the JWT method does not have to be anyhow related to k8s, therefor not sure if we should keep it as default or remove - you need to pass the jwt_token (string) or jwt_token_path(path to a file with a token) |
Lee-W
left a comment
There was a problem hiding this comment.
a few nits, but overall looks good
providers/hashicorp/tests/unit/hashicorp/_internal_client/test_vault_client.py
Outdated
Show resolved
Hide resolved
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.
providers/hashicorp/src/airflow/providers/hashicorp/_internal_client/vault_client.py
Outdated
Show resolved
Hide resolved
- 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>
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.