public SocketCollectOperationContext() { this(HttpObfuscator.getInstance()); CollectionSettingsRegistry registry = CollectionSettingsRegistry.getInstance(); registry.addListener(this); registry.register(OBSCURED_ADDRESSES_PATTERN_SETTING, NO_PATTERN_VALUE); }
boolean updateObscuredHeaderValue(String name, String value) { if (!obfuscator.processHeader(name, value)) { return false; } ObscuredValueMarker curMarker = getObscuredValueMarker(); ObscuredValueMarker httpMarker = obfuscator.getSensitiveValueMarker(); /* * Check if substituted the marker (e.g., for addresses obscuring). * If so, then inform the substituted marker as well of the * obscured header value */ if (curMarker != httpMarker) { curMarker.markObscured(value); } return true; }
public void incrementalUpdate(CollectionSettingName name, Serializable value) { if (OBSCURED_ADDRESSES_PATTERN_SETTING.equals(name)) { Logger LOG = Logger.getLogger(getClass().getName()); String curValue = (obscuredAddressesPattern == null) ? NO_PATTERN_VALUE : obscuredAddressesPattern.pattern(); String newValue = StringUtil.safeToString(value); if (StringUtil.safeCompare(curValue, newValue) != 0) { Pattern newPattern = (StringUtil.isEmpty(newValue) || NO_PATTERN_VALUE.equalsIgnoreCase(newValue)) ? null : CollectionSettingsRegistry.getPatternSettingValue(value); LOG.info("incrementalUpdate(" + name + "): " + curValue + " => " + newValue); obscuredAddressesPattern = newPattern; } } else if (HttpObfuscator.OBFUSCATED_HEADERS_SETTING.equals(name)) { obfuscator.incrementalUpdate(name, value); // make sure change is propagated } }
SocketCollectOperationContext(HttpObfuscator hdrsObfuscator) { obfuscator = hdrsObfuscator; obscuredMarker = hdrsObfuscator.getSensitiveValueMarker(); }