From be3e6a08f1d28218f527a8e8455bcf03fc55b6ed Mon Sep 17 00:00:00 2001 From: mo khan Date: Wed, 16 Jul 2025 08:48:36 -0600 Subject: refactor: rename to default authorizer --- src/authorization/authorizer.rs | 15 --------------- src/authorization/default.rs | 14 ++++++++++++++ src/authorization/mod.rs | 1 + src/authorization/server.rs | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) create mode 100644 src/authorization/default.rs diff --git a/src/authorization/authorizer.rs b/src/authorization/authorizer.rs index d5363c84..62733585 100644 --- a/src/authorization/authorizer.rs +++ b/src/authorization/authorizer.rs @@ -3,18 +3,3 @@ use envoy_types::ext_authz::v3::pb::CheckRequest; pub trait Authorizer: std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static { fn authorize(&self, request: CheckRequest) -> bool; } - -#[derive(Debug)] -pub struct DefaultAuthorizer {} - -impl Default for DefaultAuthorizer { - fn default() -> Self { - Self {} - } -} - -impl Authorizer for DefaultAuthorizer { - fn authorize(&self, _request: CheckRequest) -> bool { - true - } -} diff --git a/src/authorization/default.rs b/src/authorization/default.rs new file mode 100644 index 00000000..dcec8e2a --- /dev/null +++ b/src/authorization/default.rs @@ -0,0 +1,14 @@ +#[derive(Debug)] +pub struct Authorizer {} + +impl Default for Authorizer { + fn default() -> Self { + Self {} + } +} + +impl super::Authorizer for Authorizer { + fn authorize(&self, _request: envoy_types::ext_authz::v3::pb::CheckRequest) -> bool { + true + } +} diff --git a/src/authorization/mod.rs b/src/authorization/mod.rs index acf7e11f..d9acd642 100644 --- a/src/authorization/mod.rs +++ b/src/authorization/mod.rs @@ -1,6 +1,7 @@ pub mod authorizer; pub mod cedar; pub mod check_service; +pub mod default; pub mod server; pub use authorizer::Authorizer; diff --git a/src/authorization/server.rs b/src/authorization/server.rs index 05e78c1a..0847c101 100644 --- a/src/authorization/server.rs +++ b/src/authorization/server.rs @@ -36,6 +36,6 @@ impl Server { impl Default for Server { fn default() -> Self { - Self::new(super::authorizer::DefaultAuthorizer::default()).unwrap() + Self::new(super::default::Authorizer::default()).unwrap() } } -- cgit v1.2.3