|
|
@@ -62,15 +62,18 @@ public class RequestProtectorAppConfigDriver extends AppConfigDriverBase { |
|
|
|
|
|
|
|
private Set<HeaderReplacement> addHeaderReplacement(Account account, BubbleApp app, JsonNode data) { |
|
|
|
final JsonNode regexNode = data.get(PARAM_REGEX); |
|
|
|
if (regexNode == null || regexNode.textValue() == null || empty(regexNode.textValue().trim())) { |
|
|
|
if (regexNode == null || regexNode.textValue() == null) { |
|
|
|
throw invalidEx("err.requestProtector.headerRegexRequired"); |
|
|
|
} |
|
|
|
final String regex = regexNode.textValue().trim().toLowerCase(); |
|
|
|
final String regex = regexNode.textValue().trim(); |
|
|
|
if (empty(regex)) throw invalidEx("err.requestProtector.headerRegexRequired"); |
|
|
|
|
|
|
|
final JsonNode replacementNode = data.get(PARAM_REPLACEMENT); |
|
|
|
final String replacement = replacementNode == null || replacementNode.textValue() == null |
|
|
|
? "" |
|
|
|
: replacementNode.textValue().trim().toLowerCase(); |
|
|
|
if (replacementNode == null || replacementNode.textValue() == null) { |
|
|
|
throw invalidEx("err.requestProtector.headerReplacementRequired"); |
|
|
|
} |
|
|
|
final String replacement = regexNode.textValue().trim(); |
|
|
|
if (empty(replacement)) throw invalidEx("err.requestProtector.headerReplacementRequired"); |
|
|
|
|
|
|
|
final RequestProtectorConfig config = getConfig(account, app).addHeaderReplacement(regex, replacement); |
|
|
|
|
|
|
|