PAT-1895 Build Storage client from resolved StorageApiToken#531
Merged
Conversation
1a900c7 to
7e87b73
Compare
…solved StorageApiToken
…controller value resolver
d6d179a to
df6d1e7
Compare
pepamartinec
commented
Jun 24, 2026
| use Keboola\StorageApiBranch\StorageApiToken; | ||
| use Symfony\Component\HttpFoundation\Request; | ||
|
|
||
| class StorageClientApiFactory |
Contributor
Author
There was a problem hiding this comment.
Naming is hard. Nasleduju pattern existujicich factory (StorageClientRequestFactory, StorageClientPlainFactory)
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.
Release Notes
https://linear.app/keboola/issue/PAT-1895/storage-api-php-client-branch-wrapper-do-not-use-storage-token-from
Note
Implementace
StorageClientApiFactory+ controller argument resolver.StorageClientRequestFactory, ktera nefunguje s PAT tokenamaAdds
Keboola\ApiBundle\StorageApiClient\StorageClientApiFactory, a Storage API client factory that builds aClientWrapperfrom an already-resolvedStorageApiTokenobject instead of re-reading the token from the request headers. The branch-wrapper'sStorageClientRequestFactoryderives the token straight fromAuthorization: Bearer/X-StorageApi-Token, which breaks for Connection programmatic tokens (kbc_pat_*/kbc_at_*): the header carries the programmatic token, while the real legacy Storage token only exists on theStorageApiTokenthat api-bundle's authenticator resolved via the Manage API exchange. api-bundle is the right home for this factory — it already resolves theStorageApiTokenand already depends onkeboola/storage-api-php-client-branch-wrapper.The factory takes the token value from
StorageApiToken::getTokenValue(), pinsauthTypetoAuthType::STORAGE_TOKEN(the resolved value is always a legacy Storage token), and resolves the run id fromX-KBC-RunIdwith the usual generator/uniqidfallback. It is intentionally independent ofStorageClientRequestFactory— it owns its ownClientOptionsand neither factory references the other. This PR ships only the class and its unit tests; DI auto-registration inKeboolaApiExtensionand the consumer-facing usage docs are a deliberate follow-up step, so nothing in the container consumes the factory yet.Plans for customer communication
None.
Impact analysis
No end-user impact. The factory is not registered in the container yet (no DI wiring), so no code path consumes it; this PR only adds a new class and its tests.
Change type
New feature
Justification
Multi-project / PAT support: downstream services must build Storage clients from the resolved
StorageApiToken, not from request headers that carry a programmatic token.Deployment
Merge & automatic deploy.
Rollback plan
Revert of this PR.
Post release support plan
None.