Skip to content

Conversation

mark-creamer-amazon
Copy link
Contributor

#38

CedarJava

  • Added static PolicySet parsePolicies(Path filePath) and PolicySet parsePolicies(String policiesString) methods to PolicySet.
  • Added PolicySetTests file that tests the File path and string methods and some exception cases.
  • Adding test cedar policy files in src/test/resources directory to use for testing.

CedarJavaFFI

  • Added JNI method parsePoliciesJni that takes a Java String for policies and templates, uses PolicySet::from_str to parse the string into policies and templates and then constructs a Java PolicySet with those parameters. Template instantiations are omitted.

Signed-off-by: Mark Creamer <mjcream@amazon.com>
Signed-off-by: Mark Creamer <mjcream@amazon.com>
@mark-creamer-amazon mark-creamer-amazon marked this pull request as ready for review June 27, 2024 19:40
Copy link
Contributor

@khieta khieta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! Could you also update the integration tests to use these new APIs instead of hacky splitting on semicolons? Relevant code is here:

private Set<Policy> loadPolicies(String policiesFile) throws IOException {

Signed-off-by: Mark Creamer <mjcream@amazon.com>
Also modified the FFI code to actually take the policy id from the Rust output instead of using the atomic policy ID counter from the Java Policy object
Signed-off-by: Mark Creamer <mjcream@amazon.com>
Signed-off-by: Mark Creamer <mjcream@amazon.com>
Copy link
Contributor

@khieta khieta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@shaobo-he-aws shaobo-he-aws merged commit 4aa1097 into cedar-policy:main Jul 1, 2024
shaobo-he-aws pushed a commit that referenced this pull request Aug 22, 2024
Signed-off-by: Mark Creamer <mjcream@amazon.com>
Signed-off-by: Shaobo He <shaobohe@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants