8000 Add AuthZen tenant and inline attributes support by danyi1212 · Pull Request #270 · permitio/PDP · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Conversation

danyi1212
Copy link
Contributor
  • 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 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.

- 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.
@danyi1212 danyi1212 self-assigned this Jun 16, 2025
@danyi1212 danyi1212 requested a review from omer9564 June 16, 2025 15:52
@danyi1212 danyi1212 changed the base branch from v2 to main June 16, 2025 15:55
- 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.
Copy link
@cursor cursor bot left a 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.
Copy link
Contributor
@omer9564 omer9564 left a 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());
Copy link
Contributor

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))

@danyi1212 danyi1212 merged commit 867731f into main Jun 17, 2025
5 checks passed
@danyi1212 danyi1212 deleted the dan/per-12503-pdp-authzen-add-tenant-and-attributes-context-support branch June 17, 2025 16:00
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.

2 participants
0