dimas-b commented on code in PR #4831:
URL: https://github.com/apache/polaris/pull/4831#discussion_r3503304006
##########
polaris-core/src/main/java/org/apache/polaris/core/auth/PolarisAuthorizer.java:
##########
@@ -80,4 +80,19 @@ void authorizeOrThrow(
@NonNull PolarisAuthorizableOperation authzOp,
@Nullable List<PolarisResolvedPathWrapper> targets,
@Nullable List<PolarisResolvedPathWrapper> secondaries);
+
+ /**
+ * Filters a candidate list of securables to only those the principal is
authorized to see.
+ *
+ * <p>The default implementation returns all candidates unchanged,
preserving backward
+ * compatibility for authorizers that do not implement visibility filtering.
+ *
+ * <p>If filtering encounters an error, implementations should throw rather
than fall back to
+ * returning unfiltered results.
+ */
+ @NonNull
+ default List<PolarisSecurable> filterByVisibility(
+ @NonNull AuthorizationState authzState, @NonNull VisibilityFilterRequest
request) {
Review Comment:
We can update the `authorize()` method or create a new one and retrofit the
old methods into it. Something like `authorize(request(list of entities,
etc..)) -> list of decisions per entity`.
The request will have some information that is shared across all entities in
the list, and implementation are free to use it to short-circuit decisions, of
course. Mapping the same decision to each entity in the returned value is
probably not a lot of overhead after the decision is made.
We may need to change the return type of `authorize()` to allow more than
one output decision.
Does this sound reasonable?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]