Class JsonMaskingConfig

java.lang.Object
dev.blaauwendraad.masker.json.config.JsonMaskingConfig

public class JsonMaskingConfig extends Object
Contains the JSON masker configurations.
  • Method Details

    • getDefault

      public static JsonMaskingConfig getDefault(Set<String> targets)
    • custom

      public static JsonMaskingConfig.Builder custom(Set<String> targets, JsonMaskingConfig.TargetKeyMode targetKeyMode)
      Creates a new JsonMaskingConfig builder instance.
      Parameters:
      targets - target keys of JSONPaths
      targetKeyMode - how to interpret the targets set
      Returns:
      the JsonMaskingConfig builder instance
    • getAlgorithmType

      public JsonMaskerAlgorithmType 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

      public JsonMaskingConfig.TargetKeyMode getTargetKeyMode()
    • getTargetKeys

      public Set<String> 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

      public String toString()
      Overrides:
      toString in class Object