OAuthRequestFilter(或 ContainerRequestFilter)在 AbstractFeature 中不起作用 - "org.apache.cxf.resource.method" 为空

OAuthRequestFilter (or ContainerRequestFilter) not working inside AbstractFeature - "org.apache.cxf.resource.method" is null

我们正在使用 CXF 3.x,项目有 classes MyFeature extends AbstractFeature 和 `MyFilter extends OAuthRequestFilter.

内部 MyFeature class MyFilter 的对象创建为 MyFilter myFilter = new MyFilter (classObj); 其中 classObj 是 class 的对象,过滤器需要在其上应用。

当我到达端点时,它会抛出 403 错误。

进一步,当我使用调试器和 LOG 消息时,我知道文件 org.apache.cxf.interceptor.security.AbstractAuthorizingInInterceptor(cxf-core 版本 3.0.4.redhat-621159)中有函数 getTargetMethod 并且 BindingOperationInfom.get("org.apache.cxf.resource.method") 的方法评估即将到来 null,因此我得到 403.

注意:我们使用 osgi (jboss) 包作为部署策略。

JAXRSInInterceptor 执行的过滤器处于 unmarshal 状态。在这种状态下 org.apache.cxf.resource.method 仍然是 null。我在 PRE_STREAM 状态下创建了拦截器,那时 org.apache.cxf.resource.method 给了你应该执行的正确名称。