aboutsummaryrefslogtreecommitdiff
path: root/src/api/k2v/api_server.rs
diff options
context:
space:
mode:
authorAlex <alex@adnab.me>2024-03-01 12:49:43 +0000
committerAlex <alex@adnab.me>2024-03-01 12:49:43 +0000
commit34086531a842199d6d998bd85d8f65429c4a351d (patch)
tree7bb4a770514e683db047434c0b6908f91b981f19 /src/api/k2v/api_server.rs
parentf01883794e475f5dae3d2d4f621b020e1134fa47 (diff)
parent430d0be48c2c4bc789d0f1fd8ef35a34c88a300a (diff)
downloadgarage-34086531a842199d6d998bd85d8f65429c4a351d.tar.gz
garage-34086531a842199d6d998bd85d8f65429c4a351d.zip
Merge pull request 'Backport AWS signature verification refactoring and fixes to v0.8.x' (#744) from backport-735-v0.8.x into main-0.8.x
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/744
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()