-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(jans-cedarling): implement YAML parser for single policy store
- Simplify YAML test files by removing the need for a top-level `policy_store` ID - Ensure YAML test files exclusively contain human-readable Cedar code; base64-encoded schemas are now only used for JSON test files. - Pending: Replace the existing implementation with the new parser. Signed-off-by: rmarinn <[email protected]>
- Loading branch information
Showing
3 changed files
with
149 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 41 additions & 53 deletions
94
jans-cedarling/cedarling/src/common/policy_store/policy-store_ok.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,42 @@ | ||
cedar_version: v4.0.0 | ||
policy_stores: | ||
a1bf93115de86de760ee0bea1d529b521489e5a11747: | ||
cedar_version: v4.0.0 | ||
name: PolicyStoreOk | ||
description: A test policy store where everything is fine. | ||
policies: | ||
840da5d85403f35ea76519ed1a18a33989f855bf1cf8: | ||
description: simple policy example for principal workload | ||
creation_date: '2024-09-20T17:22:39.996050' | ||
policy_content: | ||
encoding: none | ||
content_type: cedar | ||
body: |- | ||
permit( | ||
principal is Jans::Workload, | ||
action in [Jans::Action::"Update"], | ||
resource is Jans::Issue | ||
)when{ | ||
principal.org_id == resource.org_id | ||
}; | ||
444da5d85403f35ea76519ed1a18a33989f855bf1cf8: | ||
description: simple policy example for principal user | ||
creation_date: '2024-09-20T17:22:39.996050' | ||
policy_content: | ||
encoding: none | ||
content_type: cedar | ||
body: |- | ||
permit( | ||
principal is Jans::User, | ||
action in [Jans::Action::"Update"], | ||
resource is Jans::Issue | ||
)when{ | ||
principal.country == resource.country | ||
}; | ||
schema: | ||
encoding: none | ||
content_type: cedar | ||
body: |- | ||
namespace Jans { | ||
type Url = {"host": String, "path": String, "protocol": String}; | ||
entity Access_token = {"aud": String, "exp": Long, "iat": Long, "iss": TrustedIssuer, "jti": String}; | ||
entity Issue = {"country": String, "org_id": String}; | ||
entity Role; | ||
entity TrustedIssuer = {"issuer_entity_id": Url}; | ||
entity User in [Role] = {"country": String, "email": String, "sub": String, "username": String}; | ||
entity Workload = {"client_id": String, "iss": TrustedIssuer, "name": String, "org_id": String}; | ||
entity id_token = {"acr": String, "amr": String, "aud": String, "exp": Long, "iat": Long, "iss": TrustedIssuer, "jti": String, "sub": String}; | ||
action "Update" appliesTo { | ||
principal: [Workload, User, Role], | ||
resource: [Issue], | ||
context: {} | ||
}; | ||
} | ||
name: PolicyStoreOk | ||
description: A test policy store where everything is fine. | ||
policies: | ||
"some_policy_id": | ||
description: simple policy example for principal workload | ||
creation_date: '2024-09-20T17:22:39.996050' | ||
policy_content: |- | ||
permit( | ||
principal is Jans::Workload, | ||
action in [Jans::Action::"Update"], | ||
resource is Jans::Issue | ||
)when{ | ||
principal.org_id == resource.org_id | ||
}; | ||
"another_policy_id": | ||
description: simple policy example for principal user | ||
creation_date: '2024-09-20T17:22:39.996050' | ||
policy_content: |- | ||
permit( | ||
principal is Jans::User, | ||
action in [Jans::Action::"Update"], | ||
resource is Jans::Issue | ||
)when{ | ||
principal.country == resource.country | ||
}; | ||
schema: |- | ||
namespace Jans { | ||
type Url = {"host": String, "path": String, "protocol": String}; | ||
entity Access_token = {"aud": String, "exp": Long, "iat": Long, "iss": TrustedIssuer, "jti": String}; | ||
entity Issue = {"country": String, "org_id": String}; | ||
entity Role; | ||
entity TrustedIssuer = {"issuer_entity_id": Url}; | ||
entity User in [Role] = {"country": String, "email": String, "sub": String, "username": String}; | ||
entity Workload = {"client_id": String, "iss": TrustedIssuer, "name": String, "org_id": String}; | ||
entity id_token = {"acr": String, "amr": String, "aud": String, "exp": Long, "iat": Long, "iss": TrustedIssuer, "jti": String, "sub": String}; | ||
action "Update" appliesTo { | ||
principal: [Workload, User, Role], | ||
resource: [Issue], | ||
context: {} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters