diff --git a/build.gradle b/build.gradle index 9233b01815..88f24b873d 100644 --- a/build.gradle +++ b/build.gradle @@ -27,6 +27,7 @@ buildscript { common_utils_version = System.getProperty("common_utils.version", '3.0.0.0-SNAPSHOT') kafka_version = '3.5.0' apache_cxf_version = '4.0.2' + jjwt_version = '0.11.5' if (buildVersionQualifier) { opensearch_build += "-${buildVersionQualifier}" @@ -481,10 +482,26 @@ dependencies { implementation 'commons-cli:commons-cli:1.5.0' implementation "org.bouncycastle:bcprov-jdk15to18:${versions.bouncycastle}" implementation 'org.ldaptive:ldaptive:1.2.3' - implementation 'io.jsonwebtoken:jjwt-api:0.10.8' - implementation 'com.github.wnameless:json-flattener:0.5.0' - implementation 'com.flipkart.zjsonpatch:zjsonpatch:0.4.4' + //JWT + implementation "io.jsonwebtoken:jjwt-api:${jjwt_version}" + implementation "io.jsonwebtoken:jjwt-impl:${jjwt_version}" + implementation "io.jsonwebtoken:jjwt-jackson:${jjwt_version}" + // JSON flattener + implementation ("com.github.wnameless.json:json-base:2.4.0") { + exclude group: "org.glassfish", module: "jakarta.json" + exclude group: "com.google.code.gson", module: "gson" + exclude group: "org.json", module: "json" + } + implementation 'com.github.wnameless.json:json-flattener:0.16.4' + // JSON patch + implementation 'com.flipkart.zjsonpatch:zjsonpatch:0.4.14' + implementation 'org.apache.commons:commons-collections4:4.4' + + //JSON path + implementation 'com.jayway.jsonpath:json-path:2.8.0' + implementation 'net.minidev:json-smart:2.4.11' + implementation "org.apache.kafka:kafka-clients:${kafka_version}" implementation 'com.onelogin:java-saml:2.5.0' implementation 'com.onelogin:java-saml-core:2.5.0' @@ -527,10 +544,6 @@ dependencies { runtimeOnly 'org.opensaml:opensaml-soap-impl:3.4.5' implementation 'org.opensaml:opensaml-storage-api:3.4.5' implementation 'commons-collections:commons-collections:3.2.2' - implementation 'com.jayway.jsonpath:json-path:2.4.0' - implementation 'net.minidev:json-smart:2.4.10' - runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.10.8' - runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.10.8' runtimeOnly 'com.google.guava:failureaccess:1.0.1' runtimeOnly 'org.apache.commons:commons-text:1.10.0' runtimeOnly 'org.glassfish.jaxb:jaxb-runtime:2.3.4' diff --git a/src/main/java/org/opensearch/security/compliance/FieldReadCallback.java b/src/main/java/org/opensearch/security/compliance/FieldReadCallback.java index 73f536c2f8..5fc1c73128 100644 --- a/src/main/java/org/opensearch/security/compliance/FieldReadCallback.java +++ b/src/main/java/org/opensearch/security/compliance/FieldReadCallback.java @@ -105,7 +105,7 @@ public void binaryFieldRead(final FieldInfo fieldInfo, byte[] fieldValue) { fieldValue = Utils.jsonMapToByteArray(filteredSource); } - Map filteredSource = new JsonFlattener(new String(fieldValue, StandardCharsets.UTF_8)).flattenAsMap(); + final Map filteredSource = JsonFlattener.flattenAsMap(new String(fieldValue, StandardCharsets.UTF_8)); for (String k : filteredSource.keySet()) { if (!recordField(k, filteredSource.get(k) instanceof String)) { continue;