summaryrefslogtreecommitdiff
path: root/src/authorization/cedar
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-07-16 11:00:38 -0600
committermo khan <mo@mokhan.ca>2025-07-16 11:00:38 -0600
commitd04d2e530baad1470736a601dfcafd4162952ae4 (patch)
tree0010865ce965374be699b25aef1b008fc6bf0ace /src/authorization/cedar
parentfb05a439113daf8750be6df025f9676221d8e228 (diff)
refactor: rename CedarAuthorizer to cedar::Authorizer
Diffstat (limited to 'src/authorization/cedar')
-rw-r--r--src/authorization/cedar/authorizer.rs18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/authorization/cedar/authorizer.rs b/src/authorization/cedar/authorizer.rs
index c207467f..a04a8e9f 100644
--- a/src/authorization/cedar/authorizer.rs
+++ b/src/authorization/cedar/authorizer.rs
@@ -1,27 +1,23 @@
-use crate::authorization::authorizer::Authorizer;
use std::fs;
use std::str::FromStr;
#[derive(Debug)]
-pub struct CedarAuthorizer {
+pub struct Authorizer {
authorizer: cedar_policy::Authorizer,
entities: cedar_policy::Entities,
policies: cedar_policy::PolicySet,
}
-impl CedarAuthorizer {
- pub fn new(
- policies: cedar_policy::PolicySet,
- entities: cedar_policy::Entities,
- ) -> CedarAuthorizer {
- CedarAuthorizer {
+impl Authorizer {
+ pub fn new(policies: cedar_policy::PolicySet, entities: cedar_policy::Entities) -> Authorizer {
+ Authorizer {
policies,
entities,
authorizer: cedar_policy::Authorizer::new(),
}
}
- pub fn new_from(path: &std::path::Path, entities: cedar_policy::Entities) -> CedarAuthorizer {
+ pub fn new_from(path: &std::path::Path, entities: cedar_policy::Entities) -> Authorizer {
Self::new(
Self::load_from(path).unwrap_or_else(|e| {
tracing::error!(
@@ -127,7 +123,7 @@ impl CedarAuthorizer {
}
}
-impl Default for CedarAuthorizer {
+impl Default for Authorizer {
fn default() -> Self {
Self::new_from(
std::path::Path::new("./etc/authzd"),
@@ -136,7 +132,7 @@ impl Default for CedarAuthorizer {
}
}
-impl Authorizer for CedarAuthorizer {
+impl crate::authorization::authorizer::Authorizer for Authorizer {
fn authorize(&self, request: envoy_types::ext_authz::v3::pb::CheckRequest) -> bool {
let http_request = match request
.attributes