summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/authorization/cedar_authorizer.rs19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/authorization/cedar_authorizer.rs b/src/authorization/cedar_authorizer.rs
index db54aaed..4b697680 100644
--- a/src/authorization/cedar_authorizer.rs
+++ b/src/authorization/cedar_authorizer.rs
@@ -9,14 +9,16 @@ use std::str::FromStr;
#[derive(Debug)]
pub struct CedarAuthorizer {
- policies: PolicySet,
- entities: cedar_policy::Entities,
authorizer: CedarAuth,
+ entities: cedar_policy::Entities,
+ policies: PolicySet,
}
impl CedarAuthorizer {
- pub fn new(policies: cedar_policy::PolicySet) -> CedarAuthorizer {
- let entities = Entities::empty();
+ pub fn new(
+ policies: cedar_policy::PolicySet,
+ entities: cedar_policy::Entities,
+ ) -> CedarAuthorizer {
CedarAuthorizer {
policies,
entities,
@@ -24,8 +26,11 @@ impl CedarAuthorizer {
}
}
- pub fn new_from(path: &std::path::Path) -> CedarAuthorizer {
- Self::new(Self::load_from(path).unwrap_or_else(|_| PolicySet::default()))
+ pub fn new_from(path: &std::path::Path, entities: cedar_policy::Entities) -> CedarAuthorizer {
+ Self::new(
+ Self::load_from(path).unwrap_or_else(|_| PolicySet::default()),
+ entities,
+ )
}
fn load_from(path: &std::path::Path) -> Result<PolicySet, Box<dyn std::error::Error>> {
@@ -130,7 +135,7 @@ impl CedarAuthorizer {
impl Default for CedarAuthorizer {
fn default() -> Self {
- Self::new_from(std::path::Path::new("/etc/authzd"))
+ Self::new_from(std::path::Path::new("/etc/authzd"), Entities::empty())
}
}