Skip to content

Commit 093fa66

Browse files
committed
admin: update log messages for admin backends
The admin backend is only the first step in granting access to an admin endpoint. The admin backend validates the admin token. Next the role extracted from that token is checked. As such, change the logging in the admin backends to talk about the admin token validation passing/failing rather than access being granted to an endpoint. Signed-off-by: Tobin Feldman-Fitzthum <[email protected]>
1 parent f39bf31 commit 093fa66

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

kbs/src/admin/allow_all.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub struct InsecureAllowAllBackend {}
1313

1414
impl AdminBackend for InsecureAllowAllBackend {
1515
fn validate_admin_token(&self, _request: &HttpRequest) -> Result<String> {
16-
warn!("Allow All admin backend is set. Anyone can access admin APIs");
16+
warn!("Allow All admin backend is set. All admin tokens are valid.");
1717
Ok("Anonymous".to_string())
1818
}
1919
}

kbs/src/admin/simple.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,16 @@ impl AdminBackend for SimpleAdminBackend {
6666
.verify_token::<NoCustomClaims>(token, Some(VerificationOptions::default()));
6767
match res {
6868
Ok(_claims) => {
69-
info!("Admin access granted for {}", persona.id);
69+
info!("Admin token validated (simple) for persona: {}", persona.id);
7070

7171
// Return the first matching persona
7272
return Ok(persona.id.clone());
7373
}
7474
Err(e) => {
75-
info!("Access not granted for {} due to: \n{}", persona.id, e);
75+
info!(
76+
"Admin token not validated for {} due to: \n{}",
77+
persona.id, e
78+
);
7679
}
7780
}
7881
}

0 commit comments

Comments
 (0)