aboutsummaryrefslogtreecommitdiff
path: root/src/api/k2v/api_server.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2024-03-01 12:35:08 +0100
committerAlex Auvolat <alex@adnab.me>2024-03-01 13:21:23 +0100
commit610af71e36d58ea1ca66b98c75f105aecf92af2b (patch)
tree8181bda3e5837a1a17302aa692c2f1722de99ad5 /src/api/k2v/api_server.rs
parentf01883794e475f5dae3d2d4f621b020e1134fa47 (diff)
downloadgarage-610af71e36d58ea1ca66b98c75f105aecf92af2b.tar.gz
garage-610af71e36d58ea1ca66b98c75f105aecf92af2b.zip
[backport-735-v0.8.x] backport AWS signature verification refactoring
Diffstat (limited to 'src/api/k2v/api_server.rs')
-rw-r--r--src/api/k2v/api_server.rs15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/api/k2v/api_server.rs b/src/api/k2v/api_server.rs
index 3a032aba..1c6d0b9e 100644
--- a/src/api/k2v/api_server.rs
+++ b/src/api/k2v/api_server.rs
@@ -15,8 +15,7 @@ use garage_model::garage::Garage;
use crate::generic_server::*;
use crate::k2v::error::*;
-use crate::signature::payload::check_payload_signature;
-use crate::signature::streaming::*;
+use crate::signature::verify_request;
use crate::helpers::*;
use crate::k2v::batch::*;
@@ -82,17 +81,7 @@ impl ApiHandler for K2VApiServer {
.ok_or_bad_request("Error handling OPTIONS")?);
}
- let (api_key, mut content_sha256) = check_payload_signature(&garage, "k2v", &req).await?;
- let api_key = api_key
- .ok_or_else(|| Error::forbidden("Garage does not support anonymous access yet"))?;
-
- let req = parse_streaming_body(
- &api_key,
- req,
- &mut content_sha256,
- &garage.config.s3_api.s3_region,
- "k2v",
- )?;
+ let (req, api_key, _content_shaa256) = verify_request(&garage, req, "k2v").await?;
let bucket_id = garage
.bucket_helper()