diff --git a/provider/indexer-ibm/pom.xml b/provider/indexer-ibm/pom.xml index fa907326f3cd04c65cb8921f0b442527b949a6e6..65eda06219e8bc05fbaa591a860d5955c1926536 100644 --- a/provider/indexer-ibm/pom.xml +++ b/provider/indexer-ibm/pom.xml @@ -33,15 +33,7 @@ <description>Indexer Service IBM</description> <packaging>jar</packaging> - <properties> - <azure.version>2.1.7</azure.version> - <azure.appservice.resourcegroup></azure.appservice.resourcegroup> - <azure.appservice.plan></azure.appservice.plan> - <azure.appservice.appname></azure.appservice.appname> - <azure.appservice.subscription></azure.appservice.subscription> - </properties> - - <dependencies> + <dependencies> <!-- OSDU core service dependencies --> <dependency> @@ -81,10 +73,11 @@ <groupId>org.springframework.security</groupId> <artifactId>spring-security-oauth2-client</artifactId> </dependency> - <dependency> - <groupId>org.springframework.security</groupId> - <artifactId>spring-security-oauth2-jose</artifactId> - </dependency> + <dependency> + <groupId>org.springframework.data</groupId> + <artifactId>spring-data-commons</artifactId> + <version>2.2.0.RELEASE</version> + </dependency> <dependency> <groupId>org.elasticsearch</groupId> @@ -168,7 +161,7 @@ <configuration> <classifier>spring-boot</classifier> <mainClass> - org.opengroup.osdu.indexer.ibm.IndexerAzureApplication + org.opengroup.osdu.indexer.ibm.IndexerIBMApplication </mainClass> </configuration> </execution> diff --git a/provider/indexer-ibm/src/main/java/org/opengroup/osdu/indexer/ibm/IndexerIBMApplication.java b/provider/indexer-ibm/src/main/java/org/opengroup/osdu/indexer/ibm/IndexerIBMApplication.java index 9d00f3c4fe8c822a9f8c13b5ae38271cad36d9e4..28c6a70aaae1dd036d6b9e3ac601c9d15aa06be1 100644 --- a/provider/indexer-ibm/src/main/java/org/opengroup/osdu/indexer/ibm/IndexerIBMApplication.java +++ b/provider/indexer-ibm/src/main/java/org/opengroup/osdu/indexer/ibm/IndexerIBMApplication.java @@ -20,7 +20,7 @@ import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @SpringBootApplication -@ComponentScan({"org.opengroup.osdu.core.common", "org.opengroup.osdu.indexer"}) +@ComponentScan({"org.opengroup.osdu.core.common", "org.opengroup.osdu.core.ibm", "org.opengroup.osdu.indexer"}) public class IndexerIBMApplication { public static void main(String[] args) { diff --git a/provider/indexer-ibm/src/main/java/org/opengroup/osdu/indexer/ibm/api/AADController.java b/provider/indexer-ibm/src/main/java/org/opengroup/osdu/indexer/ibm/api/AADController.java index 9b4ed05b81c7b4a9c4f1e13d586c485f892745c8..a012ecc1acf83926039946e83c5697ba47e67242 100644 --- a/provider/indexer-ibm/src/main/java/org/opengroup/osdu/indexer/ibm/api/AADController.java +++ b/provider/indexer-ibm/src/main/java/org/opengroup/osdu/indexer/ibm/api/AADController.java @@ -1,42 +1,42 @@ -// Copyright 2019 IBM Corp. All Rights Reserved. -// -// 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.indexer.ibm.api; - -import org.opengroup.osdu.indexer.ibm.util.ServiceAccountJwtClientImpl; - -import org.springframework.http.*; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; - -import javax.inject.Inject; - -@Controller -public class AADController { - - @Inject - ServiceAccountJwtClientImpl service; - - - @RequestMapping("/obo_api") - @PostMapping - public ResponseEntity<String> callOboApi() throws Throwable { - - String token = service.getIdToken("common"); - - return new ResponseEntity<String>(token, HttpStatus.OK); - } -} - +//// Copyright 2019 IBM Corp. All Rights Reserved. +//// +//// 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.indexer.ibm.api; +// +//import org.opengroup.osdu.indexer.ibm.util.ServiceAccountJwtClientImpl; +// +//import org.springframework.http.*; +//import org.springframework.stereotype.Controller; +//import org.springframework.web.bind.annotation.PostMapping; +//import org.springframework.web.bind.annotation.RequestMapping; +// +//import javax.inject.Inject; +// +//@Controller +//public class AADController { +// +// @Inject +// ServiceAccountJwtClientImpl service; +// +// +// @RequestMapping("/obo_api") +// @PostMapping +// public ResponseEntity<String> callOboApi() throws Throwable { +// +// String token = service.getIdToken("common"); +// +// return new ResponseEntity<String>(token, HttpStatus.OK); +// } +//} +// diff --git a/provider/indexer-ibm/src/main/java/org/opengroup/osdu/indexer/ibm/persistence/ElasticSettingSchemaRepositoryImpl.java b/provider/indexer-ibm/src/main/java/org/opengroup/osdu/indexer/ibm/persistence/ElasticSettingSchemaRepositoryImpl.java index 77e58c696df6f25501596fccea28368555a31a2e..8640e8365f90dddd0fea2dd7c7e97806fee63479 100644 --- a/provider/indexer-ibm/src/main/java/org/opengroup/osdu/indexer/ibm/persistence/ElasticSettingSchemaRepositoryImpl.java +++ b/provider/indexer-ibm/src/main/java/org/opengroup/osdu/indexer/ibm/persistence/ElasticSettingSchemaRepositoryImpl.java @@ -14,16 +14,15 @@ package org.opengroup.osdu.indexer.ibm.persistence; -import java.net.MalformedURLException; - import javax.annotation.PostConstruct; +import javax.inject.Inject; -import org.opengroup.osdu.core.ibm.cloudant.IBMCloudantClientFactory; +import org.opengroup.osdu.core.ibm.cloudant.ICloudantFactory; import org.opengroup.osdu.indexer.ibm.model.ElasticSettingSchema; +import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; -import org.slf4j.Logger; + import com.cloudant.client.api.Database; @@ -32,15 +31,17 @@ public class ElasticSettingSchemaRepositoryImpl implements ISchemaRepository { private static final Logger logger = LoggerFactory.getLogger(ElasticSettingSchemaRepositoryImpl.class); - @Autowired - private IBMCloudantClientFactory cloudantFactory; + + @Inject + private ICloudantFactory cloudantFactory; + private Database db; @PostConstruct public void init(){ try { - db = cloudantFactory.getClient().database(ElasticSettingsDoc.DB_NAME, true); - } catch (MalformedURLException e) { + db = cloudantFactory.getDatabase(ElasticSettingsDoc.DB_NAME); + } catch (Exception e) { e.printStackTrace(); } } diff --git a/provider/indexer-ibm/src/main/java/org/opengroup/osdu/indexer/ibm/security/BasicAuthSecurityConfig.java b/provider/indexer-ibm/src/main/java/org/opengroup/osdu/indexer/ibm/security/BasicAuthSecurityConfig.java index 60678a6e3e1fdb98f36a4622ba35978a47e88b5b..3b368d69d5dd11987612af35659cc2f2edd6141f 100644 --- a/provider/indexer-ibm/src/main/java/org/opengroup/osdu/indexer/ibm/security/BasicAuthSecurityConfig.java +++ b/provider/indexer-ibm/src/main/java/org/opengroup/osdu/indexer/ibm/security/BasicAuthSecurityConfig.java @@ -1,50 +1,50 @@ -// Copyright 2019 IBM Corp. All Rights Reserved. +//// Copyright 2019 IBM Corp. All Rights Reserved. +//// +//// 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. // -// 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 +//package org.opengroup.osdu.indexer.ibm.security; // -// http://www.apache.org/licenses/LICENSE-2.0 +//import com.microsoft.azure.spring.autoconfigure.aad.AADAppRoleStatelessAuthenticationFilter; +//import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +//import org.springframework.security.config.annotation.web.builders.HttpSecurity; +//import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +//import org.springframework.security.config.http.SessionCreationPolicy; +//import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; // -// 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.indexer.ibm.security; - -import com.microsoft.azure.spring.autoconfigure.aad.AADAppRoleStatelessAuthenticationFilter; -import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; -import org.springframework.security.config.http.SessionCreationPolicy; -import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; - -import javax.inject.Inject; - -@EnableWebSecurity -@EnableGlobalMethodSecurity(prePostEnabled = true) -public class BasicAuthSecurityConfig extends WebSecurityConfigurerAdapter { - @Inject - private AADAppRoleStatelessAuthenticationFilter appRoleAuthFilter; - - @Override - protected void configure(HttpSecurity http) throws Exception { - http.csrf().disable().sessionManagement().sessionCreationPolicy(SessionCreationPolicy.NEVER) - .and() - .authorizeRequests() - .antMatchers("/", "/index.html","/obo_api", - "/index-worker", "/_dps/task-handlers", "/_dps/task-handlers/**", - "/reindex", - "/v2/api-docs", - "/swagger-resources/**", - "/configuration/security", - "/swagger", - "/swagger-ui.html", - "/webjars/**").permitAll() - .anyRequest().authenticated() - .and().addFilterBefore(appRoleAuthFilter, UsernamePasswordAuthenticationFilter.class); - } -} +//import javax.inject.Inject; +// +//@EnableWebSecurity +//@EnableGlobalMethodSecurity(prePostEnabled = true) +//public class BasicAuthSecurityConfig extends WebSecurityConfigurerAdapter { +// @Inject +// private AADAppRoleStatelessAuthenticationFilter appRoleAuthFilter; +// +// @Override +// protected void configure(HttpSecurity http) throws Exception { +// http.csrf().disable().sessionManagement().sessionCreationPolicy(SessionCreationPolicy.NEVER) +// .and() +// .authorizeRequests() +// .antMatchers("/", "/index.html","/obo_api", +// "/index-worker", "/_dps/task-handlers", "/_dps/task-handlers/**", +// "/reindex", +// "/v2/api-docs", +// "/swagger-resources/**", +// "/configuration/security", +// "/swagger", +// "/swagger-ui.html", +// "/webjars/**").permitAll() +// .anyRequest().authenticated() +// .and().addFilterBefore(appRoleAuthFilter, UsernamePasswordAuthenticationFilter.class); +// } +//} diff --git a/provider/indexer-ibm/src/main/java/org/opengroup/osdu/indexer/ibm/util/ServiceAccountJwtClientImpl.java b/provider/indexer-ibm/src/main/java/org/opengroup/osdu/indexer/ibm/util/ServiceAccountJwtClientImpl.java index 6ca3101dd4ae52350f465cf0b6dfd1a3e9f8bae2..ba7e3b1c80c680dfb2376e1ed5f2be4ebc49d950 100644 --- a/provider/indexer-ibm/src/main/java/org/opengroup/osdu/indexer/ibm/util/ServiceAccountJwtClientImpl.java +++ b/provider/indexer-ibm/src/main/java/org/opengroup/osdu/indexer/ibm/util/ServiceAccountJwtClientImpl.java @@ -1,119 +1,119 @@ -// Copyright 2019 IBM Corp. All Rights Reserved. -// -// 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.indexer.ibm.util; - -import com.auth0.jwt.JWT; -import com.auth0.jwt.exceptions.JWTDecodeException; -import com.microsoft.aad.adal4j.AuthenticationContext; -import com.microsoft.aad.adal4j.AuthenticationResult; -import com.microsoft.aad.adal4j.ClientCredential; -import org.apache.http.HttpStatus; -import org.opengroup.osdu.core.common.model.core.DpsHeaders; -import org.opengroup.osdu.core.common.model.core.ITenantFactory; -import org.opengroup.osdu.core.common.model.core.TenantInfo; -import org.opengroup.osdu.core.common.model.coreis.AppException; -import org.opengroup.osdu.core.common.service.coreis.JaxRsDpsLog; -import org.opengroup.osdu.indexer.ibm.model.AADConfiguration; - -import org.opengroup.osdu.core.common.model.coreis.IdToken; -import org.opengroup.osdu.core.common.spi.coreis.IJwtCache; -import org.opengroup.osdu.core.common.spi.coreis.IHeadersInfo; -import org.opengroup.osdu.core.common.spi.coreis.IServiceAccountJwtClient; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Component; -import org.springframework.web.context.annotation.RequestScope; - -import javax.inject.Inject; -import java.net.MalformedURLException; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; - -@Component -@RequestScope -public class ServiceAccountJwtClientImpl implements IServiceAccountJwtClient { - - @Inject - private ITenantFactory tenantInfoServiceProvider; - @Inject - private IHeadersInfo headersInfoAzure; - @Inject - @Qualifier("dpsHeaderFactorySearch") - private DpsHeaders dpsHeaders; - @Inject - private IJwtCache cacheService; - @Inject - private JaxRsDpsLog log; - - @Inject - private AADConfiguration configuration; - - public String getIdToken(String tenantName) { - this.log.info("Tenant name received for auth token is: " + tenantName); - TenantInfo tenant = this.tenantInfoServiceProvider.getTenantInfo(tenantName); - if (tenant == null) { - this.log.error("Invalid tenant name receiving from azure"); - throw new AppException(HttpStatus.SC_BAD_REQUEST, "Invalid tenant Name", "Invalid tenant Name from azure"); - } - String ACCESS_TOKEN = ""; - try { - - IdToken cachedToken = (IdToken) this.cacheService.get(tenant.getServiceAccount()); - this.headersInfoAzure.getHeaders().put(DpsHeaders.USER_EMAIL, tenant.getServiceAccount()); - this.dpsHeaders.put(DpsHeaders.USER_EMAIL, tenant.getServiceAccount()); - - if (!IdToken.refreshToken(cachedToken)) { - return cachedToken.getTokenValue(); - } - - ExecutorService service = Executors.newFixedThreadPool(1); - AuthenticationContext context = null; - - try { - context = new AuthenticationContext(configuration.getAuthority(), false, service); - ClientCredential credential = new ClientCredential(configuration.getClientId(), configuration.getSecretKey()); - Future<AuthenticationResult> future = context.acquireToken(configuration.getOboApi(), credential, null); - - ACCESS_TOKEN = future.get().getAccessToken(); - - if (future == null) { - log.error(String.format("Azure Authentication: %s", future.get().getAccessToken())); - throw new AppException(HttpStatus.SC_FORBIDDEN, "Access denied", "The user is not authorized to perform this action"); - } - IdToken idToken = IdToken.builder().tokenValue(ACCESS_TOKEN).expirationTimeMillis(JWT.decode(ACCESS_TOKEN).getExpiresAt().getTime()).build(); - - this.cacheService.put(tenant.getServiceAccount(), idToken); - - } catch (InterruptedException e) { - e.printStackTrace(); - } catch (ExecutionException e) { - e.printStackTrace(); - } catch (MalformedURLException e) { - e.printStackTrace(); - } finally { - service.shutdown(); - } - } catch (JWTDecodeException e) { - throw new AppException(HttpStatus.SC_INTERNAL_SERVER_ERROR, "Persistence error", "Invalid token, error decoding", e); - } catch (AppException e) { - throw e; - } catch (Exception e) { - throw new AppException(HttpStatus.SC_INTERNAL_SERVER_ERROR, "Persistence error", "Error generating token", e); - } - - return ACCESS_TOKEN; - } -} +//// Copyright 2019 IBM Corp. All Rights Reserved. +//// +//// 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.indexer.ibm.util; +// +//import com.auth0.jwt.JWT; +//import com.auth0.jwt.exceptions.JWTDecodeException; +//import com.microsoft.aad.adal4j.AuthenticationContext; +//import com.microsoft.aad.adal4j.AuthenticationResult; +//import com.microsoft.aad.adal4j.ClientCredential; +//import org.apache.http.HttpStatus; +//import org.opengroup.osdu.core.common.model.core.DpsHeaders; +//import org.opengroup.osdu.core.common.model.core.ITenantFactory; +//import org.opengroup.osdu.core.common.model.core.TenantInfo; +//import org.opengroup.osdu.core.common.model.coreis.AppException; +//import org.opengroup.osdu.core.common.service.coreis.JaxRsDpsLog; +//import org.opengroup.osdu.indexer.ibm.model.AADConfiguration; +// +//import org.opengroup.osdu.core.common.model.coreis.IdToken; +//import org.opengroup.osdu.core.common.spi.coreis.IJwtCache; +//import org.opengroup.osdu.core.common.spi.coreis.IHeadersInfo; +//import org.opengroup.osdu.core.common.spi.coreis.IServiceAccountJwtClient; +//import org.springframework.beans.factory.annotation.Qualifier; +//import org.springframework.stereotype.Component; +//import org.springframework.web.context.annotation.RequestScope; +// +//import javax.inject.Inject; +//import java.net.MalformedURLException; +//import java.util.concurrent.ExecutionException; +//import java.util.concurrent.ExecutorService; +//import java.util.concurrent.Executors; +//import java.util.concurrent.Future; +// +//@Component +//@RequestScope +//public class ServiceAccountJwtClientImpl implements IServiceAccountJwtClient { +// +// @Inject +// private ITenantFactory tenantInfoServiceProvider; +// @Inject +// private IHeadersInfo headersInfoAzure; +// @Inject +// @Qualifier("dpsHeaderFactorySearch") +// private DpsHeaders dpsHeaders; +// @Inject +// private IJwtCache cacheService; +// @Inject +// private JaxRsDpsLog log; +// +// @Inject +// private AADConfiguration configuration; +// +// public String getIdToken(String tenantName) { +// this.log.info("Tenant name received for auth token is: " + tenantName); +// TenantInfo tenant = this.tenantInfoServiceProvider.getTenantInfo(tenantName); +// if (tenant == null) { +// this.log.error("Invalid tenant name receiving from azure"); +// throw new AppException(HttpStatus.SC_BAD_REQUEST, "Invalid tenant Name", "Invalid tenant Name from azure"); +// } +// String ACCESS_TOKEN = ""; +// try { +// +// IdToken cachedToken = (IdToken) this.cacheService.get(tenant.getServiceAccount()); +// this.headersInfoAzure.getHeaders().put(DpsHeaders.USER_EMAIL, tenant.getServiceAccount()); +// this.dpsHeaders.put(DpsHeaders.USER_EMAIL, tenant.getServiceAccount()); +// +// if (!IdToken.refreshToken(cachedToken)) { +// return cachedToken.getTokenValue(); +// } +// +// ExecutorService service = Executors.newFixedThreadPool(1); +// AuthenticationContext context = null; +// +// try { +// context = new AuthenticationContext(configuration.getAuthority(), false, service); +// ClientCredential credential = new ClientCredential(configuration.getClientId(), configuration.getSecretKey()); +// Future<AuthenticationResult> future = context.acquireToken(configuration.getOboApi(), credential, null); +// +// ACCESS_TOKEN = future.get().getAccessToken(); +// +// if (future == null) { +// log.error(String.format("Azure Authentication: %s", future.get().getAccessToken())); +// throw new AppException(HttpStatus.SC_FORBIDDEN, "Access denied", "The user is not authorized to perform this action"); +// } +// IdToken idToken = IdToken.builder().tokenValue(ACCESS_TOKEN).expirationTimeMillis(JWT.decode(ACCESS_TOKEN).getExpiresAt().getTime()).build(); +// +// this.cacheService.put(tenant.getServiceAccount(), idToken); +// +// } catch (InterruptedException e) { +// e.printStackTrace(); +// } catch (ExecutionException e) { +// e.printStackTrace(); +// } catch (MalformedURLException e) { +// e.printStackTrace(); +// } finally { +// service.shutdown(); +// } +// } catch (JWTDecodeException e) { +// throw new AppException(HttpStatus.SC_INTERNAL_SERVER_ERROR, "Persistence error", "Invalid token, error decoding", e); +// } catch (AppException e) { +// throw e; +// } catch (Exception e) { +// throw new AppException(HttpStatus.SC_INTERNAL_SERVER_ERROR, "Persistence error", "Error generating token", e); +// } +// +// return ACCESS_TOKEN; +// } +//} diff --git a/provider/indexer-ibm/src/main/resources/application.properties b/provider/indexer-ibm/src/main/resources/application.properties index a79e32ddcde40517593b25bcef9d90b778ce2c65..2612b5b1931cafafcff6d212699b4a2eb902fa77 100644 --- a/provider/indexer-ibm/src/main/resources/application.properties +++ b/provider/indexer-ibm/src/main/resources/application.properties @@ -1,19 +1,19 @@ -#server.servlet.contextPath=/api/indexer/v2/ -logging.level.org.springframework.web=DEBUG -server.port=8080 -JAVA_HEAP_OPTS=-Xms4096M -Xmx4096M -JAVA_GC_OPTS=-XX:+UseG1GC -XX:+UseStringDeduplication -XX:InitiatingHeapOccupancyPercent=45 - -DEFAULT_DATA_COUNTRY=US - -AUTHORIZE_API=https://opendesproxy.azurewebsites.net/entitlements/v1 -AUTHORIZE_API_KEY=dummy -LEGALTAG_API=https://opendesproxy.azurewebsites.net/legal/v1 -LEGALTAG_API_KEY=dummy -CRS_API=https://opendesproxy.azurewebsites.net/crs/v1 -CRS_API_KEY=dummy - -#Default Cache Settings +##server.servlet.contextPath=/api/indexer/v2/ +#logging.level.org.springframework.web=DEBUG +#server.port=8080 +#JAVA_HEAP_OPTS=-Xms4096M -Xmx4096M +#JAVA_GC_OPTS=-XX:+UseG1GC -XX:+UseStringDeduplication -XX:InitiatingHeapOccupancyPercent=45 +# +#DEFAULT_DATA_COUNTRY=US +# +#AUTHORIZE_API=https://opendesproxy.azurewebsites.net/entitlements/v1 +#AUTHORIZE_API_KEY=dummy +#LEGALTAG_API=https://opendesproxy.azurewebsites.net/legal/v1 +#LEGALTAG_API_KEY=dummy +#CRS_API=https://opendesproxy.azurewebsites.net/crs/v1 +#CRS_API_KEY=dummy +# +##Default Cache Settings SCHEMA_CACHE_EXPIRATION=60 INDEX_CACHE_EXPIRATION=60 ELASTIC_CACHE_EXPIRATION=1440 @@ -24,63 +24,93 @@ KINDS_CACHE_EXPIRATION=2880 ATTRIBUTES_CACHE_EXPIRATION=2880 # Maximum size of cache value MAX_CACHE_VALUE_SIZE=1000 - +# KINDS_REDIS_DATABASE=1 CRON_INDEX_CLEANUP_THRESHOLD_DAYS=3 CRON_EMPTY_INDEX_CLEANUP_THRESHOLD_DAYS=7 - -STORAGE_SCHEMA_HOST=https://opendesmvp.azurewebsites.net/schemas +# +STORAGE_SCHEMA_HOST=http://os-storage.osdu-dev-7b9b848225bcb25e9d50d2c703a0ef7e-0002.us-south.containers.appdomain.cloud/api/storage/v2/schemas STORAGE_QUERY_RECORD_HOST=https://opendesmvp.azurewebsites.net/query/records STORAGE_QUERY_RECORD_FOR_CONVERSION_HOST=https://opendesmvp.azurewebsites.net/query/records:batch STORAGE_RECORDS_BATCH_SIZE=20 +# +#INDEXER_QUEUE_HOST=https://requeuefunction-cd1.azurewebsites.net/api/re-enqueue +# +##MSAL AAD +#aad.authority=https://login.microsoftonline.com/1668106e-2ae0-456a-bb7d-64b52104db99/oauth2/token +#aad.clientId=b70451c6-936f-4430-8680-0985817ac751 +#aad.secretKey=b5GZtbS.bB7iSzLTb+Nb-AOb9G@1@LZo +#aad.oboApi=api://ffb32b1a-c6fe-4ed0-819b-6ca483de3640 +# +#spring.security.oauth2.client.registration.azure.client-id=b70451c6-936f-4430-8680-0985817ac751 +#spring.security.oauth2.client.registration.azure.client-secret=b5GZtbS.bB7iSzLTb+Nb-AOb9G@1@LZo +#spring.security.oauth2.client.registration.azure.client-name=Azure +# +# +spring.security.user.name=opendes@byoc.local +spring.security.user.password=123 +spring.security.user.roles=service.indexer.admin +# +# +## Azure AD configuration +#azure.activedirectory.client-id=ffb32b1a-c6fe-4ed0-819b-6ca483de3640 +#azure.activedirectory.tenant-id=1668106e-2ae0-456a-bb7d-64b52104db99 +#azure.activedirectory.AppIdUri=api://${azure.activedirectory.client-id} +#azure.activedirectory.session-stateless=true +# +##azure.activedirectory.active-directory-groups=ADMIN, VIEWER +# +## Azure CosmosDB configuration +#azure.cosmosdb.uri=https://opendescosmosdb.documents.azure.com:443/ +#azure.cosmosdb.key=AQK0VbnMGn76h9Ypw5aoirKMwoAYJBRY2XENn1dAYypoea83weVyjYcGaRDeEX7HqXIVggaDuFAhQ4Y1Y9lKDQ== +#azure.cosmosdb.database=opendesdb +# +# +## Azure Service Bus configuration +#azure.servicebus.connection-string=Endpoint=sb://pliuopendes.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=km8Nscc0gf299Ck6npmM3D14VU5Tx1lJYRdlHcExIvY= +#azure.servicebus.topic-name=recordstopic +# +##Indexer-Queue-header +indexer.queue.key=abcd +# +REDIS_GROUP_HOST=127.0.0.1 +REDIS_GROUP_PORT=6379 +REDIS_SEARCH_HOST=localhost +REDIS_SEARCH_PORT=6379 +# +ELASTIC_DATASTORE_KIND=SearchSettings +ELASTIC_DATASTORE_ID=indexer-service +# +GAE_SERVICE=indexer +# +DEPLOYMENT_ENVIRONMENT=CLOUD -INDEXER_QUEUE_HOST=https://requeuefunction-cd1.azurewebsites.net/api/re-enqueue - -#MSAL AAD -aad.authority=https://login.microsoftonline.com/1668106e-2ae0-456a-bb7d-64b52104db99/oauth2/token -aad.clientId=b70451c6-936f-4430-8680-0985817ac751 -aad.secretKey=b5GZtbS.bB7iSzLTb+Nb-AOb9G@1@LZo -aad.oboApi=api://ffb32b1a-c6fe-4ed0-819b-6ca483de3640 - -spring.security.oauth2.client.registration.azure.client-id=b70451c6-936f-4430-8680-0985817ac751 -spring.security.oauth2.client.registration.azure.client-secret=b5GZtbS.bB7iSzLTb+Nb-AOb9G@1@LZo -spring.security.oauth2.client.registration.azure.client-name=Azure - - -#spring.security.user.name=opendes@byoc.local -#spring.security.user.password=123 -#spring.security.user.roles=service.indexer.admin - - -# Azure AD configuration -azure.activedirectory.client-id=ffb32b1a-c6fe-4ed0-819b-6ca483de3640 -azure.activedirectory.tenant-id=1668106e-2ae0-456a-bb7d-64b52104db99 -azure.activedirectory.AppIdUri=api://${azure.activedirectory.client-id} -azure.activedirectory.session-stateless=true -#azure.activedirectory.active-directory-groups=ADMIN, VIEWER -# Azure CosmosDB configuration -azure.cosmosdb.uri=https://opendescosmosdb.documents.azure.com:443/ -azure.cosmosdb.key=AQK0VbnMGn76h9Ypw5aoirKMwoAYJBRY2XENn1dAYypoea83weVyjYcGaRDeEX7HqXIVggaDuFAhQ4Y1Y9lKDQ== -azure.cosmosdb.database=opendesdb -# Azure Service Bus configuration -azure.servicebus.connection-string=Endpoint=sb://pliuopendes.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=km8Nscc0gf299Ck6npmM3D14VU5Tx1lJYRdlHcExIvY= -azure.servicebus.topic-name=recordstopic +server.servlet.contextPath=/api/storage/v2/ +logging.level.org.springframework.web=DEBUG +server.port=8080 +JAVA_HEAP_OPTS=-Xms4096M -Xmx4096M +JAVA_GC_OPTS=-XX:+UseG1GC -XX:+UseStringDeduplication -XX:InitiatingHeapOccupancyPercent=45 -#Indexer-Queue-header -indexer.queue.key=abcd +spring.security.user.name=test@ibm.com +spring.security.user.password=123 +spring.security.user.roles=service.storage.admin -REDIS_GROUP_HOST=127.0.0.1 -REDIS_GROUP_PORT=6379 -REDIS_SEARCH_HOST=localhost -REDIS_SEARCH_PORT=6379 +AUTHORIZE_API=notused +LEGALTAG_API=update +CRS_API=notused???? -ELASTIC_DATASTORE_KIND=SearchSettings -ELASTIC_DATASTORE_ID=indexer-service +ibm.cloudant.dbname.prefix=mvn-build +ibm.cloudant.apikey=_nvl7qBbJ292BpnZLpvlk00dFgFg48V7pHMHgdCbFdIF +ibm.cloudant.url=https://5be9693e-3324-400a-aadc-59908c132be2-bluemix.cloudant.com -GAE_SERVICE=indexer +ibm.rabbitmq.uri=amqps://ibm_cloud_45338a90_9047_4927_a6a4_67cd2f7ad9f7:32769652ee6c161f72fd4bcee2929a1866178092b90d22e7f0d7650b8d3b6fa1@e6530902-b278-496b-92bb-230dd55edf86.bn2a2vgd01r3l0hfmvc0.databases.appdomain.cloud:30270 -DEPLOYMENT_ENVIRONMENT=CLOUD \ No newline at end of file +ibm.cos.bucket.crn=crn:v1:bluemix:public:cloud-object-storage:global:a/59506c69395f4b3f979f594bd9dc385a:69aee223-b6b5-4a26-a95b-5a65badfa85d:bucket:osdu-storage-ibm-dev-test +ibm.cos.bucketName=osdu-storage-ibm-dev-test +ibm.cos.endpoint_url=s3.us-south.cloud-object-storage.appdomain.cloud +ibm.cos.api_key=_em_p3rmHlPAdx2EbJcg4JxHsPnVh2rQ1Aisw-c01HOj +ibm.cos.service_instance_id=crn:v1:bluemix:public:cloud-object-storage:global:a/59506c69395f4b3f979f594bd9dc385a:69aee223-b6b5-4a26-a95b-5a65badfa85d:: diff --git a/provider/indexer-ibm/src/main/resources/logback-spring.xml b/provider/indexer-ibm/src/main/resources/logback-spring.xml deleted file mode 100644 index e70b3be45b9f89b107f0e0197dede6b2afa5da2a..0000000000000000000000000000000000000000 --- a/provider/indexer-ibm/src/main/resources/logback-spring.xml +++ /dev/null @@ -1,42 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright 2019 IBM Corp. All Rights Reserved. - - 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. - --> - -<configuration> - - <appender name="Console" - class="ch.qos.logback.core.ConsoleAppender"> - <layout class="ch.qos.logback.classic.PatternLayout"> - <Pattern> - %black(%d{ISO8601}) %highlight(%-5level) [%blue(%t)] %yellow(%C{1.}): %msg%n%throwable - </Pattern> - </layout> - </appender> - - <appender name="aiAppender" - class="com.microsoft.applicationinsights.logback.ApplicationInsightsAppender"> - <instrumentationKey>${appinsights_key}</instrumentationKey> - </appender> - - <!-- servicebus throws exceptions when idle --> - <logger name="com.microsoft.azure.servicebus.primitives.RequestResponseLink" level="error" /> - - <root level="warn"> - <appender-ref ref="Console" /> - <appender-ref ref="aiAppender" /> - </root> - -</configuration> \ No newline at end of file