You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Whether to enforce content-based authorization or not.
696
+
///
697
+
/// If this is set to `false`, checks are still performed but failures will not result
698
+
/// in `403 Unauthorized` responses.
699
+
pubenforce:bool,
700
+
701
+
/// Keys that may be used to verify a request's `Authorization` header.
702
+
///
703
+
/// This field is a container that is keyed on a key's ID. When verifying a JWT
704
+
/// from the `Authorization` header, the `kid` field should be read from the JWT
705
+
/// header and used to index into this map to select the appropriate key.
706
+
#[serde(default)]
707
+
pubkeys:BTreeMap<String,AuthZVerificationKey>,
708
+
}
709
+
670
710
/// Main configuration struct for the objectstore server.
671
711
///
672
712
/// This is the top-level configuration that combines all server settings including networking,
@@ -779,6 +819,12 @@ pub struct Config {
779
819
/// Optional configuration for submitting internal metrics to Datadog. See [`Metrics`] for
780
820
/// configuration options.
781
821
pubmetrics:Metrics,
822
+
823
+
/// Content-based authorization configuration.
824
+
///
825
+
/// Controls the verification and enforcement of content-based access control based on the
826
+
/// JWT in a request's `Authorization` header.
827
+
pubauth:AuthZ,
782
828
}
783
829
784
830
implDefaultforConfig{
@@ -797,6 +843,7 @@ impl Default for Config {
797
843
logging:Logging::default(),
798
844
sentry:Sentry::default(),
799
845
metrics:Metrics::default(),
846
+
auth:AuthZ::default(),
800
847
}
801
848
}
802
849
}
@@ -952,4 +999,88 @@ mod tests {
952
999
Ok(())
953
1000
});
954
1001
}
1002
+
1003
+
#[test]
1004
+
fnconfigure_auth_with_env(){
1005
+
figment::Jail::expect_with(|jail| {
1006
+
jail.set_env("OS__AUTH__ENFORCE","true");
1007
+
jail.set_env(
1008
+
"OS__AUTH__KEYS",
1009
+
r#"{kid1={key_versions=["abcde","fghij","this is a test\n multiline string\nend of string\n"],max_permissions=["object.read", "object.write"],}, kid2={key_versions=["12345"],}}"#,
0 commit comments