在CXF记录SOAP请求中屏蔽敏感数据

使用CXF调用SOAP Web服务后,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的扩展以及其他...我真的不知道从哪里开始,找不到关于此事的任何文档。

任何帮助,感谢您链接到文档!

realqishangbaxia 回答:在CXF记录SOAP请求中屏蔽敏感数据

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

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

我在此site

中找到了一些信息
本文链接:https://www.f2er.com/2769035.html

大家都在问