From 784e0740a6ca7684feba3fb4f26d68e098b5c826 Mon Sep 17 00:00:00 2001 From: mo khan Date: Fri, 4 Jul 2025 16:39:37 -0600 Subject: refactor: map from http request to cedar request --- src/authorization/cedar_authorizer.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/authorization') diff --git a/src/authorization/cedar_authorizer.rs b/src/authorization/cedar_authorizer.rs index 17867aba..4eeaf645 100644 --- a/src/authorization/cedar_authorizer.rs +++ b/src/authorization/cedar_authorizer.rs @@ -85,7 +85,7 @@ impl Authorizer for CedarAuthorizer { return true; } - match self.create_cedar_request(http_request.clone()) { + match self.map_from(http_request.clone()) { Ok(cedar_request) => { let entities = Entities::empty(); let response = @@ -107,7 +107,7 @@ impl Authorizer for CedarAuthorizer { } impl CedarAuthorizer { - fn create_cedar_request( + fn map_from( &self, http_request: envoy_types::pb::envoy::service::auth::v3::attribute_context::HttpRequest, ) -> Result> { @@ -136,13 +136,13 @@ impl CedarAuthorizer { if !bearer_token.is_empty() { context_map.insert( "bearer_token".to_string(), - cedar_policy::RestrictedExpression::from_str(bearer_token)?, + cedar_policy::RestrictedExpression::new_string(bearer_token.to_string()), ); } if !http_request.path.is_empty() { context_map.insert( "path".to_string(), - cedar_policy::RestrictedExpression::from_str(&http_request.path.to_string())?, + cedar_policy::RestrictedExpression::new_string(http_request.path.clone()), ); } -- cgit v1.2.3