aboutsummaryrefslogtreecommitdiff
path: root/src/api/k2v
diff options
context:
space:
mode:
authorAlex <alex@adnab.me>2024-02-28 11:38:00 +0000
committerAlex <alex@adnab.me>2024-02-28 11:38:00 +0000
commit10031a3a9130a55a832e8aebc00eee942394be93 (patch)
tree9bcc9569e7a8806efdf9d542e37ffa06a7689bca /src/api/k2v
parent911a83ea7d06143c5a9621f88020ab6c0850ba54 (diff)
parent90cab5b8f2b5212668975bf445a1e86f638fe1c7 (diff)
downloadgarage-10031a3a9130a55a832e8aebc00eee942394be93.tar.gz
garage-10031a3a9130a55a832e8aebc00eee942394be93.zip
Merge pull request 'Split presigned signature verification + fix conditions' (#735) from fix-presigned into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/735
Diffstat (limited to 'src/api/k2v')
-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 e97da2af..fdb5db4c 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::*;
@@ -86,17 +85,7 @@ impl ApiHandler for K2VApiServer {
return Ok(options_res.map(|_empty_body: EmptyBody| empty_body()));
}
- 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_sha256) = verify_request(&garage, req, "k2v").await?;
let bucket_id = garage
.bucket_helper()