Skip to content

Feature/storage/session datalocality private drop - #50046

Draft
browndav-msft wants to merge 9 commits into
Azure:feature/storage/bifrost-private-dropfrom
browndav-msft:feature/storage/session-datalocality-private-drop
Draft

Feature/storage/session datalocality private drop#50046
browndav-msft wants to merge 9 commits into
Azure:feature/storage/bifrost-private-dropfrom
browndav-msft:feature/storage/session-datalocality-private-drop

Conversation

@browndav-msft

Copy link
Copy Markdown
Member

This is the session feature for the private drop

browndav-msft and others added 9 commits June 11, 2026 12:19
* generate base files based on swagger docs

* create live tests for createSession

- downgrade blobserviceversion to 2026_04_06
- change AZURE_LIVE_TEST_SERVICE_VERSION to V2026_04_06 in ci.system.properties in azure-storage-common
- create both sync and async

* add recordings

* create new files based on swagger update

* add two params to BlobContainerClient#createSessionWithResponse

* add sanitizers for SessionToken and SessionKey to BlobTestBase

* add recording for createSessionReturnsTokenAndKey

* create StorageSessionCredential with isExpired

* create BlobSessionClient so that BlobSessionProvider takes it as a dep instead of ContainersImpl

* create BlobSEssionClient with tests

* add recorings for BlobSessionClient

* fix BlobContainerAsyncClient to match new swagger, add new recording

* add SessionProvider and SessionProviderTest

* add accountName to BlobSessionClient

* add accountName to StorageSessionCredential and SesionTestHelper

* wip

* change sessionprovider to SEssionTokenCredentialPolicy

* wip

* move session tests from containerapi to blobsessionclienttests

* fix blobsessiontests and add place holder for end-to-end tests in containerapitests

* add recordings for blobsessionclient

* linting

* refactor cache into separate class so it follows BearerTokenAuthenticationPolicy + AccessTokenCache pattern

* add 503 fallback

* add tests for udsas, but disabled for now

* refactor createContext to use hardcoded endpoint

* add SessionMode and tests for SessionMode

* add sessionOptions to buildPipeline, add null to builders not using sessions

* move SessionTokenCredentialPolicy ahead of StorageBearerTokenChallengeAuthorizationPolicy

* fix linting issues

* add session to BlobServiceClients and BlobServiceClientBuildeer

* change expiration so that it defaults to 5 minutes, if there is no expiration

* move SessionOptions so that it is public

* remove old SessionOptions

* remove unnecessary references to containerName and serviceVersion

* add BlobContainerSessionInfo, add other Copilot recommendations

* delete BlobContainerSessionInfo, restore return CreateSessionResponse

* create createSession end-to-end test with recordings

* only allow get requests for getblob

* wrap tests in try-with-resources

* make createSession package private

* fixes based on copilot suggestions

* Update sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/util/BlobSessionClient.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* add containerName to SessionOptions

* move accountName to SessionOptions

* refactor: SessionTokenCredentialPolicy accepts bearer policy as constructor dependency

SessionTokenCredentialPolicy now takes StorageBearerTokenChallengeAuthorizationPolicy
as a constructor dependency instead of relying on pipeline ordering to coordinate
with the bearer policy. Key changes:

- SessionTokenCredentialPolicy delegates to bearerPolicy.process() for non-session
  requests (non-GetBlob, NONE mode, AUTO first request) and fallback (503).
- Added getBearerPolicy() accessor for use in per-container pipeline construction.
- BuilderHelper updated to pass bearer policy through to SessionTokenCredentialPolicy
  constructor in both addSessionPolicyIfEnabled and wrapWithSessionPolicy.
- Tests updated to mock bearerPolicy and verify delegation behavior.

This is step 1 of the session auth refactor to align with the .NET SDK's
SessionAuthenticationPolicy pattern.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* refactor: introduce AuthStrategy enum and consolidate analyzeRequest

Consolidate isGetBlobRequest() and shouldUseSession() into a single
analyzeRequest() method that returns an AuthStrategy enum
(USE_BEARER_TOKEN or USE_SESSION_TOKEN), following the .NET
SessionAuthenticationPolicy pattern.

Also extract response handling into handleSessionResponse() and
handleSessionResponseSync() methods for cleaner process()/processSync()
flow. The process methods now have a clear structure:
1. analyzeRequest() -> decide strategy
2. USE_BEARER_TOKEN -> delegate to bearer policy
3. USE_SESSION_TOKEN -> acquire session, sign, send, handle response

No behavioral changes - all existing tests pass unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* refactor: remove redundant restype check from analyzeRequest

The restype query parameter check was redundant because requests with
restype=container are container-level operations that have no blob name.
They are already filtered by the blob name presence check. This aligns
more closely with the .NET SessionAuthenticationPolicy which relies on
URL structure rather than query parameter checks.

The comp check is retained as a safety measure to exclude sub-operations
like GetBlobMetadata (comp=metadata) that have a blob name but are not
download operations.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* change sessionmode from always to singlespecifciedcontainer, add resolve method

* wrap bearer token in sessioncredentialpolicy

* fix NPE for SessionOptions, sessionoptions always non null

* add tests for sessiontokencredpolicy and storagesessioncred

* add logic to avoid wrapping Bearertoken, if session is not needed

* add overloaded oauth in blobtestbase to be able to add sessionoptions

* add overloaded getOAuthServiceAsyncClient to be able to pass session options

* add custom buildStringToSign to remove `0` from get requests

* readd versions

* readd ci.system.properties

* change session options check for null in BuilderHelper which affected other tests

* add recordings for create sessions, change time to testResource time

* add requestInspectionPolicy and overloaded getoauth client in base test

* fix null sessionsoptions issue

* add fix in storagesessioncredntial for query params

* add SessionTokenCredPolicy to checks for anonymousAccess

* remove constructor for BlobSessionClients that uses parse url

* linting issues, remove SessionOptions from service methods

* add comments to policyrefreshNearExpiry test

* fix linting issues

* add check for container name

* fix return javadoc for SessionMode

* add LOGGER and appropriate error throwing in BlobSessionClient

* changes based on feedback from isabelle

* add single retry for all 401 errors

* remove unused imports

* add suppression for SessionTokenPolicy for linting

* fix ubuntu tests hanging by removing local dns bypass

* add session for blob client with tests

* create unified http transport between data requests and session request, add ResourceLock for live tests

* test multiple concurrency

* add branching if for bearer policy

* refactor validateSessionMode to builderhelper

* add revert to bearertoken for 400 errors

* remove unused imports

* readd comment to bearertokechallenge

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added the Storage Storage Service (Queues, Blobs, Files) label Aug 5, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
33 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Storage Storage Service (Queues, Blobs, Files)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants