Package org.apache.pinot.spi.utils
Class Obfuscator
- java.lang.Object
-
- org.apache.pinot.spi.utils.Obfuscator
-
public final class Obfuscator extends Object
Simple obfuscator for object trees and configuration containers with key-value pairs. Matches a configurable set of patterns and replaces sensitive values with a pre-defined masked value for output. Example input:{ "type": "sample object", "nestedCredentials": { "user": "admin", "password": "verysecret" } }Example output{ "type": "sample object", "nestedCredentials": { "user": "admin", "password": "*****" } }
-
-
Constructor Summary
Constructors Constructor Description Obfuscator()Obfuscator with default behavior matching (ignore case) "secret", "password", and "token" suffixes.Obfuscator(String maskedValue, List<Pattern> patterns)Obfuscator with customized masking behavior.
-
Method Summary
Modifier and Type Method Description com.fasterxml.jackson.databind.JsonNodetoJson(Object object)Serialize an object tree to JSON and obfuscate matching keys.StringtoJsonString(Object object)Serialize an object tree to a JSON string and obfuscate matching keys.
-
-
-
Method Detail
-
toJson
public com.fasterxml.jackson.databind.JsonNode toJson(Object object)
Serialize an object tree to JSON and obfuscate matching keys. This method handles special cases for JsonNode and String objects separately to minimize surprises.- Parameters:
object- input tree- Returns:
- obfuscated JSON tree
-
-