Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Open Subsurface Data Universe Software
Platform
System
Notification
Commits
62e7a156
Commit
62e7a156
authored
Aug 21, 2020
by
ethiraj krishnamanaidu
Browse files
Merge branch 'provider-interfaces' into 'master'
refactor provider interfaces See merge request
!11
parents
f962c2ad
698aae6d
Pipeline
#6328
passed with stages
in 14 minutes and 5 seconds
Changes
19
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitlab/merge_request_templates/default.md
0 → 100644
View file @
62e7a156
## Type of change
-
[ ] Bug Fix
-
[ ] Feature
**Please provide link to gitlab issue or ADR(Architecture Decision Record)**
## Does this introduce a change in the core logic?
-
[YES/NO]
## Does this introduce a change in the cloud provider implementation, if so which cloud?
-
[ ] AWS
-
[ ] Azure
-
[ ] GCP
-
[ ] IBM
## Does this introduce a breaking change?
-
[YES/NO]
## What is the current behavior?
## What is the new/expected behavior?
## Have you added/updated Unit Tests and Integration Tests?
## Any other useful information
notification-core/src/main/java/org/opengroup/osdu/notification/api/PubsubEndpoint.java
View file @
62e7a156
...
...
@@ -36,7 +36,7 @@ import org.opengroup.osdu.core.common.notification.SubscriptionException;
import
org.opengroup.osdu.notification.di.SubscriptionCacheFactory
;
import
org.opengroup.osdu.notification.pubsub.PubsubRequestBodyExtractor
;
import
org.opengroup.osdu.notification.utils.Config
;
import
org.opengroup.osdu.notification.
util
s.IGoogleServiceAccount
;
import
org.opengroup.osdu.notification.
provider.interface
s.IGoogleServiceAccount
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.security.access.prepost.PreAuthorize
;
...
...
notification-core/src/main/java/org/opengroup/osdu/notification/auth/AuthorizationFilter.java
View file @
62e7a156
...
...
@@ -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.
util
s.ServiceAccountValidator
;
import
org.opengroup.osdu.notification.
provider.interface
s.
I
ServiceAccountValidator
;
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
I
ServiceAccountValidator
validator
;
public
boolean
hasAnyPermission
(
String
...
requiredRoles
)
{
DpsHeaders
dpsHeaders
=
requestInfoExt
.
getHeaders
();
...
...
notification-core/src/main/java/org/opengroup/osdu/notification/auth/EntitlementsClientFactory.java
View file @
62e7a156
...
...
@@ -19,7 +19,7 @@ package org.opengroup.osdu.notification.auth;
import
org.opengroup.osdu.core.common.entitlements.EntitlementsAPIConfig
;
import
org.opengroup.osdu.core.common.entitlements.EntitlementsFactory
;
import
org.opengroup.osdu.core.common.entitlements.IEntitlementsFactory
;
import
org.opengroup.osdu.notification.
util
s.IAppProperties
;
import
org.opengroup.osdu.notification.
provider.interface
s.IAppProperties
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.config.AbstractFactoryBean
;
import
org.springframework.stereotype.Component
;
...
...
notification-core/src/main/java/org/opengroup/osdu/notification/di/CredentialHeadersProvider.java
View file @
62e7a156
...
...
@@ -18,7 +18,6 @@ package org.opengroup.osdu.notification.di;
import
org.opengroup.osdu.core.common.model.http.DpsHeaders
;
import
org.opengroup.osdu.core.common.util.IServiceAccountJwtClient
;
import
org.opengroup.osdu.notification.pubsub.PubsubRequestBodyExtractor
;
import
org.opengroup.osdu.notification.utils.IAppProperties
;
import
org.springframework.beans.factory.FactoryBean
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Primary
;
...
...
notification-core/src/main/java/org/opengroup/osdu/notification/di/SubscriptionClientFactory.java
View file @
62e7a156
...
...
@@ -16,17 +16,13 @@
package
org.opengroup.osdu.notification.di
;
import
org.opengroup.osdu.core.common.notification.ISubscriptionFactory
;
import
org.opengroup.osdu.core.common.notification.SubscriptionAPIConfig
;
import
org.opengroup.osdu.core.common.notification.SubscriptionFactory
;
import
org.opengroup.osdu.notification.
util
s.IAppProperties
;
import
org.opengroup.osdu.notification.
provider.interface
s.IAppProperties
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.config.AbstractFactoryBean
;
import
org.springframework.beans.factory.config.ConfigurableBeanFactory
;
import
org.springframework.context.annotation.Scope
;
import
org.springframework.stereotype.Component
;
import
org.opengroup.osdu.core.common.notification.ISubscriptionFactory
;
import
org.opengroup.osdu.core.common.model.notification.*
;
@Component
public
class
SubscriptionClientFactory
extends
AbstractFactoryBean
<
ISubscriptionFactory
>
{
...
...
notification-core/src/main/java/org/opengroup/osdu/notification/
auth/AuthorizationService
.java
→
notification-core/src/main/java/org/opengroup/osdu/notification/
provider/interfaces/IAppProperties
.java
View file @
62e7a156
...
...
@@ -14,10 +14,11 @@
* limitations under the License.
*/
package
org.opengroup.osdu.notification.
auth
;
package
org.opengroup.osdu.notification.
provider.interfaces
;
import
org.opengroup.osdu.core.common.model.http.DpsHeaders
;
public
interface
IAppProperties
{
public
interface
AuthorizationService
{
String
authorizeAny
(
DpsHeaders
headers
,
String
...
roles
);
}
String
getAuthorizeAPI
();
String
getRegisterAPI
();
}
\ No newline at end of file
notification-core/src/main/java/org/opengroup/osdu/notification/
util
s/IGoogleServiceAccount.java
→
notification-core/src/main/java/org/opengroup/osdu/notification/
provider/interface
s/IGoogleServiceAccount.java
View file @
62e7a156
...
...
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package
org.opengroup.osdu.notification.
util
s
;
package
org.opengroup.osdu.notification.
provider.interface
s
;
public
interface
IGoogleServiceAccount
{
...
...
notification-core/src/main/java/org/opengroup/osdu/notification/
util
s/ServiceAccountValidator.java
→
notification-core/src/main/java/org/opengroup/osdu/notification/
provider/interface
s/
I
ServiceAccountValidator.java
View file @
62e7a156
...
...
@@ -14,9 +14,10 @@
* limitations under the License.
*/
package
org.opengroup.osdu.notification.utils
;
package
org.opengroup.osdu.notification.provider.interfaces
;
public
interface
IServiceAccountValidator
{
public
interface
ServiceAccountValidator
{
boolean
isValidPublisherServiceAccount
(
String
jwt
);
boolean
isValidServiceAccount
(
String
jwt
,
String
userIdentity
,
String
...
audiences
);
...
...
notification-core/src/main/java/org/opengroup/osdu/notification/utils/IAppProperties.java
deleted
100644 → 0
View file @
f962c2ad
package
org.opengroup.osdu.notification.utils
;
public
interface
IAppProperties
{
String
getAuthorizeAPI
();
String
getRegisterAPI
();
}
\ No newline at end of file
notification-core/src/test/java/org/opengroup/osdu/notification/api/PubsubEndpointTests.java
View file @
62e7a156
...
...
@@ -37,7 +37,7 @@ import org.opengroup.osdu.core.common.notification.SubscriptionService;
import
org.opengroup.osdu.notification.di.CredentialHeadersProvider
;
import
org.opengroup.osdu.notification.di.SubscriptionCacheFactory
;
import
org.opengroup.osdu.notification.pubsub.PubsubRequestBodyExtractor
;
import
org.opengroup.osdu.notification.
util
s.IGoogleServiceAccount
;
import
org.opengroup.osdu.notification.
provider.interface
s.IGoogleServiceAccount
;
import
org.powermock.modules.junit4.PowerMockRunner
;
import
org.springframework.http.ResponseEntity
;
...
...
notification-core/src/test/java/org/opengroup/osdu/notification/auth/AuthorizationFilterTest.java
View file @
62e7a156
...
...
@@ -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.
util
s.ServiceAccountValidator
;
import
org.opengroup.osdu.notification.
provider.interface
s.
I
ServiceAccountValidator
;
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
I
ServiceAccountValidator
validator
;
@Mock
private
PubsubRequestBodyExtractor
extractor
;
@InjectMocks
...
...
notification-core/src/test/java/org/opengroup/osdu/notification/di/RequestInfoTest.java
View file @
62e7a156
...
...
@@ -20,7 +20,7 @@ import org.junit.Before;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.mockito.Mock
;
import
org.opengroup.osdu.notification.
util
s.IAppProperties
;
import
org.opengroup.osdu.notification.
provider.interface
s.IAppProperties
;
import
org.powermock.modules.junit4.PowerMockRunner
;
import
javax.servlet.http.HttpServletRequest
;
...
...
provider/notification-azure/src/main/java/org/opengroup/osdu/notification/provider/azure/util/AppProperties.java
View file @
62e7a156
...
...
@@ -19,7 +19,7 @@ import com.azure.cosmos.CosmosClient;
import
com.azure.security.keyvault.secrets.SecretClient
;
import
com.azure.security.keyvault.secrets.models.KeyVaultSecret
;
import
org.opengroup.osdu.azure.KeyVaultFacade
;
import
org.opengroup.osdu.notification.
util
s.IAppProperties
;
import
org.opengroup.osdu.notification.
provider.interface
s.IAppProperties
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
...
...
provider/notification-azure/src/main/java/org/opengroup/osdu/notification/provider/azure/util/AzureServiceAccountValidatorImpl.java
View file @
62e7a156
...
...
@@ -14,11 +14,11 @@
package
org.opengroup.osdu.notification.provider.azure.util
;
import
org.opengroup.osdu.notification.
util
s.ServiceAccountValidator
;
import
org.opengroup.osdu.notification.
provider.interface
s.
I
ServiceAccountValidator
;
import
org.springframework.stereotype.Component
;
@Component
public
class
AzureServiceAccountValidatorImpl
implements
ServiceAccountValidator
{
public
class
AzureServiceAccountValidatorImpl
implements
I
ServiceAccountValidator
{
@Override
public
boolean
isValidPublisherServiceAccount
(
String
jwt
)
{
...
...
provider/notification-azure/src/main/java/org/opengroup/osdu/notification/provider/azure/util/GoogleServiceAccountImpl.java
View file @
62e7a156
...
...
@@ -15,7 +15,7 @@
package
org.opengroup.osdu.notification.provider.azure.util
;
import
lombok.SneakyThrows
;
import
org.opengroup.osdu.notification.
util
s.IGoogleServiceAccount
;
import
org.opengroup.osdu.notification.
provider.interface
s.IGoogleServiceAccount
;
import
org.springframework.stereotype.Component
;
import
javax.naming.AuthenticationNotSupportedException
;
...
...
provider/notification-gcp/src/main/java/org/opengroup/osdu/notification/provider/gcp/util/AppProperties.java
View file @
62e7a156
...
...
@@ -16,7 +16,7 @@
package
org.opengroup.osdu.notification.provider.gcp.util
;
import
org.opengroup.osdu.notification.
util
s.IAppProperties
;
import
org.opengroup.osdu.notification.
provider.interface
s.IAppProperties
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
...
...
provider/notification-gcp/src/main/java/org/opengroup/osdu/notification/provider/gcp/util/GoogleServiceAccountImpl.java
View file @
62e7a156
...
...
@@ -19,7 +19,7 @@ package org.opengroup.osdu.notification.provider.gcp.util;
import
lombok.SneakyThrows
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.opengroup.osdu.core.gcp.GoogleIdToken.IGoogleIdTokenFactory
;
import
org.opengroup.osdu.notification.
util
s.IGoogleServiceAccount
;
import
org.opengroup.osdu.notification.
provider.interface
s.IGoogleServiceAccount
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
...
...
provider/notification-gcp/src/main/java/org/opengroup/osdu/notification/provider/gcp/util/GoogleServiceAccountValidatorImpl.java
View file @
62e7a156
...
...
@@ -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.
util
s.ServiceAccountValidator
;
import
org.opengroup.osdu.notification.
provider.interface
s.
I
ServiceAccountValidator
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
@Service
public
class
GoogleServiceAccountValidatorImpl
implements
ServiceAccountValidator
{
public
class
GoogleServiceAccountValidatorImpl
implements
I
ServiceAccountValidator
{
private
final
NetHttpTransport
netHttpTransport
=
new
NetHttpTransport
();
private
final
JacksonFactory
jacksonFactory
=
new
JacksonFactory
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment