Julien Greffe created CXF-8692:
----------------------------------
Summary: CXF custom sensitive logging doesn't work on jaxrs jaxws
features blueprint declaration
Key: CXF-8692
URL: https://issues.apache.org/jira/browse/CXF-8692
Project: CXF
Issue Type: Bug
Components: JAX-RS, logging, WS-* Components
Affects Versions: 3.4.7
Reporter: Julien Greffe
Attachments: image-2022-04-13-11-50-12-253.png
Hello,
we tried setting a custom sensitive logging using blueprint and following
documentation [https://cxf.apache.org/docs/message-logging.html].
This feature doesn't work when adding our bean/service in {{<jaxrs:features>}}
or {{<jaxws:features>}} .
We have to declare the bean/service on {{<cxf:bus>}} level:
Not working;
{code:java}
<jaxrs:server id="SAMRestService" address="/sam">
<jaxrs:serviceBeans>
<ref component-id="restService" />
</jaxrs:serviceBeans>
<jaxrs:providers>
<bean class="org.talend.esb.sam.service.rest.SAMExceptionMapper" />
<bean class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
<property name="ignoreNamespaces" value="true" />
<property name="dropRootElement" value="true" />
</bean>
</jaxrs:providers>
<jaxrs:features>
<reference id="sensitiveLoggingFeature"
interface="org.talend.esb.security.logging.SensitiveLoggingFeature" />
</jaxrs:features>
</jaxrs:server>
{code}
Working:
{code:java}
<cxf:bus>
<cxf:features>
<reference id="sensitiveLoggingFeature"
interface="org.talend.esb.security.logging.SensitiveLoggingFeature" />
</cxf:features>
</cxf:bus>
<jaxrs:server id="SAMRestService" address="/sam">
<jaxrs:serviceBeans>
<ref component-id="restService" />
</jaxrs:serviceBeans>
<jaxrs:providers>
<bean class="org.talend.esb.sam.service.rest.SAMExceptionMapper" />
<bean class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
<property name="ignoreNamespaces" value="true" />
<property name="dropRootElement" value="true" />
</bean>
</jaxrs:providers>
</jaxrs:server>
{code}
It seems without explicit {{<cxf;bus>}} declaration, bus will have cxf:logging
feature by default, and therefore will be used instead of custom one:
[https://github.com/apache/cxf/blob/cxf-3.4.4/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java#L192-L193]
See screenshot of stack:
- JAXRSServerFactoryBean has our custom logging feature >> not used
- bus has standard logging feature >> used
!image-2022-04-13-11-50-12-253.png!
--
This message was sent by Atlassian Jira
(v8.20.1#820001)