diff --git a/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/security/GoogleServiceAccountValidatorGenerator.java b/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/security/GoogleServiceAccountValidatorGenerator.java index 2192620af432a28f0e2cbfb99fc2ed19a192c883..6613775dcede4f8a33df0601995ccf944b20f86e 100644 --- a/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/security/GoogleServiceAccountValidatorGenerator.java +++ b/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/security/GoogleServiceAccountValidatorGenerator.java @@ -18,7 +18,7 @@ package org.opengroup.osdu.notification.provider.gcp.security; import com.google.api.client.googleapis.auth.oauth2.GoogleIdTokenVerifier; import com.google.api.client.http.javanet.NetHttpTransport; -import com.google.api.client.json.jackson2.JacksonFactory; +import com.google.api.client.json.gson.GsonFactory; import org.springframework.stereotype.Component; import java.util.Arrays; @@ -26,7 +26,7 @@ import java.util.Arrays; @Component public class GoogleServiceAccountValidatorGenerator { - public GoogleIdTokenVerifier getVerifier(NetHttpTransport transport, JacksonFactory factory, String... googleAudiences) { + public GoogleIdTokenVerifier getVerifier(NetHttpTransport transport, GsonFactory factory, String... googleAudiences) { GoogleIdTokenVerifier verifier; if (googleAudiences == null || googleAudiences.length == 0) { verifier = new GoogleIdTokenVerifier.Builder(transport, factory) diff --git a/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/security/GoogleServiceAccountValidatorImpl.java b/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/security/GoogleServiceAccountValidatorImpl.java index 367e18ed2919cc6c9a912cc02fcf40b498eea086..fe9152709b0ec0b64b8af5376253ce1f209374ed 100644 --- a/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/security/GoogleServiceAccountValidatorImpl.java +++ b/provider/notification-gc/src/main/java/org/opengroup/osdu/notification/provider/gcp/security/GoogleServiceAccountValidatorImpl.java @@ -19,7 +19,7 @@ package org.opengroup.osdu.notification.provider.gcp.security; import com.google.api.client.googleapis.auth.oauth2.GoogleIdToken; import com.google.api.client.googleapis.auth.oauth2.GoogleIdTokenVerifier; import com.google.api.client.http.javanet.NetHttpTransport; -import com.google.api.client.json.jackson2.JacksonFactory; +import com.google.api.client.json.gson.GsonFactory; import org.opengroup.osdu.core.common.logging.JaxRsDpsLog; import org.opengroup.osdu.notification.provider.gcp.config.AppProperties; import org.opengroup.osdu.notification.provider.interfaces.IServiceAccountValidator; @@ -30,7 +30,7 @@ import org.springframework.stereotype.Service; public class GoogleServiceAccountValidatorImpl implements IServiceAccountValidator { private final NetHttpTransport netHttpTransport = new NetHttpTransport(); - private final JacksonFactory jacksonFactory = new JacksonFactory(); + private final GsonFactory gsonFactory = new GsonFactory(); @Autowired private JaxRsDpsLog log; @@ -46,7 +46,7 @@ public class GoogleServiceAccountValidatorImpl implements IServiceAccountValidat @Override public boolean isValidServiceAccount(String jwt, String userIdentity, String... googleAudiences) { - GoogleIdTokenVerifier verifier = this.verifierGenerator.getVerifier(this.netHttpTransport, this.jacksonFactory, googleAudiences); + GoogleIdTokenVerifier verifier = this.verifierGenerator.getVerifier(this.netHttpTransport, this.gsonFactory, googleAudiences); try { GoogleIdToken idToken = verifier.verify(jwt); if (idToken != null) { diff --git a/provider/notification-gc/src/test/java/org/opengroup/osdu/notification/secutity/GoogleServiceAccountValidatorGeneratorTest.java b/provider/notification-gc/src/test/java/org/opengroup/osdu/notification/secutity/GoogleServiceAccountValidatorGeneratorTest.java index de09494a9e6e7a7c0af2f45cf34fc8d8ae15bc80..a3a9a54ece14c2338f25971594224fe84f71e4c4 100644 --- a/provider/notification-gc/src/test/java/org/opengroup/osdu/notification/secutity/GoogleServiceAccountValidatorGeneratorTest.java +++ b/provider/notification-gc/src/test/java/org/opengroup/osdu/notification/secutity/GoogleServiceAccountValidatorGeneratorTest.java @@ -18,7 +18,7 @@ package org.opengroup.osdu.notification.secutity; import com.google.api.client.googleapis.auth.oauth2.GoogleIdTokenVerifier; import com.google.api.client.http.javanet.NetHttpTransport; -import com.google.api.client.json.jackson2.JacksonFactory; +import com.google.api.client.json.gson.GsonFactory; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; @@ -31,7 +31,7 @@ import java.util.Collection; @RunWith(PowerMockRunner.class) public class GoogleServiceAccountValidatorGeneratorTest { private final NetHttpTransport netHttpTransport = new NetHttpTransport(); - private final JacksonFactory jacksonFactory = new JacksonFactory(); + private final GsonFactory gsonFactory = new GsonFactory(); private static final String AUDIENCE_1 = "aud1"; private static final String AUDIENCE_2 = "aud2"; @@ -40,15 +40,15 @@ public class GoogleServiceAccountValidatorGeneratorTest { @Test public void should_returnVerifierWithoutAudiences_when_noAudiencesProvided() { - GoogleIdTokenVerifier verifier = this.sut.getVerifier(netHttpTransport, jacksonFactory); + GoogleIdTokenVerifier verifier = this.sut.getVerifier(netHttpTransport, gsonFactory); Assert.assertNull(verifier.getAudience()); } @Test public void should_returnVerifierWithAudiences_when_AudiencesProvided() { - GoogleIdTokenVerifier verifier = this.sut.getVerifier(netHttpTransport, jacksonFactory, AUDIENCE_1, AUDIENCE_2); + GoogleIdTokenVerifier verifier = this.sut.getVerifier(netHttpTransport, gsonFactory, AUDIENCE_1, AUDIENCE_2); Collection<String> audiences = verifier.getAudience(); Assert.assertTrue(audiences.contains(AUDIENCE_1)); Assert.assertTrue(audiences.contains(AUDIENCE_2)); } -} +} \ No newline at end of file