mirror of
https://github.com/rustfs/rustfs.git
synced 2026-07-27 16:48:58 +00:00
fix access check
This commit is contained in:
@@ -71,6 +71,10 @@ where
|
||||
|
||||
// warn!("get uri {}", &uri);
|
||||
|
||||
if req.credentials.is_none() {
|
||||
return Err(s3_error!(AccessDenied, "Signature is required"));
|
||||
}
|
||||
|
||||
if let Ok(mat) = self.router.at(&uri) {
|
||||
let op: &T = mat.value;
|
||||
return op.call(req, mat.params).await;
|
||||
|
||||
@@ -8,6 +8,7 @@ use s3s::access::{S3Access, S3AccessContext};
|
||||
|
||||
use s3s::auth::Credentials;
|
||||
use s3s::{dto::*, s3_error, S3Request, S3Result};
|
||||
use tracing::info;
|
||||
use uuid::Uuid;
|
||||
|
||||
#[allow(dead_code)]
|
||||
@@ -43,7 +44,18 @@ impl S3Access for FS {
|
||||
// /// + [`cx.extensions_mut()`](S3AccessContext::extensions_mut)
|
||||
async fn check(&self, cx: &mut S3AccessContext<'_>) -> S3Result<()> {
|
||||
// 上层验证了 ak/sk
|
||||
// warn!("check s3_op {:?} cred {:?}", cx.s3_op().name(), cx.credentials());
|
||||
info!(
|
||||
"s3 check path: {:?}, s3_op: {:?}, cred: {:?}",
|
||||
cx.s3_path(),
|
||||
cx.s3_op().name(),
|
||||
cx.credentials()
|
||||
);
|
||||
|
||||
if cx.credentials().is_none() {
|
||||
return Err(s3_error!(AccessDenied, "Signature is required"));
|
||||
};
|
||||
|
||||
// TODO: FIXME: check auth
|
||||
|
||||
let action = match Action::from_str(format!("s3:{}", cx.s3_op().name()).as_str()) {
|
||||
Ok(res) => Some(res),
|
||||
@@ -1,4 +1,4 @@
|
||||
pub mod acess;
|
||||
pub mod access;
|
||||
pub mod ecfs;
|
||||
pub mod error;
|
||||
pub mod options;
|
||||
|
||||
Reference in New Issue
Block a user