• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java VisibilityParseException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.accumulo.core.security.VisibilityParseException的典型用法代码示例。如果您正苦于以下问题:Java VisibilityParseException类的具体用法?Java VisibilityParseException怎么用?Java VisibilityParseException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



VisibilityParseException类属于org.apache.accumulo.core.security包,在下文中一共展示了VisibilityParseException类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: canRead

import org.apache.accumulo.core.security.VisibilityParseException; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:visallo,项目名称:vertexium,代码行数:18,代码来源:AccumuloAuthorizations.java


示例2: doesUserHaveDocumentAccess

import org.apache.accumulo.core.security.VisibilityParseException; //导入依赖的package包/类
/**
 * Checks if the user's authorizations allows them to have access to the
 * provided document based on its document visibility.
 * @param authorizations the {@link Authorizations}.
 * @param documentVisibility the {@link DocumentVisibility}.
 * @param doesEmptyAccessPass {@code true} if an empty authorization pass
 * allows access to everything. {@code false} otherwise.
 * @return {@code true} if the user has access to the document.
 * {@code false} otherwise.
 */
public static boolean doesUserHaveDocumentAccess(final Authorizations authorizations, final DocumentVisibility documentVisibility, final boolean doesEmptyAccessPass) {
    final Authorizations userAuths = authorizations != null ? authorizations : MongoDbRdfConstants.ALL_AUTHORIZATIONS;
    final VisibilityEvaluator visibilityEvaluator = new VisibilityEvaluator(userAuths);
    boolean accept = false;
    if (doesEmptyAccessPass && MongoDbRdfConstants.ALL_AUTHORIZATIONS.equals(userAuths)) {
        accept = true;
    } else {
        try {
            accept = visibilityEvaluator.evaluate(documentVisibility);
        } catch (final VisibilityParseException e) {
            log.error("Could not parse document visibility.");
        }
    }

    return accept;
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:27,代码来源:DocumentVisibilityUtil.java


示例3: validateVisibilityExpression

import org.apache.accumulo.core.security.VisibilityParseException; //导入依赖的package包/类
/**
 * Validate Accumulo-style visibility expression against a set of authorizations.
 *
 * @param auths Formal authorizations of the user
 * @param visibilityExpression Accumulo-style visibility expression
 * @return true if validation authorizations against visibility expression, false otherwise
 */
public static boolean validateVisibilityExpression(Set<String> auths, String visibilityExpression) {
    if (StringUtils.isBlank(visibilityExpression)) {
        return true; // No visibility to check
    }

    if (auths == null || auths.isEmpty()) {
        return false; // Has visibility but no auths
    }

    final VisibilityEvaluator visEval = new VisibilityEvaluator(
            new org.apache.accumulo.core.security.Authorizations(
                    auths.toArray(new String[] {})));

    try {
        return visEval.evaluate(new ColumnVisibility(visibilityExpression));
    } catch (final VisibilityParseException e) {
        return false;
    }
}
 
开发者ID:ezbake,项目名称:ezbake-common-java,代码行数:27,代码来源:PermissionUtils.java


示例4: validateVisibility

import org.apache.accumulo.core.security.VisibilityParseException; //导入依赖的package包/类
private String validateVisibility(HttpServletRequest request, HttpServletResponse response) {
    String formalVisibility = request.getParameter("formalVisibility");
    String result;

    try {
        logger.info("validateVisibility: formalVisibility: {}", formalVisibility);
        MongoDatasetClient.getInstance().validateVisibility(formalVisibility);
        result = String.format("Successfully validated formal visibility '%s'", formalVisibility);
        logger.info(result);
    } catch (VisibilityParseException e) {
        result =
                String.format("Error when validating formal visibility '%s': %s", formalVisibility, e.getMessage());

        response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
    }

    return result;
}
 
开发者ID:ezbake,项目名称:ezbake-training,代码行数:19,代码来源:MongoDbServlet.java


示例5: hasNext

import org.apache.accumulo.core.security.VisibilityParseException; //导入依赖的package包/类
public boolean hasNext() {
	if (cursor != this.values.size()) {
		for (int i = cursor; i < this.values.size(); i++) {
			try {
				if (ve.evaluate(this.values.get(i).getColumnVisibility())) {
					return true;
				}
			} catch (VisibilityParseException e) {
				throw new RuntimeException(e);
			}
		}
		return false;
	} else {
		return false;
	}
}
 
开发者ID:Sotera,项目名称:zephyr-contrib,代码行数:17,代码来源:VisibilityIterator.java


示例6: run

import org.apache.accumulo.core.security.VisibilityParseException; //导入依赖的package包/类
@Override
public Object run() {
    ScriptDocValues docValues = (ScriptDocValues) doc().get(securityExpressionField);

    if (docValues == null) {
        logger.warn("Document didn't contain '" + securityExpressionField + "' for security label check!");
        return false;
    }

    List values = docValues.getValues();
    if (values == null || values.isEmpty()) {
        logger.warn("Document contained no values in '" + securityExpressionField + "'!");
        return false;
    }

    String visibilityExpression = values.get(0).toString();

    Boolean result = (Boolean) cache.get(visibilityExpression);
    if (result != null) {
        return result;
    }

    try {
        result = visibilityEvaluator.evaluate(new ColumnVisibility(visibilityExpression));
        cache.put(visibilityExpression, result);
        return result;
    } catch (VisibilityParseException e) {
        logger.error("Document contained unparseable '" + securityExpressionField + "' <" + visibilityExpression + ">!");
        return false;
    }
}
 
开发者ID:jstoneham,项目名称:elasticsearch-accumulo-security,代码行数:32,代码来源:AccumuloVisibilityFilter.java


示例7: validateVisibility

import org.apache.accumulo.core.security.VisibilityParseException; //导入依赖的package包/类
public void validateVisibility(String formalVisibility) throws VisibilityParseException {
    VisibilityUtils.generateVisibilityList(formalVisibility);
}
 
开发者ID:ezbake,项目名称:ezbake-training,代码行数:4,代码来源:MongoDatasetClient.java



注:本文中的org.apache.accumulo.core.security.VisibilityParseException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Registration类代码示例发布时间:2022-05-22
下一篇:
Java IllegalConfigurationException类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap