feat(webdav): add bearer_token_command for dynamic token acquisition #10917
+1
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Code-related
iterative/dvc-webdav#95
Related Issues
Description
This PR introduces dynamic Bearer Token management for WebDAV remotes via the new
bearer_token_commandconfiguration option. Unlike static token configurations, this feature enables DVC to:.dvc/config.local)Key Enhancements
Dynamic Token Workflow
DVC executes this command on-demand to acquire tokens, eliminating manual token rotation.
Secure Token Lifecycle
Fallback Compatibility
Existing static tokens (via
token = xyzconfig) continue working unchanged. This feature only activates whenbearer_token_commandis set.Issue Resolution
This PR directly addresses the use case described in issue #10689, where users of short-lived OIDC tokens (like those from oidc-agent that expire every 5 minutes) currently need to manually update tokens in
.dvc/config.local. With this implementation, users can now configure:DVC will automatically execute this command whenever a token is needed, eliminating the manual token rotation workflow. This matches the pattern used by tools like rclone that was referenced in the issue discussion.
Testing Instructions
Testing Environment Setup
WebDAV Server (Docker):
docker run --rm -p 9000:8080 -v $(pwd)/data:/data rclone/rclone:latest serve webdav /data --addr :8080Token Fetch Script (
get_token.sh):Proxy Server (proxy.py)
Validation Tests Performed
Run these before DVC operations (see Testing Environment Setup): Start WebDAV Server (Docker), Run Proxy Server (python proxy.py)
Short Token Expiry (5s default):
Ouput example:
Long Token Expiry:
TOKEN_EXPIRY_SECONDS=300(5 minutes)Output example: