Class JsonMaskingConfig
java.lang.Object
dev.blaauwendraad.masker.json.config.JsonMaskingConfig
Contains the JSON masker configurations.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Builder to createJsonMaskingConfig
instances using the builder pattern.static enum
Defines how target keys should be interpreted. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Tests if target keys should be considered case-sensitive.static JsonMaskingConfig.Builder
custom
(Set<String> targets, JsonMaskingConfig.TargetKeyMode targetKeyMode) Creates a newJsonMaskingConfig
builder instance.static JsonMaskingConfig
getDefault
(Set<String> targets) int
Which number to mask numeric JSON values with (e.g.int
Get the obfuscation length configuration value.boolean
Checks if the target key mode is set to "ALLOW".boolean
Checks if the target key mode is set to "MASK".boolean
Tests if length obfuscation is enabled.boolean
Tests if numeric JSON values are maskedtoString()
-
Method Details
-
getDefault
-
custom
public static JsonMaskingConfig.Builder custom(Set<String> targets, JsonMaskingConfig.TargetKeyMode targetKeyMode) Creates a newJsonMaskingConfig
builder instance.- Parameters:
targets
- target keys of JSONPathstargetKeyMode
- how to interpret the targets set- Returns:
- the
JsonMaskingConfig
builder 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
-