Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mechanism to inject a JWT + account name #577

Merged
merged 1 commit into from
May 5, 2023

Conversation

OilyLime
Copy link
Contributor

To allow greater flexibility in how R2 RPC operations can be performed, introducing the jwt as optional attribute. Also refactored the way R2 paths are built and passed to the doR2HTTPRequest functions, since we expect to support greater variety of paths.

Introduced concept of R2CrossAccount, which will leverage the new underlying flexibility to perform cross account operations with proper auth.

src/workerd/api/r2-bucket.h Show resolved Hide resolved
src/workerd/api/r2-rpc.c++ Show resolved Hide resolved
src/workerd/api/r2-rpc.h Outdated Show resolved Hide resolved
src/workerd/api/r2-admin.h Outdated Show resolved Hide resolved
@OilyLime OilyLime force-pushed the oilylime/r2-jwt-crossaccount branch from e35ba0b to 37e01ed Compare April 28, 2023 20:21
@OilyLime OilyLime force-pushed the oilylime/r2-jwt-crossaccount branch from 37e01ed to 7f461b2 Compare May 1, 2023 15:58
R2Admin(FeatureFlags featureFlags,
uint subrequestChannel,
kj::String account,
kj::String jwt,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If these are always meant to be used together, I would suggest potentially combining them into a single struct.

src/workerd/api/r2-bucket.c++ Outdated Show resolved Hide resolved
src/workerd/api/r2-bucket.c++ Outdated Show resolved Hide resolved
src/workerd/api/r2-admin.c++ Outdated Show resolved Hide resolved
src/workerd/api/r2-admin.c++ Outdated Show resolved Hide resolved
src/workerd/api/r2-admin.h Show resolved Hide resolved
src/workerd/api/r2-rpc.c++ Show resolved Hide resolved
src/workerd/api/r2-rpc.c++ Show resolved Hide resolved
src/workerd/api/r2-bucket.c++ Outdated Show resolved Hide resolved
@OilyLime OilyLime force-pushed the oilylime/r2-jwt-crossaccount branch from 7f461b2 to 894e087 Compare May 3, 2023 16:05
Copy link
Member

@a-robinson a-robinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

src/workerd/api/r2-admin.c++ Outdated Show resolved Hide resolved
@OilyLime OilyLime force-pushed the oilylime/r2-jwt-crossaccount branch from 894e087 to 8a5ca89 Compare May 4, 2023 18:24
Copy link
Contributor

@vlovich vlovich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM too

@vlovich vlovich changed the title Add jwt to R2 rpc, introduce R2CrossAccount Add mechanism to inject a JWT + account name May 5, 2023
To allow greater flexibility in how R2 RPC operations can be performed,
introducing the jwt as optional attribute. Also refactored the way
R2 paths are built and passed to the doR2HTTP(verb)Request functions,
since we expect to support greater variety of paths.

Introduced concept of R2CrossAccount, which will leverage the new
underlying flexibility to perform cross account operations with proper
auth.
@OilyLime OilyLime force-pushed the oilylime/r2-jwt-crossaccount branch from 8a5ca89 to 90e7b3b Compare May 5, 2023 17:30
@a-robinson a-robinson merged commit 90b5231 into cloudflare:main May 5, 2023
OilyLime added a commit to OilyLime/workerd that referenced this pull request May 24, 2023
The admin account path is not needed. This was an oversight from cloudflare#577.
OilyLime added a commit to OilyLime/workerd that referenced this pull request May 25, 2023
The admin account path is not needed. This was an oversight from cloudflare#577.
OilyLime added a commit to OilyLime/workerd that referenced this pull request May 25, 2023
The admin account path is not needed. This was an oversight from cloudflare#577.
OilyLime added a commit to OilyLime/workerd that referenced this pull request May 25, 2023
The admin account path is not needed. This was an oversight from cloudflare#577.
OilyLime added a commit to OilyLime/workerd that referenced this pull request May 25, 2023
The admin account path is not needed. This was an oversight from cloudflare#577.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants