WSO2 身份/如何注册 XACML PIP Java 扩展及其声明

WSO2 Identity / How to Register XACML PIP Java Extension and its Claims

浏览 WSO2 文档和几个博客,我发现了三种不同类型的注册机制来向 Java PIP 模块添加新声明:

  1. 通过使用名为 entitlement.properties 的安装文件并为每个变量添加 Java 静态属性,如 WSO2 手册中的示例案例,请参阅:Writing a Custom Policy Info Point

  2. 按照linkHow to write a PIP point for WSO2 IS中所述使用supportedAttributesIds.add

  3. 通过使用 setter 方法:public Set getSupportedIds() { Set<String> ids = new HashSet<String>(); ids.add("http://kmarket.com/id/role"); return ids; } 如 Whosebug post How To Add User Defined Attribute in PIP Attribute User Store

请说明这三个选项中哪一个是更新和推荐的解决方案,用于添加由 Balana PIP 执行的外部数据源查找产生的新字段作为 "AttributeFinderModule" class 的扩展.

我还测试了本例中的代码 posted 并使用 Java 6 JDK 编译了它,请参阅源代码参考 How To Add User Defined Attribute in PIP Attribute User Store 重启后,WSO2服务器继续显示如下错误:

Error while loading entitlement policies. Exception occurred while trying to invoke service method getAllPolicies
The following error details are available. Please refer logs for more details.
org.apache.axis2.AxisFault: Exception occurred while trying to invoke service method getAllPolicies
at org.wso2.carbon.identity.entitlement.ui.client.EntitlementPolicyAdminServiceClient.handleException(EntitlementPolicyAdminServiceClient.java:478)
at org.wso2.carbon.identity.entitlement.ui.client.EntitlementPolicyAdminServiceClient.getAllPolicies(EntitlementPolicyAdminServiceClient.java:81)
at org.apache.jsp.entitlement.index_jsp._jspService(org.apache.jsp.entitlement.index_jsp:183)

添加扩展的 AttributeFinder Java 扩展时。这是 WSO2 服务器中的已知错误吗?

第一种方式是可配置的,添加新属性时不需要重新构建和部署PIP。您只需将它们添加到 entitlement.properties 文件。并重启 IS。

另外两种方式,每次属性改变都需要重新构建PIP模块。

但是,如果您要添加和属性,您也必须为此实现逻辑,因此在这种情况下,最后两种方式也是有意义的。

我已经用 svn 源存储库中的最新版本替换了 KmarketPIIPAttributeFinder 程序模块(参见下面的 link)并编译了它。这解决了 WSO2 身份服务器版本 5 下的问题,例程开始注册 PIP 属性,现在在 PDP 扩展中可见。

从以下位置下载最新代码:https://svn.wso2.org/repos/wso2/carbon/platform/trunk/components/identity/org.wso2.carbon.identity.samples.entitlement.pip/src/main/java/org/wso2/carbon/identity/samples/entitlement/pip/KmarketPIPAttributeFinder.java