Session provider sync implementation - #48843
Open
anjaliratnam-msft wants to merge 2 commits into
Open
Conversation
anjaliratnam-msft
requested a review
from Jacob Lauzon (jalauzon-msft)
as a code owner
September 2, 2026 00:19
anjaliratnam-msft
requested review from
vincenttran-msft and
Peter Wu (weirongw23-msft)
as code owners
September 2, 2026 00:19
|
Azure Pipelines: Successfully started running 1 pipeline(s). 9 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
anjaliratnam-msft
changed the base branch from
main
to
feature/storage/session
September 2, 2026 00:20
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The tests fail to parse, and session handling has unresolved URL, audience, typing, and cache issues.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds synchronous, shareable session-provider support atop the existing blob GET session authentication.
Changes:
- Adds session caching, signing, bearer fallback, and provider sharing.
- Exposes session configuration through synchronous clients.
- Adds session tests, sanitizers, and release notes.
File summaries
| File | Description |
|---|---|
CHANGELOG.md |
Documents session authentication. |
azure/storage/blob/__init__.py |
Exports session providers. |
_blob_service_client.py |
Documents session options. |
_blob_service_client.pyi |
Adds session parameters. |
_container_client.py |
Documents session options. |
_container_client.pyi |
Adds session parameters. |
_shared/base_client.py |
Integrates session policy/provider. |
_shared/models.py |
Adds session error codes. |
_shared/policies.py |
Implements signing and fallback. |
_shared/session.py |
Implements providers and cache. |
tests/conftest.py |
Sanitizes session credentials. |
tests/test_container.py |
Tests session behavior. |
tests/test_helpers.py |
Adds authentication test helpers. |
Review details
- Files reviewed: 13/13 changed files
- Comments generated: 10
- Review effort level: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+145
to
+146
| with self._locks_guard: | ||
| return self._locks.setdefault(container_url, Lock()) |
| assert session2 == _parse_session_token(capture_auth_header["c2_download2"]) | ||
|
|
||
| policy = _find_session_policy(service._pipeline) | ||
| cached = policy._cache._entry[container1_name] |
Comment on lines
+271
to
+272
| "SessionProvider", | ||
| "ContainerSessionProvider", |
| StorageSensitiveHeaderCleanupPolicy(**kwargs), | ||
| ] | ||
| use_session = bool(kwargs.pop("use_session", False)) | ||
| session_provider = kwargs.pop("session_provider", None) |
There was a problem hiding this comment.
When you are working on tests, this is good. We want a test case for a user providing a session provider.
| StorageSensitiveHeaderCleanupPolicy(**kwargs), | ||
| ] | ||
| use_session = bool(kwargs.pop("use_session", False)) | ||
| session_provider = kwargs.pop("session_provider", None) |
There was a problem hiding this comment.
When you are working on tests, this is good. We want a test case for a user providing a session provider.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR introduces SessionProvider building off the previous #47264. Customers can optionally supply one via session_options.session_provider and reuse it across clients to share the cache. If it's not supplied, one is created and scoped to the client, so existing behavior is unchanged.