From 604601878710341399d655ad1212392121c98994 Mon Sep 17 00:00:00 2001 From: Neelesh Thakur <NThakur4@slb.com> Date: Thu, 13 Aug 2020 13:56:42 -0500 Subject: [PATCH] comments --- .../notification/auth/AuthorizationFilter.java | 4 ++-- .../provider/interfaces/IAppProperties.java | 16 ++++++++++++++++ ...idator.java => IServiceAccountValidator.java} | 2 +- .../auth/AuthorizationFilterTest.java | 4 ++-- .../util/GoogleServiceAccountValidatorImpl.java | 4 ++-- 5 files changed, 23 insertions(+), 7 deletions(-) rename notification-core/src/main/java/org/opengroup/osdu/notification/provider/interfaces/{ServiceAccountValidator.java => IServiceAccountValidator.java} (94%) diff --git a/notification-core/src/main/java/org/opengroup/osdu/notification/auth/AuthorizationFilter.java b/notification-core/src/main/java/org/opengroup/osdu/notification/auth/AuthorizationFilter.java index e646b8779..36bfc8039 100644 --- a/notification-core/src/main/java/org/opengroup/osdu/notification/auth/AuthorizationFilter.java +++ b/notification-core/src/main/java/org/opengroup/osdu/notification/auth/AuthorizationFilter.java @@ -23,7 +23,7 @@ import org.opengroup.osdu.core.common.model.http.DpsHeaders; import org.opengroup.osdu.core.common.provider.interfaces.IAuthorizationService; import org.opengroup.osdu.notification.di.RequestInfoExt; import org.opengroup.osdu.notification.utils.Config; -import org.opengroup.osdu.notification.provider.interfaces.ServiceAccountValidator; +import org.opengroup.osdu.notification.provider.interfaces.IServiceAccountValidator; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.web.context.annotation.RequestScope; @@ -40,7 +40,7 @@ public class AuthorizationFilter { @Autowired private RequestInfoExt requestInfoExt; @Autowired - private ServiceAccountValidator validator; + private IServiceAccountValidator validator; public boolean hasAnyPermission(String... requiredRoles) { DpsHeaders dpsHeaders = requestInfoExt.getHeaders(); diff --git a/notification-core/src/main/java/org/opengroup/osdu/notification/provider/interfaces/IAppProperties.java b/notification-core/src/main/java/org/opengroup/osdu/notification/provider/interfaces/IAppProperties.java index 188ca8c28..c5bf01120 100644 --- a/notification-core/src/main/java/org/opengroup/osdu/notification/provider/interfaces/IAppProperties.java +++ b/notification-core/src/main/java/org/opengroup/osdu/notification/provider/interfaces/IAppProperties.java @@ -1,3 +1,19 @@ +/* + * Copyright 2017-2020, Schlumberger + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.opengroup.osdu.notification.provider.interfaces; public interface IAppProperties { diff --git a/notification-core/src/main/java/org/opengroup/osdu/notification/provider/interfaces/ServiceAccountValidator.java b/notification-core/src/main/java/org/opengroup/osdu/notification/provider/interfaces/IServiceAccountValidator.java similarity index 94% rename from notification-core/src/main/java/org/opengroup/osdu/notification/provider/interfaces/ServiceAccountValidator.java rename to notification-core/src/main/java/org/opengroup/osdu/notification/provider/interfaces/IServiceAccountValidator.java index fc3648987..3b36bb1de 100644 --- a/notification-core/src/main/java/org/opengroup/osdu/notification/provider/interfaces/ServiceAccountValidator.java +++ b/notification-core/src/main/java/org/opengroup/osdu/notification/provider/interfaces/IServiceAccountValidator.java @@ -16,7 +16,7 @@ package org.opengroup.osdu.notification.provider.interfaces; -public interface ServiceAccountValidator { +public interface IServiceAccountValidator { boolean isValidPublisherServiceAccount(String jwt); diff --git a/notification-core/src/test/java/org/opengroup/osdu/notification/auth/AuthorizationFilterTest.java b/notification-core/src/test/java/org/opengroup/osdu/notification/auth/AuthorizationFilterTest.java index 6becc37ed..50a46790c 100644 --- a/notification-core/src/test/java/org/opengroup/osdu/notification/auth/AuthorizationFilterTest.java +++ b/notification-core/src/test/java/org/opengroup/osdu/notification/auth/AuthorizationFilterTest.java @@ -28,7 +28,7 @@ import org.opengroup.osdu.core.common.provider.interfaces.IAuthorizationService; import org.opengroup.osdu.notification.di.RequestInfoExt; import org.opengroup.osdu.notification.pubsub.PubsubRequestBodyExtractor; import org.opengroup.osdu.notification.utils.Config; -import org.opengroup.osdu.notification.provider.interfaces.ServiceAccountValidator; +import org.opengroup.osdu.notification.provider.interfaces.IServiceAccountValidator; import org.powermock.modules.junit4.PowerMockRunner; import java.util.HashMap; @@ -57,7 +57,7 @@ public class AuthorizationFilterTest { @Mock private IAuthorizationService authorizationService; @Mock - private ServiceAccountValidator validator; + private IServiceAccountValidator validator; @Mock private PubsubRequestBodyExtractor extractor; @InjectMocks diff --git a/provider/notification-gcp/src/main/java/org/opengroup/osdu/notification/provider/gcp/util/GoogleServiceAccountValidatorImpl.java b/provider/notification-gcp/src/main/java/org/opengroup/osdu/notification/provider/gcp/util/GoogleServiceAccountValidatorImpl.java index eaac68d6c..3a1736a92 100644 --- a/provider/notification-gcp/src/main/java/org/opengroup/osdu/notification/provider/gcp/util/GoogleServiceAccountValidatorImpl.java +++ b/provider/notification-gcp/src/main/java/org/opengroup/osdu/notification/provider/gcp/util/GoogleServiceAccountValidatorImpl.java @@ -21,12 +21,12 @@ 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 org.opengroup.osdu.core.common.logging.JaxRsDpsLog; -import org.opengroup.osdu.notification.provider.interfaces.ServiceAccountValidator; +import org.opengroup.osdu.notification.provider.interfaces.IServiceAccountValidator; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service -public class GoogleServiceAccountValidatorImpl implements ServiceAccountValidator { +public class GoogleServiceAccountValidatorImpl implements IServiceAccountValidator { private final NetHttpTransport netHttpTransport = new NetHttpTransport(); private final JacksonFactory jacksonFactory = new JacksonFactory(); -- GitLab