Skip to content

Commit

Permalink
Add S3 Express identity cache (#3390)
Browse files Browse the repository at this point in the history
## Motivation and Context
Adds a default implementation for S3 Express identity cache.

## Description
This PR adds the said cache for S3 Express. This cache is not
configurable from outside and solely owned by the default S3 Express
identity provider. It is implemented in terms of an LRU cache keyed on a
string generated by `sha256hmac(random 64-byte key, access_key_id +
secret_key) + bucket_name` (note: `access_key_id` and `secret_key` are
for a customer's credentials but not for a retrieved `create_session`
API token).
Cache values are of type `ExpiringCache` that contains a session token
retrieved by S3's `create_session` API. When a customer is trying to use
a cached session token but if it has expired, `ExpiringCache` calls the
S3's `create_session` API, stores in it a new session token, and returns
it to the customer.

## Testing
Added unit tests for `S3IdentityCache` and a connection recording test
for `list-objects-v2` running against both express and regular buckets
to exercise a use case where a customer is switching between those
buckets.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._

---------

Co-authored-by: John DiSanti <[email protected]>
Co-authored-by: Russell Cohen <[email protected]>
Co-authored-by: AWS SDK Rust Bot <[email protected]>
Co-authored-by: AWS SDK Rust Bot <[email protected]>
Co-authored-by: Zelda Hessler <[email protected]>
  • Loading branch information
6 people authored Feb 20, 2024
1 parent 57c95aa commit 0a75b41
Show file tree
Hide file tree
Showing 6 changed files with 1,132 additions and 38 deletions.
4 changes: 4 additions & 0 deletions aws/rust-runtime/aws-inlineable/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@ aws-smithy-runtime = { path = "../../../rust-runtime/aws-smithy-runtime", featur
aws-smithy-runtime-api = { path = "../../../rust-runtime/aws-smithy-runtime-api", features = ["client"] }
aws-smithy-types = { path = "../../../rust-runtime/aws-smithy-types", features = ["http-body-0-4-x"] }
bytes = "1"
fastrand = "2.0.0"
hex = "0.4.3"
http = "0.2.9"
http-body = "0.4.5"
hmac = "0.12"
lru = "0.12.2"
ring = "0.17.5"
sha2 = "0.10"
tokio = "1.23.1"
tracing = "0.1"

Expand Down
Loading

0 comments on commit 0a75b41

Please sign in to comment.