diff options
| author | mo khan <mo@mokhan.ca> | 2025-07-10 14:58:52 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-07-10 14:58:52 -0600 |
| commit | 5d7f37c6508c7308c17659630cff35f4ead6dae4 (patch) | |
| tree | 5597bde87a964d0a2625dc71f5a4015968498eef /tests/authorization | |
| parent | e92f15ef82339d4d9dc4a04f8dce2599b6ef10da (diff) | |
fix: allow authenticated+authorized users to create Sparkles
Diffstat (limited to 'tests/authorization')
| -rw-r--r-- | tests/authorization/cedar_authorizer_test.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/authorization/cedar_authorizer_test.rs b/tests/authorization/cedar_authorizer_test.rs index f2dfebd4..f056c8c7 100644 --- a/tests/authorization/cedar_authorizer_test.rs +++ b/tests/authorization/cedar_authorizer_test.rs @@ -91,12 +91,22 @@ mod tests { ]); }); - let user = build_user("1675940"); + let mut attrs = std::collections::HashMap::new(); + attrs.insert( + "username".to_string(), + cedar_policy::RestrictedExpression::new_string("tanuki".to_string()), + ); + let user = build_user("1675940", attrs); let entities = cedar_policy::Entities::from_entities([user], None).unwrap(); let authorizer = subject_with(entities); assert!(authorizer.authorize(request.clone())); - let user = build_user("1"); + let mut attrs = std::collections::HashMap::new(); + attrs.insert( + "username".to_string(), + cedar_policy::RestrictedExpression::new_string("root".to_string()), + ); + let user = build_user("1", attrs); let entities = cedar_policy::Entities::from_entities([user], None).unwrap(); let authorizer = subject_with(entities); assert!(!authorizer.authorize(request.clone())); |
