-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
- Define the Roles
- RAJEE is the S3-compatible data endpoint that actually serves objects.
- RAJA is the authentication service that mints a JWT from (bucket, key).
- boto3 must talk only to RAJEE, but consult RAJA just-in-time for auth.
⸻
- Create the boto3 Client Pointing Only to RAJEE
- Configure the client with endpoint_url = RAJEE.
- Decide whether RAJEE expects:
• JWT only → disable SigV4 signing, or
• SigV4 + JWT → keep normal signing. - Ensure path-style addressing if RAJEE requires it.
⸻
- Identify the Two Necessary Hook Points in botocore
- before-parameter-build (per operation)
• You have clean access to Bucket and Key.
• Safe place to call external services. - before-send (per operation)
• The HTTP request is fully formed.
• Safe place to mutate headers before the request leaves.
- before-parameter-build (per operation)
These two hooks share a request context.
⸻
- What Happens at before-parameter-build
- Read Bucket and Key from the operation parameters.
- Call RAJA with those values.
- Receive a JWT.
- Store the JWT in the request’s context (not in globals).
This runs once per attempt and is outside the HTTP transport path.
⸻
- What Happens at before-send
- Retrieve the JWT from the request context.
- Attach it as an HTTP header (e.g., Authorization: Bearer …).
- Let botocore proceed to send the request to RAJEE.
⸻
- Why This Placement Is Correct
- You do not block or interfere with botocore’s retry/HTTP machinery.
- Retries naturally mint fresh JWTs.
- Multipart, redirects, and internal retries remain correct.
- boto3 usage stays completely normal for callers.
⸻
- Register the Hooks for Object Operations
- Attach both hooks to GetObject.
- Repeat for HeadObject, PutObject, DeleteObject, etc., as needed.
- Alternatively, attach to all S3 operations and branch only when Bucket/Key exist.
⸻
- Runtime Flow for a GetObject Call
- Your code calls get_object(Bucket, Key).
- botocore triggers before-parameter-build.
- RAJA is called → JWT minted → stored in context.
- botocore builds the HTTP request to RAJEE.
- botocore triggers before-send.
- JWT header is attached.
- Request is sent to RAJEE.
- Response flows back normally through boto3.
⸻
- The Key Mental Model
• boto3 thinks it is talking to a normal S3 endpoint.
• RAJEE receives a normal S3 request with a JWT header.
• RAJA is invisible to boto3’s normal flow, invoked only via event hooks.
• Callers of the client never know this is happening.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels