Request Inheritance (#209)

This commit is contained in:
Gregory Schier
2025-05-23 08:13:25 -07:00
committed by GitHub
parent 13d959799a
commit 4cd2e9cd31
41 changed files with 1031 additions and 403 deletions

View File

@@ -206,9 +206,28 @@ pub(crate) async fn connect<R: Runtime>(
)
.await?;
let (authentication_type, authentication) =
window.db().resolve_auth_for_websocket_request(&request)?;
let mut headers = HeaderMap::new();
if let Some(auth_name) = request.authentication_type.clone() {
let auth = request.authentication.clone();
let resolved_headers = window.db().resolve_headers_for_websocket_request(&request)?;
for h in resolved_headers {
if h.name.is_empty() && h.value.is_empty() {
continue;
}
if !h.enabled {
continue;
}
headers.insert(
HeaderName::from_str(&h.name).unwrap(),
HeaderValue::from_str(&h.value).unwrap(),
);
}
if let Some(auth_name) = authentication_type.clone() {
let auth = authentication.clone();
let plugin_req = CallHttpAuthenticationRequest {
context_id: format!("{:x}", md5::compute(request_id.to_string())),
values: serde_json::from_value(serde_json::to_value(&auth).unwrap()).unwrap(),