feat(jans-cedarling): add C bindings support#13542
Conversation
- Introduced new `cedarling_c` package with a `Cargo.toml` file for configuration. - Implemented `build.rs` for generating C bindings using `cbindgen`. - Created `c_interface.rs` to manage Cedarling instances and authorization functions. - Added `types.rs` for defining error codes and result structures. - Included `lib.rs` as the main entry point for the C interface. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
…ation engine - Introduced comprehensive documentation for the new C bindings, detailing features, installation steps, usage examples, and API reference. - Included instructions for building from source, linking, and utilizing the Context Data API for policy evaluation. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
- Introduced a new Makefile for building and running tests for the Cedarling C bindings. - Added `test_cedarling.c` containing comprehensive tests for library initialization, instance creation, and authorization functionalities. - Implemented assertions to validate test outcomes and error handling. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
…ng C bindings - Introduced three new example files: `authorize_multi_issuer.c`, `authorize_unsigned.c`, and `basic_example.c` to demonstrate various authorization scenarios using Cedarling C bindings. - Each example includes detailed comments and configurations for multi-issuer JWT authorization and unsigned authorization with custom principals. - Added a Makefile to facilitate building and running the examples. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
- Introduced a new tutorial document for Cedarling C bindings, covering installation, configuration, and usage examples. - Included detailed instructions for building from source, linking applications, and utilizing the Context Data API. - Updated the existing getting started guide to reference the new C tutorial. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
- Introduced a new job `c_tests` in the CI workflow to build and run C tests for the Cedarling C bindings. - Added steps for installing necessary tools including Protoc and Rust, caching Rust dependencies, and building the Rust C library. - Implemented commands to compile and execute the C tests, enhancing the testing coverage for the project. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
- Updated the mkdocs configuration to include a link to the new C tutorial in the Tutorials section, enhancing navigation for users seeking information on Cedarling C bindings. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds a new Cedarling C bindings crate (cdylib/staticlib) with generated C headers, extensive C FFI exports, examples, tests, docs/tutorial pages, and a CI Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
|
the failing C tests will be resolved once #13538 is merged its currently blocked by that |
…C interface Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
…s to C interface Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
…ionality Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
…ation Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
…darling API. Updated README to clarify error reporting mechanisms, including the use of `cedarling_get_last_error()` for specific error cases. Simplified error handling in example files by removing redundant error messages. Improved consistency in error handling across API functions to ensure clarity and robustness. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
…ieve full data entries with metadata. Updated README and tests to reflect this new functionality Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
… clarify safety requirements and parameter expectations. Improved descriptions for initialization, instance creation, authorization, and context data management functions, ensuring consistency and clarity for C callers. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
c98458f
tareknaser
left a comment
There was a problem hiding this comment.
Thank you for the great work so far. I left a couple of final commits.
- Removed the cbindgen installation step from the GitHub Actions workflow. - Updated documentation to reflect the removal of cbindgen usage in the build process for the Rust C library, clarifying the steps for building and copying artifacts. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
…agement for freeing string arrays to use `Box::from_raw` Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
- Introduced a new function `cedarling_result_from_data_error` to map `DataError` to `CedarlingErrorCode`, improving error handling consistency across context functions. - Updated error handling in `context_push`, `context_get`, `context_get_entry`, `context_remove`, `context_clear`, `context_list`, and `context_stats` to utilize the new mapping function. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
…process for linking against the shared library and building the project in release mode. Signed-off-by: haileyesus2433 <haileyesusbe@gmail.com>
tareknaser
left a comment
There was a problem hiding this comment.
Thank you for the great work. I have no further comments
|
@coderabbitai could u please approve if u dont have any suggestions |
|
Tip For best results, initiate chat on the files or code changes.
Once the dependent PR is merged, CI passes, and the human reviewer's feedback is addressed, feel free to post 🧠 Learnings used |
thank you verymuch for the reviews |
|
@coderabbitai approve |
✅ Actions performedComments resolved and changes approved. |
Prepare
Description
Target issue
closes #11754
Implementation Details
Test and Document the changes
Please check the below before submitting your PR. The PR will not be merged if there are no commits that start with
docs:to indicate documentation changes or if the below checklist is not selected.Summary by CodeRabbit
New Features
Documentation
Tests
Chores