From 217464e94c5784528c780c9618117020679b8b66 Mon Sep 17 00:00:00 2001 From: rmueller Date: Tue, 2 Apr 2024 11:11:26 +0200 Subject: [PATCH] without auth --- .../highmed/numportal/domain/model/SetupType.java | 8 ++++---- src/main/resources/application-deploy.yml | 2 +- src/main/resources/application-local.yml | 2 +- src/main/resources/application.yml | 2 +- .../tests/AdminControllerIT.java | 12 ++++++------ .../integrationtesting/tests/IntegrationTest.java | 14 +++++++------- src/test/resources/application-itest.yml | 2 +- src/test/resources/application.yml | 2 +- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/main/java/org/highmed/numportal/domain/model/SetupType.java b/src/main/java/org/highmed/numportal/domain/model/SetupType.java index 165bb2ca..6bf3ff4f 100644 --- a/src/main/java/org/highmed/numportal/domain/model/SetupType.java +++ b/src/main/java/org/highmed/numportal/domain/model/SetupType.java @@ -16,7 +16,7 @@ public enum Preprod { EHRBASE("https://ehrbase.crr.pre-prod.num-codex.de/ehrbase/management/health/readiness"), FHIR_BRIDGE("https://fhir-bridge.crr.pre-prod.num-codex.de/fhir-bridge/actuator/health/readiness"), FE("https://pre-prod.num-codex.de/home"), - KEYCLOAK("https://keycloak.pre-prod.num-codex.de/auth"); + KEYCLOAK("https://keycloak.pre-prod.num-codex.de"); private String URL; } @@ -27,7 +27,7 @@ public enum Prod { EHRBASE("https://ehrbase.crr.num-codex.de/ehrbase/management/health/readiness"), FHIR_BRIDGE("https://fhir-bridge.crr.num-codex.de/fhir-bridge/actuator/health/readiness"), FE("https://num-codex.de/"), - KEYCLOAK("https://keycloak.crr.num-codex.de/auth"); + KEYCLOAK("https://keycloak.crr.num-codex.de"); private String URL; } @@ -38,7 +38,7 @@ public enum Dev { EHRBASE("https://ehrbase.crr.dev.num-codex.de/ehrbase/management/health/readiness"), FHIR_BRIDGE("https://fhir-bridge.crr.dev.num-codex.de/fhir-bridge/actuator/health/readiness"), FE("https://dev.num-codex.de/"), - KEYCLOAK("https://keycloak.dev.num-codex.de/auth"); + KEYCLOAK("https://keycloak.dev.num-codex.de"); private String URL; } @@ -49,7 +49,7 @@ public enum Staging { EHRBASE("https://ehrbase.crr.staging.num-codex.de/ehrbase/management/health/readiness"), FHIR_BRIDGE("https://fhir-bridge.crr.staging.num-codex.de/fhir-bridge/actuator/health/readiness"), FE("https://staging.num-codex.de/"), - KEYCLOAK("https://keycloak.staging.num-codex.de/auth"); + KEYCLOAK("https://keycloak.staging.num-codex.de"); private String URL; } } diff --git a/src/main/resources/application-deploy.yml b/src/main/resources/application-deploy.yml index ee80fa99..e5650df4 100644 --- a/src/main/resources/application-deploy.yml +++ b/src/main/resources/application-deploy.yml @@ -50,7 +50,7 @@ userstore: swagger: oauth2: token-uri: ${KEYCLOAK_CANONICAL_URL}/realms/${KEYCLOAK_REALM}/protocol/openid-connect/token - auth-uri: ${KEYCLOAK_CANONICAL_URL}/realms/${KEYCLOAK_REALM}/protocol/openid-connect/auth + auth-uri: ${KEYCLOAK_CANONICAL_URL}/realms/${KEYCLOAK_REALM}/protocol/openid-connect client-name: ${SWAGGER_OAUTH2_CLIENT-NAME} client-secret: ${SWAGGER_OAUTH2_CLIENT-NAME} diff --git a/src/main/resources/application-local.yml b/src/main/resources/application-local.yml index 6cb7d333..749fc943 100644 --- a/src/main/resources/application-local.yml +++ b/src/main/resources/application-local.yml @@ -54,7 +54,7 @@ spring: swagger: oauth2: token-uri: ${keycloak.url}/realms/crr/protocol/openid-connect/token - auth-uri: ${keycloak.url}/realms/crr/protocol/openid-connect/auth + auth-uri: ${keycloak.url}/realms/crr/protocol/openid-connect client-name: numPortalWebapp client-secret: numPortalWebapp diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 0e3015b3..e5fbeb2d 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -94,7 +94,7 @@ springdoc: swagger: oauth2: token-uri: ${keycloak.url}/realms/Num/protocol/openid-connect/token - auth-uri: ${keycloak.url}/realms/Num/protocol/openid-connect/auth + auth-uri: ${keycloak.url}/realms/Num/protocol/openid-connect client-name: num-portal-webapp client-secret: num-portal-webapp diff --git a/src/test/java/org/highmed/numportal/integrationtesting/tests/AdminControllerIT.java b/src/test/java/org/highmed/numportal/integrationtesting/tests/AdminControllerIT.java index c7e59c30..fa0b5b2b 100644 --- a/src/test/java/org/highmed/numportal/integrationtesting/tests/AdminControllerIT.java +++ b/src/test/java/org/highmed/numportal/integrationtesting/tests/AdminControllerIT.java @@ -46,10 +46,10 @@ public class AdminControllerIT extends IntegrationTest { roles = {STUDY_COORDINATOR}) public void shouldCreateUserOnFirstLoginSuccessfully() throws Exception { stubFor( - WireMock.get("/auth/admin/realms/Num/users/b59e5edb-3121-4e0a-8ccb-af6798207a79") + WireMock.get("/admin/realms/Num/users/b59e5edb-3121-4e0a-8ccb-af6798207a79") .willReturn(okJson( "{\"id\": \"b59e5edb-3121-4e0a-8ccb-af6798207a79\",\"username\": \"new-user\"}"))); - stubFor(WireMock.get("/auth/admin/realms/Num/users/b59e5edb-3121-4e0a-8ccb-af6798207a79/role-mappings/realm") + stubFor(WireMock.get("/admin/realms/Num/users/b59e5edb-3121-4e0a-8ccb-af6798207a79/role-mappings/realm") .willReturn(okJson("[{\"id\":\"12345-2f04-4356-8f34-12345\",\"name\":\"STUDY_COORDINATOR\",\"composite\":false,\"clientRole\":false,\"containerId\":\"Num\"}]"))); mockMvc .perform( @@ -65,7 +65,7 @@ public void shouldCreateUserOnFirstLoginSuccessfully() throws Exception { roles = {SUPER_ADMIN, ORGANIZATION_ADMIN}) public void shouldApproveUserSuccessfully() { stubFor( - WireMock.get("/auth/admin/realms/Num/users/b59e5edb-3121-4e0a-8ccb-af6798207a73") + WireMock.get("/admin/realms/Num/users/b59e5edb-3121-4e0a-8ccb-af6798207a73") .willReturn(okJson( "{\"id\": \"b59e5edb-3121-4e0a-8ccb-af6798207a73\",\"username\": \"new-user\", \"firstname\":\"John\", \"email\": \"john.doe@vitagroup.ag\"}"))); mockMvc @@ -81,11 +81,11 @@ public void shouldApproveUserSuccessfully() { @WithMockNumUser(roles = {SUPER_ADMIN}) public void shouldUpdateUserStatusSuccessfully() { stubFor( - WireMock.get("/auth/admin/realms/Num/users/b59e5edb-3121-4e0a-8ccb-af6798207a73") + WireMock.get("/admin/realms/Num/users/b59e5edb-3121-4e0a-8ccb-af6798207a73") .willReturn(okJson( "{\"id\": \"b59e5edb-3121-4e0a-8ccb-af6798207a73\",\"username\": \"new-user\", \"firstname\":\"John\", \"email\": \"john.doe@vitagroup.ag\", \"enabled\": \"true\"}"))); - stubFor(WireMock.put("/auth/admin/realms/Num/users/b59e5edb-3121-4e0a-8ccb-af6798207a73").willReturn(okJson("[]"))); - stubFor(WireMock.get("/auth/admin/realms/Num/users/b59e5edb-3121-4e0a-8ccb-af6798207a73/role-mappings/realm") + stubFor(WireMock.put("/admin/realms/Num/users/b59e5edb-3121-4e0a-8ccb-af6798207a73").willReturn(okJson("[]"))); + stubFor(WireMock.get("/admin/realms/Num/users/b59e5edb-3121-4e0a-8ccb-af6798207a73/role-mappings/realm") .willReturn(okJson("[{\"id\":\"12345-2f04-1156-8f34-12345\",\"name\":\"RESEARCHER\",\"composite\":false,\"clientRole\":false,\"containerId\":\"Num\"}]"))); mockMvc .perform( diff --git a/src/test/java/org/highmed/numportal/integrationtesting/tests/IntegrationTest.java b/src/test/java/org/highmed/numportal/integrationtesting/tests/IntegrationTest.java index 4ed967fc..4752e667 100644 --- a/src/test/java/org/highmed/numportal/integrationtesting/tests/IntegrationTest.java +++ b/src/test/java/org/highmed/numportal/integrationtesting/tests/IntegrationTest.java @@ -32,13 +32,13 @@ public abstract class IntegrationTest { public static final String UNAUTHORIZED_USER_ID = "b59e5edb-3121-4e0a-8ccb-af6798207a73"; private static final String IDENTITY_PROVIDER_URL = - "/auth/realms/Num/protocol/openid-connect/certs"; + "/realms/Num/protocol/openid-connect/certs"; private static final String IDENTITY_PROVIDER_TOKEN_ENDPOINT = - "/auth/realms/Num/protocol/openid-connect/token"; - private static final String USER_ENDPOINT_USER1 = "/auth/admin/realms/Num/users/user1"; - private static final String USER_ENDPOINT_USER2 = "/auth/admin/realms/Num/users/user2"; + "/realms/Num/protocol/openid-connect/token"; + private static final String USER_ENDPOINT_USER1 = "/admin/realms/Num/users/user1"; + private static final String USER_ENDPOINT_USER2 = "/admin/realms/Num/users/user2"; private static final String USER_ENDPOINT_ALL_APPROVERS = - "/auth/admin/realms/Num/roles/STUDY_APPROVER/users"; + "/admin/realms/Num/roles/STUDY_APPROVER/users"; private static final String EHR_BASE_URL = "/ehrbase/rest/openehr/v1/definition/template/adl1.4/"; @ClassRule @@ -75,9 +75,9 @@ public void setup() { .willReturn( okJson( "[{\"template_id\": \"IDCR - Immunisation summary.v0\",\"concept\": \"IDCR - Immunisation summary.v0\",\"archetype_id\": \"openEHR-EHR-COMPOSITION.health_summary.v1\",\"created_timestamp\": \"2020-11-25T16:19:37.812Z\"}]"))); - stubFor(WireMock.get("/auth/admin/realms/Num/roles/SUPER_ADMIN/users").willReturn(okJson("[]"))); + stubFor(WireMock.get("/admin/realms/Num/roles/SUPER_ADMIN/users").willReturn(okJson("[]"))); stubFor( - WireMock.get("/auth/admin/realms/Num/users/b59e5edb-3121-4e0a-8ccb-af6798207a72") + WireMock.get("/admin/realms/Num/users/b59e5edb-3121-4e0a-8ccb-af6798207a72") .willReturn(okJson( "{\"id\": \"b59e5edb-3121-4e0a-8ccb-af6798207a72\",\"username\": \"admin-user\", \"firstname\":\"Admin\", \"email\": \"admin.doe@vitagroup.ag\"}"))); } diff --git a/src/test/resources/application-itest.yml b/src/test/resources/application-itest.yml index a1550427..4b04faa3 100644 --- a/src/test/resources/application-itest.yml +++ b/src/test/resources/application-itest.yml @@ -58,7 +58,7 @@ spring: swagger: oauth2: token-uri: ${keycloak.url}/realms/Num/protocol/openid-connect/token - auth-uri: ${keycloak.url}/realms/Num/protocol/openid-connect/auth + auth-uri: ${keycloak.url}/realms/Num/protocol/openid-connect client-name: numPortalWebapp client-secret: numPortalWebapp diff --git a/src/test/resources/application.yml b/src/test/resources/application.yml index f36e749e..93e81612 100644 --- a/src/test/resources/application.yml +++ b/src/test/resources/application.yml @@ -54,7 +54,7 @@ spring: swagger: oauth2: token-uri: ${keycloak.url}/realms/Num/protocol/openid-connect/token - auth-uri: ${keycloak.url}/realms/Num/protocol/openid-connect/auth + auth-uri: ${keycloak.url}/realms/Num/protocol/openid-connect client-name: numPortalWebapp client-secret: numPortalWebapp