Added a check for OAuth2 client, VC, and group name length.
Change-Id: I716854dd0f93c4cda80304c4c6cf34fc35e890ea
diff --git a/core/Changes b/core/Changes
index 023b7f9..32a842b 100644
--- a/core/Changes
+++ b/core/Changes
@@ -2,6 +2,8 @@
13/11/2019
- Added warnings when requesting non-public fields via the search API with
accessRewriteDisabled (margaretha, resolved #43).
+14/11/2019
+ - Added a check for OAuth2 client, VC, and group name length (margaretha)
# version 0.62.1
08/07/2019
diff --git a/core/src/main/java/de/ids_mannheim/korap/utils/ParameterChecker.java b/core/src/main/java/de/ids_mannheim/korap/utils/ParameterChecker.java
index b4cf3cf..2673c80 100644
--- a/core/src/main/java/de/ids_mannheim/korap/utils/ParameterChecker.java
+++ b/core/src/main/java/de/ids_mannheim/korap/utils/ParameterChecker.java
@@ -46,4 +46,16 @@
name + " is missing", name);
}
}
+
+ public static void checkNameValue (String value, String name)
+ throws KustvaktException {
+ if (value == null) {
+ throw new KustvaktException(StatusCodes.INVALID_ARGUMENT,
+ name + " is null", name);
+ }
+ else if (value.length() < 3) {
+ throw new KustvaktException(StatusCodes.INVALID_ARGUMENT,
+ name+" must contain at least 3 characters", name);
+ }
+ }
}