如何在 authzforce 服务器上启用我的自定义请求预处理器扩展

问题描述 投票:0回答:0

-- 在我的代码中,请求预处理器的 id 是:

/**
         * Request preprocessor ID, as returned by {@link #getId()}
         */
        public static final String ID = "urn:ow2:authzforce:feature:pdp:request-preproc:xacml-xml:custom-attribute";

--我把自己做的自定义requestpreprocessor打包成jar文件,修改authzforce server文件的pdp.xml如下:

 <requestPreproc>urn:ow2:authzforce:feature:pdp:request-preproc:xacml-xml:custom-attribute</requestPreproc>
-- 我正在使用 authzforce-ce-restful-pdp-cxf-spring-boot-server-6.0.1.jar 文件来运行服务器 - 当我尝试运行服务器时,出现此错误:应用程序运行失败
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pdpEngineConf' defined in URL [file:./spring-beans.xml]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.ow2.authzforce.core.pdp.impl.PdpEngineConfiguration]: Factory method 'getInstance' threw exception; nested exception is java.lang.IllegalArgumentException: No PDP extension of type 'interface org.ow2.authzforce.core.pdp.api.DecisionRequestPreprocessor$Factory' found with ID: urn:ow2:authzforce:feature:pdp:request-preproc:xacml-xml:custom-attribute. Expected IDs: [urn:ow2:authzforce:feature:pdp:request-preproc:xacml-json:default-lax, urn:ow2:authzforce:feature:pdp:request-preproc:xacml-json:default-strict, urn:ow2:authzforce:feature:pdp:request-preproc:xacml-json:multiple:repeated-attribute-categories-lax, urn:ow2:authzforce:feature:pdp:request-preproc:xacml-json:multiple:repeated-attribute-categories-strict, urn:ow2:authzforce:feature:pdp:request-preproc:xacml-xml:default-lax, urn:ow2:authzforce:feature:pdp:request-preproc:xacml-xml:default-strict, urn:ow2:authzforce:feature:pdp:request-preproc:xacml-xml:multiple:repeated-attribute-categories-lax, urn:ow2:authzforce:feature:pdp:request-preproc:xacml-xml:multiple:repeated-attribute-categories-strict]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:953)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:414)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:302)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292)
    at org.ow2.authzforce.rest.pdp.cxf.springboot.CxfJaxrsPdpSpringBootApp.main(CxfJaxrsPdpSpringBootApp.java:56)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
    at org.springframework.boot.loader.PropertiesLauncher.main(PropertiesLauncher.java:467)
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.ow2.authzforce.core.pdp.impl.PdpEngineConfiguration]: Factory method 'getInstance' threw exception; nested exception is java.lang.IllegalArgumentException: No PDP extension of type 'interface org.ow2.authzforce.core.pdp.api.DecisionRequestPreprocessor$Factory' found with ID: urn:ow2:authzforce:feature:pdp:request-preproc:xacml-xml:custom-attribute. Expected IDs: [urn:ow2:authzforce:feature:pdp:request-preproc:xacml-json:default-lax, urn:ow2:authzforce:feature:pdp:request-preproc:xacml-json:default-strict, urn:ow2:authzforce:feature:pdp:request-preproc:xacml-json:multiple:repeated-attribute-categories-lax, urn:ow2:authzforce:feature:pdp:request-preproc:xacml-json:multiple:repeated-attribute-categories-strict, urn:ow2:authzforce:feature:pdp:request-preproc:xacml-xml:default-lax, urn:ow2:authzforce:feature:pdp:request-preproc:xacml-xml:default-strict, urn:ow2:authzforce:feature:pdp:request-preproc:xacml-xml:multiple:repeated-attribute-categories-lax, urn:ow2:authzforce:feature:pdp:request-preproc:xacml-xml:multiple:repeated-attribute-categories-strict]
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
    ... 27 common frames omitted
Caused by: java.lang.IllegalArgumentException: No PDP extension of type 'interface org.ow2.authzforce.core.pdp.api.DecisionRequestPreprocessor$Factory' found with ID: urn:ow2:authzforce:feature:pdp:request-preproc:xacml-xml:custom-attribute. Expected IDs: [urn:ow2:authzforce:feature:pdp:request-preproc:xacml-json:default-lax, urn:ow2:authzforce:feature:pdp:request-preproc:xacml-json:default-strict, urn:ow2:authzforce:feature:pdp:request-preproc:xacml-json:multiple:repeated-attribute-categories-lax, urn:ow2:authzforce:feature:pdp:request-preproc:xacml-json:multiple:repeated-attribute-categories-strict, urn:ow2:authzforce:feature:pdp:request-preproc:xacml-xml:default-lax, urn:ow2:authzforce:feature:pdp:request-preproc:xacml-xml:default-strict, urn:ow2:authzforce:feature:pdp:request-preproc:xacml-xml:multiple:repeated-attribute-categories-lax, urn:ow2:authzforce:feature:pdp:request-preproc:xacml-xml:multiple:repeated-attribute-categories-strict]
    at org.ow2.authzforce.core.pdp.impl.PdpExtensions.getExtension(PdpExtensions.java:179)
    at org.ow2.authzforce.core.pdp.impl.PdpEngineConfiguration.<init>(PdpEngineConfiguration.java:608)
    at org.ow2.authzforce.core.pdp.impl.PdpEngineConfiguration.getInstance(PdpEngineConfiguration.java:650)
    at org.ow2.authzforce.core.pdp.impl.PdpEngineConfiguration.getInstance(PdpEngineConfiguration.java:694)
    at org.ow2.authzforce.core.pdp.impl.PdpEngineConfiguration.getInstance(PdpEngineConfiguration.java:726)
    at org.ow2.authzforce.core.pdp.impl.PdpEngineConfiguration.getInstance(PdpEngineConfiguration.java:862)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)

-- 注意事项:我将扩展名添加到 authzforce-ce-restful-pdp-cxf-spring-boot-server-6.0.1.jar 文件所在的同一文件夹,我也更改了它并创建了一个 lib 文件夹包括扩展但没有任何效果

我不确定问题是什么,或者如何解决。任何帮助表示赞赏。

preprocessor xacml authzforce
© www.soinside.com 2019 - 2024. All rights reserved.