diff options
| author | mo khan <mo@mokhan.ca> | 2025-07-04 16:39:37 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-07-04 16:39:37 -0600 |
| commit | 784e0740a6ca7684feba3fb4f26d68e098b5c826 (patch) | |
| tree | 9cd61a8792e10a2b3a829cb74dd34e1bb4519545 /src/authorization | |
| parent | 2185b6d8a80d78e3b1b1421f99cab884705d3cbf (diff) | |
refactor: map from http request to cedar request
Diffstat (limited to 'src/authorization')
| -rw-r--r-- | src/authorization/cedar_authorizer.rs | 8 |
1 files changed, 4 insertions, 4 deletions
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<CedarRequest, Box<dyn std::error::Error>> { @@ -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()), ); } |
