Skip to content

Commit

Permalink
Allow ctx without ak header (#668)
Browse files Browse the repository at this point in the history
  • Loading branch information
RWDai authored Mar 27, 2024
1 parent b5ab40f commit 168cf1b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions basic/src/helper/bios_ctx_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ where
let bios_ctx = if let Some(bios_ctx) = request.header(&funs.rbum_head_key_bios_ctx()).or_else(|| request.header(&funs.rbum_head_key_bios_ctx().to_lowercase())) {
TardisFuns::json.str_to_obj::<TardisContext>(&TardisFuns::crypto.base64.decode_to_string(bios_ctx)?)?
} else {
return Err(TardisError::unauthorized(
&format!("[Basic] Request is not legal, missing header [{}]", funs.rbum_head_key_bios_ctx()),
"401-auth-req-ak-not-exist",
));
if ctx.owner.is_empty() && ctx.ak.is_empty() && ctx.own_paths.is_empty() && ctx.roles.is_empty() && ctx.groups.is_empty() {
return Err(TardisError::unauthorized(
&format!("[Basic] Request is not legal, missing header [{}]", funs.rbum_head_key_bios_ctx()),
"401-auth-req-ak-not-exist",
));
} else {
return Ok(());
}
};

if bios_ctx.own_paths.contains(&ctx.own_paths) {
Expand Down

0 comments on commit 168cf1b

Please sign in to comment.