v0.35.0
This commit is contained in:
1 parent
2c03fcf248
commit
d3b492874b
95 files changed
+1628
-743
No files matched your search
@@ -1,3 +1,9 @@
|
||||
type PhpEndpointPolicy = (
|
||||
String,
|
||||
std::collections::BTreeMap<String, String>,
|
||||
std::collections::BTreeMap<String, String>,
|
||||
);
|
||||
|
||||
pub fn compile_with_active(
|
||||
mut config: Config,
|
||||
revision: u64,
|
||||
@@ -67,14 +73,7 @@ pub fn compile_with_active(
|
||||
"too many Web Services (max 128)"
|
||||
);
|
||||
let mut web_services = HashMap::new();
|
||||
let mut php_endpoint_policies: HashMap<
|
||||
String,
|
||||
(
|
||||
String,
|
||||
std::collections::BTreeMap<String, String>,
|
||||
std::collections::BTreeMap<String, String>,
|
||||
),
|
||||
> = HashMap::new();
|
||||
let mut php_endpoint_policies: HashMap<String, PhpEndpointPolicy> = HashMap::new();
|
||||
for service in &mut config.web_services {
|
||||
service
|
||||
.validate()
|
||||
|
||||
+1
-11
@@ -151,7 +151,7 @@ pub struct HostPolicy {
|
||||
pub hosts: Vec<String>,
|
||||
pub acl: Acl,
|
||||
}
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
|
||||
#[serde(default, deny_unknown_fields)]
|
||||
pub struct AclProfile {
|
||||
pub id: String,
|
||||
@@ -159,16 +159,6 @@ pub struct AclProfile {
|
||||
pub acl: Option<Acl>,
|
||||
pub country_access: crate::rate_limit::CountryAccess,
|
||||
}
|
||||
impl Default for AclProfile {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
id: String::new(),
|
||||
name: String::new(),
|
||||
acl: None,
|
||||
country_access: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct Backend {
|
||||
|
||||
@@ -101,8 +101,8 @@ fn compile_routing(
|
||||
for definition in host.backends.iter().filter(|_| needs_proxy_pool) {
|
||||
let mut backend = compile_backend_with_timeout(
|
||||
&definition.backend(),
|
||||
&desired_policy,
|
||||
&guarded_bindings,
|
||||
desired_policy,
|
||||
guarded_bindings,
|
||||
&host.load_balancing.keepalive,
|
||||
host.proxy_timeouts
|
||||
.connect_timeout()
|
||||
@@ -224,7 +224,7 @@ fn compile_routing(
|
||||
authentik: &host.authentik,
|
||||
oidc: &host.oidc,
|
||||
}
|
||||
.compile(&desired_policy, &guarded_bindings)?,
|
||||
.compile(desired_policy, guarded_bindings)?,
|
||||
id: host.id.clone(),
|
||||
bindings: host_bindings,
|
||||
acl_profile_id: host.acl_profile_id.clone(),
|
||||
|
||||
+7
-4
@@ -116,20 +116,23 @@ mod tests {
|
||||
method: crate::auth_provider::IntegrationMethod::Oidc,
|
||||
});
|
||||
host.oidc.enabled = true;
|
||||
host.oidc.issuer_url = "https://auth.gruszczynski.cc".into();
|
||||
host.oidc.issuer_url = "https://auth.example.com".into();
|
||||
host.oidc.client_id = "app".into();
|
||||
host.oidc.client_secret = "client-secret".into();
|
||||
host.oidc.session_secret = "a-unique-testing-session-secret-32-bytes".into();
|
||||
host.oidc.redirect_url = "https://localhost/_rustproxy/oidc/callback".into();
|
||||
assert!(host.validate().is_ok());
|
||||
let encoded = serde_json::to_value(&host).unwrap();
|
||||
assert_eq!(encoded["authentication"], serde_json::json!({"provider":"authelia","method":"oidc"}));
|
||||
let restored: crate::vhost::Vhost = serde_json::from_value(encoded.clone()).unwrap();
|
||||
assert_eq!(
|
||||
encoded["authentication"],
|
||||
serde_json::json!({"provider":"authelia","method":"oidc"})
|
||||
);
|
||||
let mut restored: crate::vhost::Vhost = serde_json::from_value(encoded.clone()).unwrap();
|
||||
assert_eq!(restored.authentication, host.authentication);
|
||||
assert!(restored.validate().is_ok());
|
||||
let mut legacy = encoded.as_object().unwrap().clone();
|
||||
legacy.remove("authentication");
|
||||
let old: crate::vhost::Vhost = serde_json::from_value(legacy.into()).unwrap();
|
||||
let mut old: crate::vhost::Vhost = serde_json::from_value(legacy.into()).unwrap();
|
||||
assert!(old.authentication.is_none());
|
||||
assert!(old.validate().is_ok());
|
||||
host.authentication = Some(crate::auth_provider::Choice {
|
||||
|
||||
Reference in new issue
Block a user