使用 opensaml 解组 XACML Policie 文件

发布于 2024-12-09 01:40:38 字数 77 浏览 0 评论 0原文

任何人都可以给我一个好的教程的链接,它可以让我了解如何使用策略文件中的 openSAML2 api 构建 XACMLObject 吗? 谢谢

Could any one please give me a link of a good tutorial that could give me an idea how i could build a XACMLObject using openSAML2 api from the policie file ?
Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

菊凝晚露 2024-12-16 01:40:38

我没有为此目的使用 OpenSAML 库。但我已将其用于涉及 XACML 请求和响应的其他目的。以下内容可能会帮助您获得一个想法。它从字符串创建 XACMLRequest。

private String extractXACMLRequest(String decisionQuery) throws Exception {
    RequestType xacmlRequest = null;
    doBootstrap();
    String queryString = null;
    XACMLAuthzDecisionQueryType xacmlAuthzDecisionQuery;
    try {
        xacmlAuthzDecisionQuery = (XACMLAuthzDecisionQueryType) unmarshall(decisionQuery);
        //Access the XACML request only if Issuer and the Signature are valid.
        if (validateIssuer(xacmlAuthzDecisionQuery.getIssuer())) {
                if (validateSignature(xacmlAuthzDecisionQuery.getSignature())) {
                    xacmlRequest = xacmlAuthzDecisionQuery.getRequest();
                } else {
                    log.debug("The submitted signature is not valid!");
                }
        } else {
            log.debug("The submitted issuer is not valid!");
        }

        if (xacmlRequest != null) {
            queryString = marshall(xacmlRequest);
            queryString = queryString.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "").replace("\n", "");
        }
        return queryString;
    } catch (Exception e) {
        log.error("Error unmarshalling the XACMLAuthzDecisionQuery.", e);
        throw new Exception("Error unmarshalling the XACMLAuthzDecisionQuery.", e);
    }

}

I haven't use OpenSAML library for this purpose. But I have used for some other purpose which involved XACML requests and responses. Following may help you to get an idea. It is creating a XACMLRequest from a String.

private String extractXACMLRequest(String decisionQuery) throws Exception {
    RequestType xacmlRequest = null;
    doBootstrap();
    String queryString = null;
    XACMLAuthzDecisionQueryType xacmlAuthzDecisionQuery;
    try {
        xacmlAuthzDecisionQuery = (XACMLAuthzDecisionQueryType) unmarshall(decisionQuery);
        //Access the XACML request only if Issuer and the Signature are valid.
        if (validateIssuer(xacmlAuthzDecisionQuery.getIssuer())) {
                if (validateSignature(xacmlAuthzDecisionQuery.getSignature())) {
                    xacmlRequest = xacmlAuthzDecisionQuery.getRequest();
                } else {
                    log.debug("The submitted signature is not valid!");
                }
        } else {
            log.debug("The submitted issuer is not valid!");
        }

        if (xacmlRequest != null) {
            queryString = marshall(xacmlRequest);
            queryString = queryString.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "").replace("\n", "");
        }
        return queryString;
    } catch (Exception e) {
        log.error("Error unmarshalling the XACMLAuthzDecisionQuery.", e);
        throw new Exception("Error unmarshalling the XACMLAuthzDecisionQuery.", e);
    }

}
比忠 2024-12-16 01:40:38

您想要使用 sunXACML 或 JAXB 来编组/解组 XACML 策略而不是 openSAML2。

You want to use sunXACML or JAXB to marshall / unmarshall XACML policies not openSAML2.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文