Class JsonMaskingConfig
java.lang.Object
dev.blaauwendraad.masker.json.config.JsonMaskingConfig
Contains the JSON masker configurations.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder to createJsonMaskingConfiginstances using the builder pattern.static enumDefines how target keys should be interpreted. -
Method Summary
Modifier and TypeMethodDescriptionbooleanTests if target keys should be considered case-sensitive.static JsonMaskingConfig.Buildercustom(Set<String> targets, JsonMaskingConfig.TargetKeyMode targetKeyMode) Creates a newJsonMaskingConfigbuilder instance.static JsonMaskingConfiggetDefault(Set<String> targets) intWhich number to mask numeric JSON values with (e.g.intGet the obfuscation length configuration value.booleanChecks if the target key mode is set to "ALLOW".booleanChecks if the target key mode is set to "MASK".booleanTests if length obfuscation is enabled.booleanTests if numeric JSON values are maskedtoString()
-
Method Details
-
getDefault
-
custom
public static JsonMaskingConfig.Builder custom(Set<String> targets, JsonMaskingConfig.TargetKeyMode targetKeyMode) Creates a newJsonMaskingConfigbuilder instance.- Parameters:
targets- target keys of JSONPathstargetKeyMode- how to interpret the targets set- Returns:
- the
JsonMaskingConfigbuilder instance
-
getAlgorithmType
-
getMaskNumericValuesWith
public int getMaskNumericValuesWith()Which number to mask numeric JSON values with (e.g. with value 8, the JSON property 1234 will be masked as 8888).- Returns:
- the number mask
-
isNumberMaskingEnabled
public boolean isNumberMaskingEnabled()Tests if numeric JSON values are masked- Returns:
- true if number masking is enabled and false otherwise.
-
getTargetKeyMode
-
getTargetKeys
-
getObfuscationLength
public int getObfuscationLength()Get the obfuscation length configuration value.- Returns:
- the length of the mask to use for all values to obfuscate the original value length, or -1 if length obfuscation is disabled.
-
isLengthObfuscationEnabled
public boolean isLengthObfuscationEnabled()Tests if length obfuscation is enabled.- Returns:
- true if length obfuscation is enabled and false otherwise
-
caseSensitiveTargetKeys
public boolean caseSensitiveTargetKeys()Tests if target keys should be considered case-sensitive.- Returns:
- true if target keys are considered case-sensitive and false otherwise.
-
isInAllowMode
public boolean isInAllowMode()Checks if the target key mode is set to "ALLOW". If the mode is set to "ALLOW", it means that the target keys are interpreted as the only JSON keys for which the corresponding property is allowed (should not be masked).- Returns:
- true if the target key mode is set to "ALLOW", false otherwise
-
isInMaskMode
public boolean isInMaskMode()Checks if the target key mode is set to "MASK". If the mode is set to "MASK", it means that the properties corresponding to the target keys should be masked.- Returns:
- true if the current target key mode is in "MASK" mode, false otherwise
-
toString
-