summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/authorization/spice/authorizer.rs6
-rw-r--r--tests/authorization/mod.rs1
-rw-r--r--tests/authorization/spice/authorizer_test.rs18
-rw-r--r--tests/authorization/spice/mod.rs1
4 files changed, 26 insertions, 0 deletions
diff --git a/src/authorization/spice/authorizer.rs b/src/authorization/spice/authorizer.rs
index da2805b9..d906752f 100644
--- a/src/authorization/spice/authorizer.rs
+++ b/src/authorization/spice/authorizer.rs
@@ -1,6 +1,12 @@
#[derive(Debug)]
pub struct Authorizer {}
+impl Authorizer {
+ pub fn new() -> Authorizer {
+ Authorizer {}
+ }
+}
+
impl crate::authorization::authorizer::Authorizer for Authorizer {
fn authorize(&self, _request: envoy_types::ext_authz::v3::pb::CheckRequest) -> bool {
false
diff --git a/tests/authorization/mod.rs b/tests/authorization/mod.rs
index 675247d4..7cad6c25 100644
--- a/tests/authorization/mod.rs
+++ b/tests/authorization/mod.rs
@@ -1,3 +1,4 @@
mod cedar_authorizer_test;
mod check_service_test;
mod server_test;
+mod spice;
diff --git a/tests/authorization/spice/authorizer_test.rs b/tests/authorization/spice/authorizer_test.rs
new file mode 100644
index 00000000..b295b64b
--- /dev/null
+++ b/tests/authorization/spice/authorizer_test.rs
@@ -0,0 +1,18 @@
+#[cfg(test)]
+mod tests {
+ use crate::support::factory_bot::*;
+ use authzd::Authorizer;
+
+ #[test]
+ fn test_example() {
+ let authorizer = authzd::authorization::spice::Authorizer::new();
+ let request = build_request(
+ |item: &mut envoy_types::pb::envoy::service::auth::v3::attribute_context::HttpRequest| {
+ item.method = "GET".to_string();
+ item.path = "/".to_string();
+ },
+ );
+
+ assert!(authorizer.authorize(request))
+ }
+}
diff --git a/tests/authorization/spice/mod.rs b/tests/authorization/spice/mod.rs
new file mode 100644
index 00000000..6aa0bfab
--- /dev/null
+++ b/tests/authorization/spice/mod.rs
@@ -0,0 +1 @@
+mod authorizer_test;