【问题标题】:Masking Sensitive Data in CXF Logging SOAP Requests屏蔽 CXF 记录 SOAP 请求中的敏感数据
【发布时间】:2020-05-01 14:40:33
【问题描述】:

使用 CXF 调用 SOAP webservice 后,CXF 客户端记录 SOAP 请求消息,密码可见!我想在 CXF 客户端日志记录中隐藏密码等敏感数据。

这是我在日志中得到的:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <runReport xmlns="http://xmlns.oracle.com/oxp/service/MYSERVICE">
       <userID>username</userID>
       <password>mypassword</password>
    </runReport>
  </soap:Body>
</soap:Envelope>

我只想将mypassword 替换为**********

我试过这个solution,但它不适用于我的 CXF 版本,因为它使用的是旧版本的 CXF。

我确实看到了很多例子,一些扩展 LoggingOutInterceptor,其他扩展 AbstractSoapInterceptor,其他扩展 PhaseInterceptorChain 等等......我真的不知道从哪里开始,我找不到关于这个问题的任何文档。

任何帮助,文档链接将不胜感激!

【问题讨论】:

  • 您找到解决方案了吗?干杯!
  • 不,我不再从事这个项目了,但我仍然想知道如何处理它!

标签: java spring-boot logging soap cxf


【解决方案1】:

我解决了这个扩展 LoggingInInterceptor 并在方法 addSensitiveElementNames 中添加我想隐藏的词,对于标题,他们有sensitiveProtocolHeaderNames 方法来做同样的事情。

  public class MyLogIn extends LoggingInInterceptor {
    
      public void handleMessage(Message message) throws Fault {
         addSensitiveElementNames(Set.of("description"));
         super.handleMessage(message);
      }
 }

我在这个site找到了一些信息

【讨论】:

  • 我找不到方法 addSensitiveElementNames,尽管我使用的是最新版本的 Apache CXF (3.4.3)。你在哪里找到的?
猜你喜欢
  • 2018-08-15
  • 2022-12-01
  • 1970-01-01
  • 1970-01-01
  • 2017-05-24
  • 1970-01-01
  • 2023-03-29
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多