-
Notifications
You must be signed in to change notification settings - Fork 6
Add AuthZen tenant and inline attributes support #270
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
Add AuthZen tenant and inline attributes support #270
Conversation
- Introduced a new `validation_error` method in `AuthZenError` for handling JSON schema validation failures. - Updated error handling in the evaluation logic to return detailed validation error messages for unprocessable entities (422). - Refactored request conversion logic 8000 in `evaluation.rs`, `schema.rs`, and `search_action.rs` to streamline property extraction and improve clarity. - Added comprehensive tests for resource and subject conversions, ensuring correct handling of attributes and properties.
- Simplified the extraction of properties and attributes in `evaluation.rs`, `schema.rs`, and `search_action.rs`. - Removed unnecessary nested structures for attributes, enhancing clarity in the code. - Updated tests to reflect the new structure and ensure accurate handling of resource and subject properties. - Improved overall readability and maintainability of the AuthZen API integration.
- Updated `AuthZenResource` and `AuthZenSubject` to use `Option<String>` for IDs, allowing for better default handling and serialization. - Modified related search and action request structures to accommodate the new ID types. - Adjusted tests to reflect changes in resource ID handling and ensure compatibility with the updated structures. - Enhanced overall clarity and maintainability of the AuthZen API integration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ BugBot reviewed your changes and found no bugs!
BugBot free trial expires on June 18, 2025
You have used $0.00 of your $20.00 spend limit so far. Manage your spend limit in the Cursor dashboard.
Was this report helpful? Give feedback by reacting with 👍 or 👎
- Updated the conversion implementation for `ResourceSearchRequest` to extract properties directly from the resource instead of the context, improving clarity and consistency. - Adjusted the handling of the context field to maintain compatibility with existing structures. - Added an empty "id" field to the resource type in tests to ensure proper structure and validation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved with comment
@@ -55,12 +46,14 @@ pub struct ResourceSearchResponse { | |||
// Convert AuthZen request to UserPermissionsQuery | |||
impl From<ResourceSearchRequest> for UserPermissionsQuery { | |||
fn from(req: ResourceSearchRequest) -> Self { | |||
let mut properties = req.resource.properties.unwrap_or_default(); | |||
let tenant = properties.remove("tenant").map(|v| v.to_string()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also have resources = req.resource.map(|v| vec!(v))
validation_error
method inAuthZenError
for handling JSON schema validation failures.evaluation.rs
,schema.rs
, andsearch_action.rs
to streamline property extraction and improve clarity.