Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Policy from_json in CedarJava #222

Closed
1 of 2 tasks
n-smir opened this issue Sep 27, 2024 · 3 comments
Closed
1 of 2 tasks

Support for Policy from_json in CedarJava #222

n-smir opened this issue Sep 27, 2024 · 3 comments
Labels
feature-request Request for a new feature

Comments

@n-smir
Copy link
Contributor

n-smir commented Sep 27, 2024

Category

User level API features/changes

Describe the feature you'd like to request

Currently there's Policy::from_json method available for Rust, but is not exposed to CedarJava bindings.

I'd like to be able to create Cedar policy object in Java from JSON representation of the policy.

Ideally having constructors/builders as suggested by cedar-policy/cedar#366 would be great but to my understanding that is not yet available even in Rust version.

Describe alternatives you've considered

Considered using Cedar text policy representations, but this presents challenges with serializing/de-serializing Java objects, effectively requiring to write a custom Cedar parser. JSON representation would easily converted to and from Java objects.

Additional context

No response

Is this something that you'd be interested in working on?

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change
@n-smir n-smir added feature-request Request for a new feature pending-triage Hasn't been triaged yet labels Sep 27, 2024
@shaobo-he-aws shaobo-he-aws added pending-review and removed pending-triage Hasn't been triaged yet labels Sep 28, 2024
@cdisselkoen cdisselkoen transferred this issue from cedar-policy/cedar Sep 30, 2024
@cdisselkoen
Copy link
Contributor

Ideally having constructors/builders as suggested by cedar-policy/cedar#366 would be great but to my understanding that is not yet available even in Rust version.

This could be done in the Java interface independently of whether it exists in the Rust public API. (The cedar-java package doesn't use the main Rust public API anyways, it uses the interface in the ffi module of the Rust.) Essentially it would be constructors/builders for the Java Policy object, that under-the-hood assemble a JSON policy object that could be sent across the FFI.

@n-smir
Copy link
Contributor Author

n-smir commented Sep 30, 2024

Understood, thanks. Seems like it would make more sense to have a separate feature request for constructors/builders approach in Java, and focus this one on Policy.fromJson implementation, since it seems to be a quick thing to add.

@shaobo-he-aws
Copy link
Contributor

Implemented via #223. Thank you, @n-smir.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for a new feature
Projects
None yet
Development

No branches or pull requests

3 participants