diff options
author | 2018-01-08 18:43:56 -0500 | |
---|---|---|
committer | 2018-01-09 10:18:42 -0500 | |
commit | 10ad7fc35b93f0d74052c76fef724f8494acb7ba (patch) | |
tree | 8443504c64b448a80d471bd8050f1cabdfb06592 /src/main/java/org/onap/crud/util | |
parent | eabf0a08faa6581c88c2e4ca5be56d4630891046 (diff) |
Validate the FromAppID when populating SOT props
Rejecting request when FromAppID is not set
Issue-ID: AAI-482
Change-Id: I34862ed17146dc8bf3ecaa13afd9a76a20c9476c
Signed-off-by: Gurjeet Bedi <gurjeetb@amdocs.com>
Diffstat (limited to 'src/main/java/org/onap/crud/util')
-rw-r--r-- | src/main/java/org/onap/crud/util/CrudServiceUtil.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/main/java/org/onap/crud/util/CrudServiceUtil.java b/src/main/java/org/onap/crud/util/CrudServiceUtil.java index 45f2414..345a1cf 100644 --- a/src/main/java/org/onap/crud/util/CrudServiceUtil.java +++ b/src/main/java/org/onap/crud/util/CrudServiceUtil.java @@ -84,10 +84,14 @@ public class CrudServiceUtil { RelationshipSchemaLoader.loadModels(); } + /** + * This method will merge header property from app id in request payload if not already populated + * @param propertiesFromRequest + * @param headers + * @param isAdd + * @return + */ public static JsonElement mergeHeaderInFoToPayload(JsonElement propertiesFromRequest, HttpHeaders headers, boolean isAdd) { - if(!headers.getRequestHeaders().containsKey("X-FromAppId")) - return propertiesFromRequest; - String sourceOfTruth = headers.getRequestHeaders().getFirst("X-FromAppId"); Set<Map.Entry<String, JsonElement>> properties = new HashSet<Map.Entry<String, JsonElement>>(); properties.addAll(propertiesFromRequest.getAsJsonObject().entrySet()); @@ -124,5 +128,4 @@ public class CrudServiceUtil { return gson.fromJson(sb.toString(), JsonElement.class); } - } |