featt: 增加 redfish 身份验证,完善 redfish 虚拟媒体资源管理能力

This commit is contained in:
mofeng-git
2026-07-12 16:13:41 +08:00
parent 7c9166a8cf
commit 54e0cbc84e
5 changed files with 390 additions and 108 deletions

View File

@@ -80,3 +80,30 @@ fn decode_basic_auth(encoded: &str) -> Option<(String, String)> {
}
Some((username, password))
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn only_service_discovery_and_session_creation_are_public() {
assert!(is_redfish_public_endpoint("/v1/", &Method::GET));
assert!(is_redfish_public_endpoint(
"/v1/$metadata",
&Method::GET
));
assert!(is_redfish_public_endpoint(
"/v1/SessionService/Sessions",
&Method::POST
));
assert!(!is_redfish_public_endpoint(
"/v1/Managers/1/VirtualMedia",
&Method::GET
));
assert!(!is_redfish_public_endpoint(
"/v1/Managers/1/VirtualMedia/1/Actions/VirtualMedia.EjectMedia",
&Method::POST
));
}
}