Commit e1201e1a authored by Rustam Lotsmanenko (EPAM)'s avatar Rustam Lotsmanenko (EPAM)
Browse files

update core-lib-gcp, refactoring

parent 0f277a49
Pipeline #63841 failed with stages
in 27 seconds
......@@ -28,12 +28,7 @@
<dependency>
<groupId>org.opengroup.osdu</groupId>
<artifactId>core-lib-gcp</artifactId>
<version>0.11.0</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-core</artifactId>
<version>1.38.1</version>
<version>0.12.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
......
......@@ -17,7 +17,6 @@
package org.opengroup.osdu.wks;
import org.opengroup.osdu.core.gcp.di.PartitionTenantInfoFactoryBean;
import org.opengroup.osdu.core.gcp.multitenancy.StorageFactory;
import org.opengroup.osdu.core.gcp.multitenancy.TenantFactory;
import org.springframework.boot.SpringApplication;
......@@ -29,8 +28,7 @@ import org.springframework.context.annotation.FilterType;
@ComponentScan(value = {
"org.opengroup.osdu"
}, excludeFilters = {
@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = {
PartitionTenantInfoFactoryBean.class, WksServiceApplication.class, TenantFactory.class, StorageFactory.class})})
@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = {WksServiceApplication.class, TenantFactory.class, StorageFactory.class})})
public class WksServiceApplicationGcp {
public static void main(String[] args) {
......
/*
* Copyright 2021 Google LLC
* Copyright 2021 EPAM Systems, Inc
*
* 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
*
* https://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.wks.config;
import lombok.RequiredArgsConstructor;
import org.opengroup.osdu.core.common.model.http.DpsHeaders;
import org.opengroup.osdu.core.common.multitenancy.PartitionTenantInfoFactory;
import org.opengroup.osdu.core.common.partition.IPartitionFactory;
import org.opengroup.osdu.core.common.partition.IPartitionProvider;
import org.opengroup.osdu.core.common.provider.interfaces.ITenantFactory;
import org.opengroup.osdu.core.gcp.GoogleIdToken.GcpServiceAccountJwtClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
@RequiredArgsConstructor
public class TenantFactoryConfiguration {
private final IPartitionFactory partitionFactory;
private final GcpServiceAccountJwtClient jwtClient;
@Bean
public ITenantFactory getTenantInfoFactory() {
DpsHeaders dpsHeaders = new DpsHeaders();
dpsHeaders.put(DpsHeaders.AUTHORIZATION, jwtClient.getIdToken(null));
IPartitionProvider iPartitionProvider = partitionFactory.create(dpsHeaders);
return PartitionTenantInfoFactory.builder()
.partitionProvider(iPartitionProvider)
.build();
}
}
......@@ -22,3 +22,4 @@ osdu.host.search-service-url=${SEARCH_API}
osdu.host.storage-service-url=${STORAGE_API}
osdu.host.schema-service-url=${SCHEMA_API}
GOOGLE_AUDIENCES=${WKS_GCP_AUDIENCES}
LOG_PREFIX=wks-service
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment