diff --git a/testing/notification-test-azure/src/test/java/org/opengroup/osdu/notification/api/PubsubEndpointHMACDescriptor.java b/testing/notification-test-azure/src/test/java/org/opengroup/osdu/notification/api/PubsubEndpointHMACDescriptor.java index 2e8d73c94bf0121e6f60421a77b2236631982e27..55c7ba5789646ed2dbf5dd6407b3ecb78ab9a8cb 100644 --- a/testing/notification-test-azure/src/test/java/org/opengroup/osdu/notification/api/PubsubEndpointHMACDescriptor.java +++ b/testing/notification-test-azure/src/test/java/org/opengroup/osdu/notification/api/PubsubEndpointHMACDescriptor.java @@ -1,18 +1,16 @@ -/* - * 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. - */ +// Copyright © Microsoft Corporation +// +// 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.api; diff --git a/testing/notification-test-azure/src/test/java/org/opengroup/osdu/notification/api/TestPubsubEndpointHMAC.java b/testing/notification-test-azure/src/test/java/org/opengroup/osdu/notification/api/TestPubsubEndpointHMAC.java index a18328c340158fbe152575791e6660739984fa10..89ef6a4e27ce59ffa109085de356b1891c6f6872 100644 --- a/testing/notification-test-azure/src/test/java/org/opengroup/osdu/notification/api/TestPubsubEndpointHMAC.java +++ b/testing/notification-test-azure/src/test/java/org/opengroup/osdu/notification/api/TestPubsubEndpointHMAC.java @@ -1,3 +1,17 @@ +// Copyright © Microsoft Corporation +// +// 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.api; import org.junit.After; diff --git a/testing/notification-test-azure/src/test/java/org/opengroup/osdu/notification/util/AzureTestUtils.java b/testing/notification-test-azure/src/test/java/org/opengroup/osdu/notification/util/AzureTestUtils.java index 93bedd57a1bda315459e6c41dfb2851ad2bcae58..8674c780592950bebb1f86e8328abc8f9f5abc46 100644 --- a/testing/notification-test-azure/src/test/java/org/opengroup/osdu/notification/util/AzureTestUtils.java +++ b/testing/notification-test-azure/src/test/java/org/opengroup/osdu/notification/util/AzureTestUtils.java @@ -1,3 +1,17 @@ +// Copyright © Microsoft Corporation +// +// 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.util; import com.google.common.base.Strings; @@ -13,51 +27,42 @@ public class AzureTestUtils extends TestUtils { @Override public synchronized String getOpsToken() throws Exception { if (Strings.isNullOrEmpty(opsToken)) { - noAccessToken = getToken("c4167fb6-c724-40e8-be11-2e20d1b7a92c",//System.getProperty("NO_DATA_ACCESS_TESTER", System.getenv("NO_DATA_ACCESS_TESTER")), - "muwCHobjuKlVzQwdUgMcta4w7mfQzAiW");//System.getProperty("NO_DATA_ACCESS_TESTER_SERVICEPRINCIPAL_SECRET", System.getenv("NO_DATA_ACCESS_TESTER_SERVICEPRINCIPAL_SECRET"))); - - /*opsToken = getToken(System.getProperty("INTEGRATION_TESTER", System.getenv("INTEGRATION_TESTER")), + opsToken = getToken(System.getProperty("INTEGRATION_TESTER", System.getenv("INTEGRATION_TESTER")), System.getProperty("TESTER_SERVICEPRINCIPAL_SECRET", System.getenv("TESTER_SERVICEPRINCIPAL_SECRET"))); - */} + } return "Bearer " + opsToken; } @Override public synchronized String getAdminToken() throws Exception { if (Strings.isNullOrEmpty(adminToken)) { - noAccessToken = getToken("c4167fb6-c724-40e8-be11-2e20d1b7a92c",//System.getProperty("NO_DATA_ACCESS_TESTER", System.getenv("NO_DATA_ACCESS_TESTER")), - "muwCHobjuKlVzQwdUgMcta4w7mfQzAiW");//System.getProperty("NO_DATA_ACCESS_TESTER_SERVICEPRINCIPAL_SECRET", System.getenv("NO_DATA_ACCESS_TESTER_SERVICEPRINCIPAL_SECRET"))); - - /*adminToken = getToken(System.getProperty("INTEGRATION_TESTER", System.getenv("INTEGRATION_TESTER")), + adminToken = getToken(System.getProperty("INTEGRATION_TESTER", System.getenv("INTEGRATION_TESTER")), System.getProperty("TESTER_SERVICEPRINCIPAL_SECRET", System.getenv("TESTER_SERVICEPRINCIPAL_SECRET"))); - */} + } return "Bearer " + adminToken; } @Override public synchronized String getEditorToken() throws Exception { if (Strings.isNullOrEmpty(editorToken)) { - noAccessToken = getToken("c4167fb6-c724-40e8-be11-2e20d1b7a92c",//System.getProperty("NO_DATA_ACCESS_TESTER", System.getenv("NO_DATA_ACCESS_TESTER")), - "muwCHobjuKlVzQwdUgMcta4w7mfQzAiW");//System.getProperty("NO_DATA_ACCESS_TESTER_SERVICEPRINCIPAL_SECRET", System.getenv("NO_DATA_ACCESS_TESTER_SERVICEPRINCIPAL_SECRET"))); - - /*editorToken = getToken(System.getProperty("INTEGRATION_TESTER", System.getenv("INTEGRATION_TESTER")), + editorToken = getToken(System.getProperty("INTEGRATION_TESTER", System.getenv("INTEGRATION_TESTER")), System.getProperty("TESTER_SERVICEPRINCIPAL_SECRET", System.getenv("TESTER_SERVICEPRINCIPAL_SECRET"))); - */} + } return "Bearer " + editorToken; } @Override public synchronized String getNoAccessToken() throws Exception { if (Strings.isNullOrEmpty(noAccessToken)) { - noAccessToken = getToken("c4167fb6-c724-40e8-be11-2e20d1b7a92c",//System.getProperty("NO_DATA_ACCESS_TESTER", System.getenv("NO_DATA_ACCESS_TESTER")), - "muwCHobjuKlVzQwdUgMcta4w7mfQzAiW");//System.getProperty("NO_DATA_ACCESS_TESTER_SERVICEPRINCIPAL_SECRET", System.getenv("NO_DATA_ACCESS_TESTER_SERVICEPRINCIPAL_SECRET"))); + noAccessToken = getToken(System.getProperty("NO_DATA_ACCESS_TESTER", System.getenv("NO_DATA_ACCESS_TESTER")), + System.getProperty("NO_DATA_ACCESS_TESTER_SERVICEPRINCIPAL_SECRET", System.getenv("NO_DATA_ACCESS_TESTER_SERVICEPRINCIPAL_SECRET"))); } return "Bearer " + noAccessToken; } private String getToken(String sp_id, String sp_secret) throws Exception { - String tenant_id = "58975fd3-4977-44d0-bea8-37af0baac100";//System.getProperty("AZURE_AD_TENANT_ID", System.getenv("AZURE_AD_TENANT_ID")); - String app_resource_id = "dbf53e4d-f088-4379-87c3-d9b1496e77f8";//System.getProperty("AZURE_AD_APP_RESOURCE_ID", System.getenv("AZURE_AD_APP_RESOURCE_ID")); + String tenant_id = System.getProperty("AZURE_AD_TENANT_ID", System.getenv("AZURE_AD_TENANT_ID")); + String app_resource_id = System.getProperty("AZURE_AD_APP_RESOURCE_ID", System.getenv("AZURE_AD_APP_RESOURCE_ID")); return new AzureServicePrincipal().getIdToken(sp_id, sp_secret, tenant_id, app_resource_id); } diff --git a/testing/notification-test-core/src/main/java/org/opengroup/osdu/notification/util/Config.java b/testing/notification-test-core/src/main/java/org/opengroup/osdu/notification/util/Config.java index 81dc130b8d26a2e87dfe1ff2777debee73b7c7aa..7812c54cd815ca1dc159f1125a55c1a2051d88ed 100644 --- a/testing/notification-test-core/src/main/java/org/opengroup/osdu/notification/util/Config.java +++ b/testing/notification-test-core/src/main/java/org/opengroup/osdu/notification/util/Config.java @@ -37,13 +37,14 @@ public class Config { config.IntegrationAudience = "245464679631-ktfdfpl147m1mjpbutl00b3cmffissgq.apps.googleusercontent.com"; config.OsduTenant = "opendes"; config.Topic = "records-changed"; + config.hmacSecretValue = System.getProperty("HMAC_SECRET", System.getenv("HMAC_SECRET")); if (env.equalsIgnoreCase("LOCAL")) { //make sure to run register service on a different port. You can also choose to point to Register service that is running in cloud String registerUrl = "http://localhost:8081/api/register/v1"; //must have notification and register services running on different ports - config.HostUrl = "http://localhost:8082/"; + config.HostUrl = "http://localhost:8080/"; config.GSAPushUrl = registerUrl+"/test/gsa-challenge/"; config.HMACPushUrl = registerUrl+"/test/challenge/";