Added custom auth support
windows / build (push) Successful in 5m0s

This commit is contained in:
Torbjörn Molin committed 2026-11-09 12:56:54 +01:00
1 parent ae055be9cc
commit 1e7f8678eb
9 files changed
+377 -97

No files matched your search

+8 -8
View File
@@ -9,7 +9,7 @@ use std::time::{Instant, SystemTime};
use reqlite_core::collection::Node;
use reqlite_core::cookies::CookieJar;
use reqlite_core::env::Environments;
use reqlite_core::folder::{self, FolderAuth, FolderSettings, InheritedAuth};
use reqlite_core::folder::{self, AuthHeader, FolderAuth, FolderSettings, InheritedAuth};
use reqlite_core::http::{BodyStore, Response};
use reqlite_core::httpfile::{HttpFile, RequestKey};
use reqlite_core::params::Param;
@@ -108,17 +108,17 @@ pub struct RequestRef {
pub struct ConsolidateAuth {
pub dir: PathBuf,
/// The auth requests in `dir` should inherit.
pub target: Option<String>,
pub target: Option<AuthHeader>,
/// `dir` doesn't have `target` as its own setting yet; applying writes it.
pub set_folder: bool,
/// Values to pick `target` from (with how many requests use each), when
/// `dir` has no auth of its own.
pub choices: Vec<(String, usize)>,
/// Requests with their own Authorization header.
pub choices: Vec<(AuthHeader, usize)>,
/// Requests with their own auth header.
pub own: Vec<OwnAuth>,
/// Requests that inherit today and would send something else once
/// `target` is set on the folder.
pub affected: Vec<(RequestRef, Option<String>)>,
pub affected: Vec<(RequestRef, Option<AuthHeader>)>,
/// Give the affected requests their current auth explicitly (a header,
/// or `# @no-auth`) so they keep sending what they send today.
pub keep_affected: bool,
@@ -129,9 +129,9 @@ pub struct ConsolidateAuth {
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct OwnAuth {
pub request: RequestRef,
pub value: String,
pub value: AuthHeader,
/// What the request would inherit without its header.
pub inherits: Option<String>,
pub inherits: Option<AuthHeader>,
/// Remove the header.
pub selected: bool,
}
@@ -140,7 +140,7 @@ impl OwnAuth {
/// Removing the header keeps the request sending the same thing.
pub fn same(&self) -> bool {
self.inherits
.as_deref()
.as_ref()
.is_some_and(|i| folder::same_auth(i, &self.value))
}
}