This is an automated email from the ASF dual-hosted git repository.
reta pushed a commit to branch 3.5.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git
The following commit(s) were added to refs/heads/3.5.x-fixes by this push:
new 04ab160312 add option to configure externally supplied implementation
for sensitive data masking (#1150)
04ab160312 is described below
commit 04ab160312efc174ad588be9f052dcb91e6c8d92
Author: JohnMTu <[email protected]>
AuthorDate: Thu Jul 6 23:53:41 2023 +0200
add option to configure externally supplied implementation for sensitive
data masking (#1150)
* add interface to hide sensitive data in message
* add option to configure externally supplied implementation for sensitive
data masking
* add option to configure externally supplied implementation for sensitive
data masking
* make maskSensitiveHelper non-final and settable to allow custom
implementations and remove SensitiveDataMasker
---
.../cxf/ext/logging/AbstractLoggingInterceptor.java | 6 +++++-
.../java/org/apache/cxf/ext/logging/LoggingFeature.java | 16 +++++++++++++++-
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git
a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/AbstractLoggingInterceptor.java
b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/AbstractLoggingInterceptor.java
index 5fd0b28564..38b3490310 100644
---
a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/AbstractLoggingInterceptor.java
+++
b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/AbstractLoggingInterceptor.java
@@ -52,7 +52,7 @@ public abstract class AbstractLoggingInterceptor extends
AbstractPhaseIntercepto
protected LogEventSender sender;
protected final DefaultLogEventMapper eventMapper = new
DefaultLogEventMapper();
- protected final MaskSensitiveHelper maskSensitiveHelper = new
MaskSensitiveHelper();
+ protected MaskSensitiveHelper maskSensitiveHelper = new
MaskSensitiveHelper();
protected Set<String> sensitiveProtocolHeaderNames = new HashSet();
@@ -103,6 +103,10 @@ public abstract class AbstractLoggingInterceptor extends
AbstractPhaseIntercepto
this.sensitiveProtocolHeaderNames.addAll(protocolHeaderNames);
}
+ public void setSensitiveDataHelper(MaskSensitiveHelper
maskSensitiveHelper) {
+ this.maskSensitiveHelper = maskSensitiveHelper;
+ }
+
public void setPrettyLogging(boolean prettyLogging) {
if (sender instanceof PrettyLoggingFilter) {
((PrettyLoggingFilter)this.sender).setPrettyLogging(prettyLogging);
diff --git
a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingFeature.java
b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingFeature.java
index 43bedc484a..842a046713 100644
---
a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingFeature.java
+++
b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingFeature.java
@@ -198,7 +198,16 @@ public class LoggingFeature extends
DelegatingFeature<LoggingFeature.Portable> {
public void addSensitiveProtocolHeaderNames(final Set<String>
sensitiveProtocolHeaderNames) {
delegate.addSensitiveProtocolHeaderNames(sensitiveProtocolHeaderNames);
}
-
+
+ /**
+ * Replaces MaskSensitiveHelper implementation with given one.
+ *
+ * @param maskSensitiveHelper new MaskSensitiveHelper to be used.
+ */
+ public void setSensitiveDataHelper(MaskSensitiveHelper
maskSensitiveHelper) {
+ delegate.setSensitiveDataHelper(maskSensitiveHelper);
+ }
+
public static class Portable implements AbstractPortableFeature {
private LoggingInInterceptor in;
private LoggingOutInterceptor out;
@@ -303,5 +312,10 @@ public class LoggingFeature extends
DelegatingFeature<LoggingFeature.Portable> {
in.addSensitiveProtocolHeaderNames(sensitiveProtocolHeaderNames);
out.addSensitiveProtocolHeaderNames(sensitiveProtocolHeaderNames);
}
+
+ public void setSensitiveDataHelper(MaskSensitiveHelper
maskSensitiveHelper) {
+ in.setSensitiveDataHelper(maskSensitiveHelper);
+ out.setSensitiveDataHelper(maskSensitiveHelper);
+ }
}
}