use of org.apache.accumulo.core.security.VisibilityParseException in project accumulo by apache.
the class VisibilityFilter method accept.
@Override
public boolean accept(Key k, Value v) {
ByteSequence testVis = k.getColumnVisibilityData();
if (filterInvalid) {
Boolean b = (Boolean) cache.get(testVis);
if (b != null)
return b;
try {
new ColumnVisibility(testVis.toArray());
cache.put(testVis, true);
return true;
} catch (BadArgumentException e) {
cache.put(testVis, false);
return false;
}
} else {
if (testVis.length() == 0) {
return true;
}
Boolean b = (Boolean) cache.get(testVis);
if (b != null)
return b;
try {
Boolean bb = ve.evaluate(new ColumnVisibility(testVis.toArray()));
cache.put(testVis, bb);
return bb;
} catch (VisibilityParseException | BadArgumentException e) {
log.error("Parse Error", e);
return false;
}
}
}
use of org.apache.accumulo.core.security.VisibilityParseException in project vertexium by visallo.
the class AccumuloAuthorizations method canRead.
@Override
public boolean canRead(Visibility visibility) {
Preconditions.checkNotNull(visibility, "visibility is required");
// this is just a shortcut so that we don't need to construct evaluators and visibility objects to check for an empty string.
if (visibility.getVisibilityString().length() == 0) {
return true;
}
VisibilityEvaluator visibilityEvaluator = new VisibilityEvaluator(new org.apache.accumulo.core.security.Authorizations(this.getAuthorizations()));
ColumnVisibility columnVisibility = new ColumnVisibility(visibility.getVisibilityString());
try {
return visibilityEvaluator.evaluate(columnVisibility);
} catch (VisibilityParseException e) {
throw new VertexiumException("could not evaluate visibility " + visibility.getVisibilityString(), e);
}
}
Aggregations