-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added newInstance method to ProxiedUserDetails interface * Updated ProxiedUserDetails to use dynamic type for newInstance method. * bumped release version * bumped versions for some modules * Updated with latest changes from main/integration * Updated usage of cache inspector factory to use qualifier * Implemented authorization and query federation for the query microservices * Updated usage of remote user operations for query microservices * Moved the AuthorizationsPredicate class to authorization-api * PR feedback * PR feedback
- Loading branch information
Showing
16 changed files
with
211 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
api/src/main/java/datawave/security/authorization/predicate/AuthorizationsPredicate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package datawave.security.authorization.predicate; | ||
|
||
import java.util.function.Predicate; | ||
|
||
import org.apache.accumulo.core.security.Authorizations; | ||
import org.apache.accumulo.core.security.ColumnVisibility; | ||
import org.apache.accumulo.core.security.VisibilityEvaluator; | ||
import org.apache.accumulo.core.security.VisibilityParseException; | ||
|
||
/** | ||
* This is a predicate that will test the auths against a specified visibility (as defined by accumulo's ColumnVisibility). In addition to the visibility, one | ||
* can specify that only the first of the authorizations is matched (presumably the user). | ||
*/ | ||
public class AuthorizationsPredicate implements Predicate<Authorizations> { | ||
|
||
// A visibility string to be matched against the auths being used for the query | ||
private ColumnVisibility visibility; | ||
|
||
public AuthorizationsPredicate() {} | ||
|
||
public AuthorizationsPredicate(String visibility) { | ||
setVisibility(visibility); | ||
} | ||
|
||
@Override | ||
public boolean test(Authorizations auths) { | ||
// match the visibility against the auths. | ||
ColumnVisibility vis = getVisibility(); | ||
VisibilityEvaluator ve = new VisibilityEvaluator(auths); | ||
try { | ||
return (ve.evaluate(vis)); | ||
} catch (VisibilityParseException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
public ColumnVisibility getVisibility() { | ||
return visibility; | ||
} | ||
|
||
public void setVisibility(ColumnVisibility visibility) { | ||
this.visibility = visibility; | ||
} | ||
|
||
public void setVisibility(String visibility) { | ||
setVisibility(new ColumnVisibility(visibility)); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "(auths =~ " + visibility + ')'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.