Remove hardcoded /auth from the keycloak urls in bff 73/137673/1
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Thu, 11 Apr 2024 11:57:10 +0000 (13:57 +0200)
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Thu, 11 Apr 2024 11:57:10 +0000 (13:57 +0200)
- it should be possible not to configure /auth in the Keycloak url
since newer versions do not use it

Issue-ID: PORTALNG-85
Change-Id: I288c8b954db185ed22793db0107d14e314d17c26
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
22 files changed:
app/src/main/resources/application-development.yml
app/src/main/resources/application-local.yml
app/src/main/resources/application.yml
app/src/test/java/org/onap/portalng/bff/BaseIntegrationTest.java
app/src/test/java/org/onap/portalng/bff/TokenGenerator.java
app/src/test/java/org/onap/portalng/bff/roles/ListRealmRolesIntegrationTest.java
app/src/test/java/org/onap/portalng/bff/roles/RolesMocks.java
app/src/test/java/org/onap/portalng/bff/users/CreateUserIntegrationTest.java
app/src/test/java/org/onap/portalng/bff/users/DeleteUserIntegrationTest.java
app/src/test/java/org/onap/portalng/bff/users/GetUserDetailIntegrationTest.java
app/src/test/java/org/onap/portalng/bff/users/ListAssignedRolesIntegrationTest.java
app/src/test/java/org/onap/portalng/bff/users/ListAvailableRolesIntegrationTest.java
app/src/test/java/org/onap/portalng/bff/users/ListUsersIntegrationTest.java
app/src/test/java/org/onap/portalng/bff/users/UpdateAssignedRolesIntegrationTest.java
app/src/test/java/org/onap/portalng/bff/users/UpdateUserIntegrationTest.java
app/src/test/java/org/onap/portalng/bff/users/UpdateUserPasswordIntegrationTest.java
app/src/test/resources/application-development.yml
app/src/test/resources/application.yml
development/config/onap-realm.json
development/requests-code.http
development/requests-idea.http
lib/src/main/java/org/onap/portalng/bff/config/clients/KeycloakConfig.java

index d68870f..81a5c8e 100644 (file)
@@ -4,8 +4,8 @@ spring:
       client:
         provider:
           keycloak:
-            token-uri: http://localhost:8080/auth/realms/ONAP/protocol/openid-connect/token
-            jwk-set-uri: http://localhost:8080/auth/realms/ONAP/protocol/openid-connect/certs
+            token-uri: http://localhost:8080/realms/ONAP/protocol/openid-connect/token
+            jwk-set-uri: http://localhost:8080/realms/ONAP/protocol/openid-connect/certs
         registration:
           keycloak:
             provider: keycloak
@@ -14,7 +14,7 @@ spring:
             authorization-grant-type: client_credentials
       resourceserver:
         jwt:
-          jwk-set-uri: http://localhost:8080/auth/realms/ONAP/protocol/openid-connect/certs
+          jwk-set-uri: http://localhost:8080/realms/ONAP/protocol/openid-connect/certs
 
 management:
   endpoints:
index 2eb3278..5d49512 100644 (file)
@@ -4,8 +4,8 @@ spring:
       client:
         provider:
           keycloak:
-            token-uri: http://localhost:8080/auth/realms/ONAP/protocol/openid-connect/token
-            jwk-set-uri: http://localhost:8080/auth/realms/ONAP/protocol/openid-connect/certs
+            token-uri: http://localhost:8080/realms/ONAP/protocol/openid-connect/token
+            jwk-set-uri: http://localhost:8080/realms/ONAP/protocol/openid-connect/certs
         registration:
           keycloak:
             provider: keycloak
@@ -14,7 +14,7 @@ spring:
             authorization-grant-type: client_credentials
       resourceserver:
         jwt:
-          jwk-set-uri: http://localhost:8080/auth/realms/ONAP/protocol/openid-connect/certs
+          jwk-set-uri: http://localhost:8080/realms/ONAP/protocol/openid-connect/certs
 
 management:
   endpoints:
index 87493a0..367b33c 100644 (file)
@@ -32,8 +32,8 @@ spring:
       client:
         provider:
           keycloak:
-            token-uri: ${KEYCLOAK_URL}/auth/realms/${KEYCLOAK_REALM}/protocol/openid-connect/token
-            jwk-set-uri: ${KEYCLOAK_URL}/auth/realms/${KEYCLOAK_REALM}/protocol/openid-connect/certs
+            token-uri: ${KEYCLOAK_URL}/realms/${KEYCLOAK_REALM}/protocol/openid-connect/token
+            jwk-set-uri: ${KEYCLOAK_URL}/realms/${KEYCLOAK_REALM}/protocol/openid-connect/certs
         registration:
           keycloak:
             provider: keycloak
@@ -42,7 +42,7 @@ spring:
             authorization-grant-type: client_credentials
       resourceserver:
         jwt:
-          jwk-set-uri: ${KEYCLOAK_URL}/auth/realms/${KEYCLOAK_REALM}/protocol/openid-connect/certs
+          jwk-set-uri: ${KEYCLOAK_URL}/realms/${KEYCLOAK_REALM}/protocol/openid-connect/certs
   jackson:
     serialization:
       FAIL_ON_EMPTY_BEANS: false
index d90034c..1311ac7 100644 (file)
@@ -87,7 +87,7 @@ public abstract class BaseIntegrationTest {
     WireMock.stubFor(
         WireMock.get(
                 WireMock.urlMatching(
-                    String.format("/auth/realms/%s/protocol/openid-connect/certs", realm)))
+                    String.format("/realms/%s/protocol/openid-connect/certs", realm)))
             .willReturn(
                 WireMock.aResponse()
                     .withHeader("Content-Type", JWKSet.MIME_TYPE)
@@ -99,7 +99,7 @@ public abstract class BaseIntegrationTest {
     WireMock.stubFor(
         WireMock.post(
                 WireMock.urlMatching(
-                    String.format("/auth/realms/%s/protocol/openid-connect/token", realm)))
+                    String.format("/realms/%s/protocol/openid-connect/token", realm)))
             .withBasicAuth("test", "test")
             .withRequestBody(WireMock.containing("grant_type=client_credentials"))
             .willReturn(
index 051129f..0c6aa89 100644 (file)
@@ -116,7 +116,7 @@ public class TokenGenerator {
     @Builder.Default private final List<String> roles = Collections.emptyList();
 
     public String issuer() {
-      return String.format("http://localhost:%d/auth/realms/%s", port, realm);
+      return String.format("http://localhost:%d/realms/%s", port, realm);
     }
   }
 }
index d9a69f1..d9fa9e0 100644 (file)
@@ -59,7 +59,7 @@ class ListRealmRolesIntegrationTest extends RolesMocks {
         new ErrorResponseKeycloakDto().errorMessage("Some error message");
 
     WireMock.stubFor(
-        WireMock.get(WireMock.urlMatching(String.format("/auth/admin/realms/%s/roles", realm)))
+        WireMock.get(WireMock.urlMatching(String.format("/admin/realms/%s/roles", realm)))
             .willReturn(
                 WireMock.aResponse()
                     .withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
index b29ad7c..2f61995 100644 (file)
@@ -48,7 +48,7 @@ public class RolesMocks extends BaseIntegrationTest {
 
   protected void mockListRealmRoles(List<RoleKeycloakDto> roles) throws Exception {
     WireMock.stubFor(
-        WireMock.get(WireMock.urlMatching(String.format("/auth/admin/realms/%s/roles", realm)))
+        WireMock.get(WireMock.urlMatching(String.format("/admin/realms/%s/roles", realm)))
             .willReturn(
                 WireMock.aResponse()
                     .withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
index c22f937..bfc868d 100644 (file)
@@ -220,21 +220,21 @@ class CreateUserIntegrationTest extends BaseIntegrationTest {
 
   protected void mockCreateUser(UserKeycloakDto request, String userId) throws Exception {
     WireMock.stubFor(
-        WireMock.post(WireMock.urlMatching(String.format("/auth/admin/realms/%s/users", realm)))
+        WireMock.post(WireMock.urlMatching(String.format("/admin/realms/%s/users", realm)))
             .withRequestBody(WireMock.equalToJson(objectMapper.writeValueAsString(request)))
             .willReturn(
                 WireMock.aResponse()
                     .withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
                     .withHeader(
                         "location",
-                        String.format("/auth/admin/realms/%s/users/%s", realm, userId))));
+                        String.format("/admin/realms/%s/users/%s", realm, userId))));
   }
 
   protected void mockGetUser(String userId, UserKeycloakDto response) throws Exception {
     WireMock.stubFor(
         WireMock.get(
                 WireMock.urlMatching(
-                    String.format("/auth/admin/realms/%s/users/%s", realm, userId)))
+                    String.format("/admin/realms/%s/users/%s", realm, userId)))
             .willReturn(
                 WireMock.aResponse()
                     .withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
@@ -246,7 +246,7 @@ class CreateUserIntegrationTest extends BaseIntegrationTest {
         WireMock.post(
                 WireMock.urlMatching(
                     String.format(
-                        "/auth/admin/realms/%s/users/%s/role-mappings/realm", realm, userId)))
+                        "/admin/realms/%s/users/%s/role-mappings/realm", realm, userId)))
             .willReturn(
                 WireMock.aResponse()
                     .withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
@@ -262,7 +262,7 @@ class CreateUserIntegrationTest extends BaseIntegrationTest {
         WireMock.put(
                 WireMock.urlMatching(
                     String.format(
-                        "/auth/admin/realms/%s/users/%s/execute-actions-email", realm, userId)))
+                        "/admin/realms/%s/users/%s/execute-actions-email", realm, userId)))
             .withRequestBody(WireMock.equalTo(objectMapper.writeValueAsString(request)))
             .willReturn(
                 WireMock.aResponse()
@@ -277,7 +277,7 @@ class CreateUserIntegrationTest extends BaseIntegrationTest {
         WireMock.get(
                 WireMock.urlMatching(
                     String.format(
-                        "/auth/admin/realms/%s/users/%s/role-mappings/realm", realm, userID)))
+                        "/admin/realms/%s/users/%s/role-mappings/realm", realm, userID)))
             .willReturn(
                 WireMock.aResponse()
                     .withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
@@ -290,7 +290,7 @@ class CreateUserIntegrationTest extends BaseIntegrationTest {
         WireMock.put(
                 WireMock.urlMatching(
                     String.format(
-                        "/auth/admin/realms/%s/users/%s/execute-actions-email", realm, userId)))
+                        "/admin/realms/%s/users/%s/execute-actions-email", realm, userId)))
             .withRequestBody(WireMock.equalTo(objectMapper.writeValueAsString(request)))
             .willReturn(
                 WireMock.aResponse().withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)));
@@ -298,7 +298,7 @@ class CreateUserIntegrationTest extends BaseIntegrationTest {
 
   protected void mockListRealmRoles(List<RoleKeycloakDto> roles) throws Exception {
     WireMock.stubFor(
-        WireMock.get(WireMock.urlMatching(String.format("/auth/admin/realms/%s/roles", realm)))
+        WireMock.get(WireMock.urlMatching(String.format("/admin/realms/%s/roles", realm)))
             .willReturn(
                 WireMock.aResponse()
                     .withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
index 11076d4..15ba9ee 100644 (file)
@@ -37,7 +37,7 @@ class DeleteUserIntegrationTest extends BaseIntegrationTest {
   @Test
   void userCanBeDeleted() {
     WireMock.stubFor(
-        WireMock.delete(WireMock.urlMatching(String.format("/auth/admin/realms/%s/users/1", realm)))
+        WireMock.delete(WireMock.urlMatching(String.format("/admin/realms/%s/users/1", realm)))
             .willReturn(WireMock.aResponse().withStatus(204)));
 
     requestSpecification()
@@ -55,7 +55,7 @@ class DeleteUserIntegrationTest extends BaseIntegrationTest {
         new ErrorResponseKeycloakDto().errorMessage("Some error message");
 
     WireMock.stubFor(
-        WireMock.delete(WireMock.urlMatching(String.format("/auth/admin/realms/%s/users/1", realm)))
+        WireMock.delete(WireMock.urlMatching(String.format("/admin/realms/%s/users/1", realm)))
             .willReturn(
                 WireMock.aResponse()
                     .withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
index 7360a63..6766af8 100644 (file)
@@ -46,7 +46,7 @@ class GetUserDetailIntegrationTest extends BaseIntegrationTest {
         new UserKeycloakDto().id("1").username("user1").email("user1@localhost").enabled(true);
 
     WireMock.stubFor(
-        WireMock.get(WireMock.urlMatching(String.format("/auth/admin/realms/%s/users/1", realm)))
+        WireMock.get(WireMock.urlMatching(String.format("/admin/realms/%s/users/1", realm)))
             .willReturn(
                 WireMock.aResponse()
                     .withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
@@ -85,7 +85,7 @@ class GetUserDetailIntegrationTest extends BaseIntegrationTest {
         new ErrorResponseKeycloakDto().errorMessage("Some error message");
 
     WireMock.stubFor(
-        WireMock.get(WireMock.urlMatching(String.format("/auth/admin/realms/%s/users/1", realm)))
+        WireMock.get(WireMock.urlMatching(String.format("/admin/realms/%s/users/1", realm)))
             .willReturn(
                 WireMock.aResponse()
                     .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
@@ -118,7 +118,7 @@ class GetUserDetailIntegrationTest extends BaseIntegrationTest {
         WireMock.get(
                 WireMock.urlMatching(
                     String.format(
-                        "/auth/admin/realms/%s/users/%s/role-mappings/realm", realm, userID)))
+                        "/admin/realms/%s/users/%s/role-mappings/realm", realm, userID)))
             .willReturn(
                 WireMock.aResponse()
                     .withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
index 7ab1130..901308c 100644 (file)
@@ -47,7 +47,7 @@ class ListAssignedRolesIntegrationTest extends BaseIntegrationTest {
     WireMock.stubFor(
         WireMock.get(
                 WireMock.urlMatching(
-                    String.format("/auth/admin/realms/%s/users/1/role-mappings/realm", realm)))
+                    String.format("/admin/realms/%s/users/1/role-mappings/realm", realm)))
             .willReturn(
                 WireMock.aResponse()
                     .withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
@@ -82,7 +82,7 @@ class ListAssignedRolesIntegrationTest extends BaseIntegrationTest {
     WireMock.stubFor(
         WireMock.get(
                 WireMock.urlMatching(
-                    String.format("/auth/admin/realms/%s/users/1/role-mappings/realm", realm)))
+                    String.format("/admin/realms/%s/users/1/role-mappings/realm", realm)))
             .willReturn(
                 WireMock.aResponse()
                     .withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
index 45290da..d8fb3c7 100644 (file)
@@ -48,7 +48,7 @@ class ListAvailableRolesIntegrationTest extends BaseIntegrationTest {
         WireMock.get(
                 WireMock.urlMatching(
                     String.format(
-                        "/auth/admin/realms/%s/users/1/role-mappings/realm/available", realm)))
+                        "/admin/realms/%s/users/1/role-mappings/realm/available", realm)))
             .willReturn(
                 WireMock.aResponse()
                     .withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
@@ -84,7 +84,7 @@ class ListAvailableRolesIntegrationTest extends BaseIntegrationTest {
         WireMock.get(
                 WireMock.urlMatching(
                     String.format(
-                        "/auth/admin/realms/%s/users/1/role-mappings/realm/available", realm)))
+                        "/admin/realms/%s/users/1/role-mappings/realm/available", realm)))
             .willReturn(
                 WireMock.aResponse()
                     .withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
index cad6697..d4d74da 100644 (file)
@@ -163,7 +163,7 @@ class ListUsersIntegrationTest extends BaseIntegrationTest {
   protected void mockGetUserCount(Integer userCount) {
     WireMock.stubFor(
         WireMock.get(
-                WireMock.urlMatching(String.format("/auth/admin/realms/%s/users/count", realm)))
+                WireMock.urlMatching(String.format("/admin/realms/%s/users/count", realm)))
             .willReturn(
                 WireMock.aResponse()
                     .withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
@@ -176,7 +176,7 @@ class ListUsersIntegrationTest extends BaseIntegrationTest {
         WireMock.get(
                 WireMock.urlMatching(
                     String.format(
-                        "/auth/admin/realms/%s/users\\?first=%s&max=%s", realm, first, max)))
+                        "/admin/realms/%s/users\\?first=%s&max=%s", realm, first, max)))
             .willReturn(
                 WireMock.aResponse()
                     .withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
@@ -185,7 +185,7 @@ class ListUsersIntegrationTest extends BaseIntegrationTest {
 
   protected void mockListRealmRoles(List<RoleKeycloakDto> roles) throws Exception {
     WireMock.stubFor(
-        WireMock.get(WireMock.urlMatching(String.format("/auth/admin/realms/%s/roles", realm)))
+        WireMock.get(WireMock.urlMatching(String.format("/admin/realms/%s/roles", realm)))
             .willReturn(
                 WireMock.aResponse()
                     .withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
@@ -197,7 +197,7 @@ class ListUsersIntegrationTest extends BaseIntegrationTest {
     WireMock.stubFor(
         WireMock.get(
                 WireMock.urlMatching(
-                    String.format("/auth/admin/realms/%s/roles/%s/users", realm, roleName)))
+                    String.format("/admin/realms/%s/roles/%s/users", realm, roleName)))
             .willReturn(
                 WireMock.aResponse()
                     .withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
@@ -228,7 +228,7 @@ class ListUsersIntegrationTest extends BaseIntegrationTest {
         WireMock.get(
                 WireMock.urlMatching(
                     String.format(
-                        "/auth/admin/realms/%s/users\\?first=%s&max=%s", realm, first, max)))
+                        "/admin/realms/%s/users\\?first=%s&max=%s", realm, first, max)))
             .willReturn(
                 WireMock.aResponse()
                     .withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
index 8f7b350..a69e969 100644 (file)
@@ -55,7 +55,7 @@ class UpdateAssignedRolesIntegrationTest extends BaseIntegrationTest {
         WireMock.get(
                 WireMock.urlMatching(
                     String.format(
-                        "/auth/admin/realms/%s/users/1/role-mappings/realm/available", realm)))
+                        "/admin/realms/%s/users/1/role-mappings/realm/available", realm)))
             .inScenario("test")
             .whenScenarioStateIs(Scenario.STARTED)
             .willReturn(
@@ -66,7 +66,7 @@ class UpdateAssignedRolesIntegrationTest extends BaseIntegrationTest {
     WireMock.stubFor(
         WireMock.get(
                 WireMock.urlMatching(
-                    String.format("/auth/admin/realms/%s/users/1/role-mappings/realm", realm)))
+                    String.format("/admin/realms/%s/users/1/role-mappings/realm", realm)))
             .inScenario("test")
             .whenScenarioStateIs(Scenario.STARTED)
             .willReturn(
@@ -77,7 +77,7 @@ class UpdateAssignedRolesIntegrationTest extends BaseIntegrationTest {
     WireMock.stubFor(
         WireMock.post(
                 WireMock.urlMatching(
-                    String.format("/auth/admin/realms/%s/users/1/role-mappings/realm", realm)))
+                    String.format("/admin/realms/%s/users/1/role-mappings/realm", realm)))
             .inScenario("test")
             .whenScenarioStateIs(Scenario.STARTED)
             .withRequestBody(WireMock.equalTo(objectMapper.writeValueAsString(keycloakRolesToAdd)))
@@ -87,7 +87,7 @@ class UpdateAssignedRolesIntegrationTest extends BaseIntegrationTest {
     WireMock.stubFor(
         WireMock.get(
                 WireMock.urlMatching(
-                    String.format("/auth/admin/realms/%s/users/1/role-mappings/realm", realm)))
+                    String.format("/admin/realms/%s/users/1/role-mappings/realm", realm)))
             .inScenario("test")
             .whenScenarioStateIs("rolesUpdated")
             .willReturn(
@@ -139,7 +139,7 @@ class UpdateAssignedRolesIntegrationTest extends BaseIntegrationTest {
         WireMock.get(
                 WireMock.urlMatching(
                     String.format(
-                        "/auth/admin/realms/%s/users/1/role-mappings/realm/available", realm)))
+                        "/admin/realms/%s/users/1/role-mappings/realm/available", realm)))
             .inScenario("test")
             .whenScenarioStateIs(Scenario.STARTED)
             .willReturn(
@@ -150,7 +150,7 @@ class UpdateAssignedRolesIntegrationTest extends BaseIntegrationTest {
     WireMock.stubFor(
         WireMock.get(
                 WireMock.urlMatching(
-                    String.format("/auth/admin/realms/%s/users/1/role-mappings/realm", realm)))
+                    String.format("/admin/realms/%s/users/1/role-mappings/realm", realm)))
             .inScenario("test")
             .whenScenarioStateIs(Scenario.STARTED)
             .willReturn(
@@ -161,7 +161,7 @@ class UpdateAssignedRolesIntegrationTest extends BaseIntegrationTest {
     WireMock.stubFor(
         WireMock.delete(
                 WireMock.urlMatching(
-                    String.format("/auth/admin/realms/%s/users/1/role-mappings/realm", realm)))
+                    String.format("/admin/realms/%s/users/1/role-mappings/realm", realm)))
             .inScenario("test")
             .whenScenarioStateIs(Scenario.STARTED)
             .withRequestBody(
@@ -171,7 +171,7 @@ class UpdateAssignedRolesIntegrationTest extends BaseIntegrationTest {
     WireMock.stubFor(
         WireMock.post(
                 WireMock.urlMatching(
-                    String.format("/auth/admin/realms/%s/users/1/role-mappings/realm", realm)))
+                    String.format("/admin/realms/%s/users/1/role-mappings/realm", realm)))
             .inScenario("test")
             .whenScenarioStateIs(Scenario.STARTED)
             .withRequestBody(WireMock.equalTo(objectMapper.writeValueAsString(keycloakRolesToAdd)))
@@ -181,7 +181,7 @@ class UpdateAssignedRolesIntegrationTest extends BaseIntegrationTest {
     WireMock.stubFor(
         WireMock.get(
                 WireMock.urlMatching(
-                    String.format("/auth/admin/realms/%s/users/1/role-mappings/realm", realm)))
+                    String.format("/admin/realms/%s/users/1/role-mappings/realm", realm)))
             .inScenario("test")
             .whenScenarioStateIs("rolesUpdated")
             .willReturn(
@@ -227,7 +227,7 @@ class UpdateAssignedRolesIntegrationTest extends BaseIntegrationTest {
         WireMock.get(
                 WireMock.urlMatching(
                     String.format(
-                        "/auth/admin/realms/%s/users/1/role-mappings/realm/available", realm)))
+                        "/admin/realms/%s/users/1/role-mappings/realm/available", realm)))
             .willReturn(
                 WireMock.aResponse()
                     .withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
@@ -236,7 +236,7 @@ class UpdateAssignedRolesIntegrationTest extends BaseIntegrationTest {
     WireMock.stubFor(
         WireMock.delete(
                 WireMock.urlMatching(
-                    String.format("/auth/admin/realms/%s/users/1/role-mappings/realm", realm)))
+                    String.format("/admin/realms/%s/users/1/role-mappings/realm", realm)))
             .withRequestBody(
                 WireMock.equalTo(objectMapper.writeValueAsString(keycloakRolesToRemove)))
             .willReturn(WireMock.aResponse().withStatus(HttpStatus.NO_CONTENT.value())));
@@ -244,7 +244,7 @@ class UpdateAssignedRolesIntegrationTest extends BaseIntegrationTest {
     WireMock.stubFor(
         WireMock.get(
                 WireMock.urlMatching(
-                    String.format("/auth/admin/realms/%s/users/1/role-mappings/realm", realm)))
+                    String.format("/admin/realms/%s/users/1/role-mappings/realm", realm)))
             .willReturn(
                 WireMock.aResponse()
                     .withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
@@ -289,7 +289,7 @@ class UpdateAssignedRolesIntegrationTest extends BaseIntegrationTest {
         WireMock.get(
                 WireMock.urlMatching(
                     String.format(
-                        "/auth/admin/realms/%s/users/1/role-mappings/realm/available", realm)))
+                        "/admin/realms/%s/users/1/role-mappings/realm/available", realm)))
             .inScenario("test")
             .whenScenarioStateIs(Scenario.STARTED)
             .willReturn(
@@ -300,7 +300,7 @@ class UpdateAssignedRolesIntegrationTest extends BaseIntegrationTest {
     WireMock.stubFor(
         WireMock.get(
                 WireMock.urlMatching(
-                    String.format("/auth/admin/realms/%s/users/1/role-mappings/realm", realm)))
+                    String.format("/admin/realms/%s/users/1/role-mappings/realm", realm)))
             .inScenario("test")
             .whenScenarioStateIs(Scenario.STARTED)
             .willReturn(
@@ -311,7 +311,7 @@ class UpdateAssignedRolesIntegrationTest extends BaseIntegrationTest {
     WireMock.stubFor(
         WireMock.post(
                 WireMock.urlMatching(
-                    String.format("/auth/admin/realms/%s/users/1/role-mappings/realm", realm)))
+                    String.format("/admin/realms/%s/users/1/role-mappings/realm", realm)))
             .inScenario("test")
             .whenScenarioStateIs(Scenario.STARTED)
             .withRequestBody(WireMock.equalTo(objectMapper.writeValueAsString(keycloakRolesToAdd)))
@@ -321,7 +321,7 @@ class UpdateAssignedRolesIntegrationTest extends BaseIntegrationTest {
     WireMock.stubFor(
         WireMock.get(
                 WireMock.urlMatching(
-                    String.format("/auth/admin/realms/%s/users/1/role-mappings/realm", realm)))
+                    String.format("/admin/realms/%s/users/1/role-mappings/realm", realm)))
             .inScenario("test")
             .whenScenarioStateIs("rolesUpdated")
             .willReturn(
@@ -375,7 +375,7 @@ class UpdateAssignedRolesIntegrationTest extends BaseIntegrationTest {
         WireMock.get(
                 WireMock.urlMatching(
                     String.format(
-                        "/auth/admin/realms/%s/users/1/role-mappings/realm/available", realm)))
+                        "/admin/realms/%s/users/1/role-mappings/realm/available", realm)))
             .inScenario("test")
             .whenScenarioStateIs(Scenario.STARTED)
             .willReturn(
@@ -386,7 +386,7 @@ class UpdateAssignedRolesIntegrationTest extends BaseIntegrationTest {
     WireMock.stubFor(
         WireMock.get(
                 WireMock.urlMatching(
-                    String.format("/auth/admin/realms/%s/users/1/role-mappings/realm", realm)))
+                    String.format("/admin/realms/%s/users/1/role-mappings/realm", realm)))
             .inScenario("test")
             .whenScenarioStateIs(Scenario.STARTED)
             .willReturn(
@@ -398,7 +398,7 @@ class UpdateAssignedRolesIntegrationTest extends BaseIntegrationTest {
     WireMock.stubFor(
         WireMock.delete(
                 WireMock.urlMatching(
-                    String.format("/auth/admin/realms/%s/users/1/role-mappings/realm", realm)))
+                    String.format("/admin/realms/%s/users/1/role-mappings/realm", realm)))
             .inScenario("test")
             .whenScenarioStateIs(Scenario.STARTED)
             .withRequestBody(
@@ -408,7 +408,7 @@ class UpdateAssignedRolesIntegrationTest extends BaseIntegrationTest {
     WireMock.stubFor(
         WireMock.post(
                 WireMock.urlMatching(
-                    String.format("/auth/admin/realms/%s/users/1/role-mappings/realm", realm)))
+                    String.format("/admin/realms/%s/users/1/role-mappings/realm", realm)))
             .inScenario("test")
             .whenScenarioStateIs(Scenario.STARTED)
             .withRequestBody(WireMock.equalTo(objectMapper.writeValueAsString(keycloakRolesToAdd)))
@@ -418,7 +418,7 @@ class UpdateAssignedRolesIntegrationTest extends BaseIntegrationTest {
     WireMock.stubFor(
         WireMock.get(
                 WireMock.urlMatching(
-                    String.format("/auth/admin/realms/%s/users/1/role-mappings/realm", realm)))
+                    String.format("/admin/realms/%s/users/1/role-mappings/realm", realm)))
             .inScenario("test")
             .whenScenarioStateIs("rolesUpdated")
             .willReturn(
index 0cce10a..3ce7d8b 100644 (file)
@@ -66,7 +66,7 @@ class UpdateUserIntegrationTest extends BaseIntegrationTest {
     final UserKeycloakDto keycloakRequest = new UserKeycloakDto().firstName("User1").enabled(false);
 
     WireMock.stubFor(
-        WireMock.put(WireMock.urlMatching(String.format("/auth/admin/realms/%s/users/1", realm)))
+        WireMock.put(WireMock.urlMatching(String.format("/admin/realms/%s/users/1", realm)))
             .withRequestBody(WireMock.equalTo(objectMapper.writeValueAsString(keycloakRequest)))
             .willReturn(
                 WireMock.aResponse()
@@ -102,7 +102,7 @@ class UpdateUserIntegrationTest extends BaseIntegrationTest {
     WireMock.stubFor(
         WireMock.put(
                 WireMock.urlMatching(
-                    String.format("/auth/admin/realms/%s/users/%s", realm, userId)))
+                    String.format("/admin/realms/%s/users/%s", realm, userId)))
             .withRequestBody(WireMock.equalTo(objectMapper.writeValueAsString(request)))
             .willReturn(
                 WireMock.aResponse().withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)));
@@ -112,7 +112,7 @@ class UpdateUserIntegrationTest extends BaseIntegrationTest {
     WireMock.stubFor(
         WireMock.get(
                 WireMock.urlMatching(
-                    String.format("/auth/admin/realms/%s/users/%s", realm, userId)))
+                    String.format("/admin/realms/%s/users/%s", realm, userId)))
             .willReturn(
                 WireMock.aResponse()
                     .withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
@@ -125,7 +125,7 @@ class UpdateUserIntegrationTest extends BaseIntegrationTest {
         WireMock.get(
                 WireMock.urlMatching(
                     String.format(
-                        "/auth/admin/realms/%s/users/%s/role-mappings/realm", realm, userID)))
+                        "/admin/realms/%s/users/%s/role-mappings/realm", realm, userID)))
             .willReturn(
                 WireMock.aResponse()
                     .withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE)
index cd38aeb..11634a8 100644 (file)
@@ -44,7 +44,7 @@ class UpdateUserPasswordIntegrationTest extends BaseIntegrationTest {
     WireMock.stubFor(
         WireMock.put(
                 WireMock.urlMatching(
-                    String.format("/auth/admin/realms/%s/users/1/reset-password", realm)))
+                    String.format("/admin/realms/%s/users/1/reset-password", realm)))
             .withRequestBody(WireMock.equalTo(objectMapper.writeValueAsString(keycloakRequest)))
             .willReturn(WireMock.aResponse().withStatus(204)));
 
@@ -73,7 +73,7 @@ class UpdateUserPasswordIntegrationTest extends BaseIntegrationTest {
     WireMock.stubFor(
         WireMock.put(
                 WireMock.urlMatching(
-                    String.format("/auth/admin/realms/%s/users/1/reset-password", realm)))
+                    String.format("/admin/realms/%s/users/1/reset-password", realm)))
             .withRequestBody(WireMock.equalTo(objectMapper.writeValueAsString(keycloakRequest)))
             .willReturn(
                 WireMock.aResponse()
index 2d53583..23602d1 100644 (file)
@@ -10,8 +10,8 @@ spring:
       client:
         provider:
           keycloak:
-            token-uri: http://localhost:${wiremock.server.port}/auth/realms/ONAP/protocol/openid-connect/token
-            jwk-set-uri: http://localhost:${wiremock.server.port}/auth/realms/ONAP/protocol/openid-connect/certs
+            token-uri: http://localhost:${wiremock.server.port}/realms/ONAP/protocol/openid-connect/token
+            jwk-set-uri: http://localhost:${wiremock.server.port}/realms/ONAP/protocol/openid-connect/certs
         registration:
           keycloak:
             provider: keycloak
@@ -20,7 +20,7 @@ spring:
             authorization-grant-type: client_credentials
       resourceserver:
         jwt:
-          jwk-set-uri: http://localhost:${wiremock.server.port}/auth/realms/ONAP/protocol/openid-connect/certs
+          jwk-set-uri: http://localhost:${wiremock.server.port}/realms/ONAP/protocol/openid-connect/certs
   jackson:
     serialization:
       FAIL_ON_EMPTY_BEANS: false
index 789e870..3e423e4 100644 (file)
@@ -11,8 +11,8 @@ spring:
       client:
         provider:
           keycloak:
-            token-uri: http://localhost:${wiremock.server.port}/auth/realms/ONAP/protocol/openid-connect/token
-            jwk-set-uri: http://localhost:${wiremock.server.port}/auth/realms/ONAP/protocol/openid-connect/certs
+            token-uri: http://localhost:${wiremock.server.port}/realms/ONAP/protocol/openid-connect/token
+            jwk-set-uri: http://localhost:${wiremock.server.port}/realms/ONAP/protocol/openid-connect/certs
         registration:
           keycloak:
             provider: keycloak
@@ -21,7 +21,7 @@ spring:
             authorization-grant-type: client_credentials
       resourceserver:
         jwt:
-          jwk-set-uri: http://localhost:${wiremock.server.port}/auth/realms/ONAP/protocol/openid-connect/certs
+          jwk-set-uri: http://localhost:${wiremock.server.port}/realms/ONAP/protocol/openid-connect/certs
   jackson:
     serialization:
       FAIL_ON_EMPTY_BEANS: false
index fab464f..387e423 100644 (file)
     }
   ],
   "attributes": {
-    "frontendUrl": "http://localhost:8080/auth/"
+    "frontendUrl": "http://localhost:8080/"
   }
 }
index cec50e9..607428c 100644 (file)
@@ -3,7 +3,7 @@
 # @name login
 @access_token = {{login.response.body.access_token}}
 @id_token = {{login.response.body.id_token}}
-POST http://localhost:8080/auth/realms/ONAP/protocol/openid-connect/token
+POST http://localhost:8080/realms/ONAP/protocol/openid-connect/token
 Content-Type: application/x-www-form-urlencoded
 Authorization: Basic admin:password
 
@@ -13,7 +13,7 @@ grant_type=password&scope=openid&client_id=portal-app&username=onap-admin&passwo
 # @name userinfo
 @user_id = {{userinfo.response.body.sub}}
 @user_name = {{userinfo.response.body.preferred_username}}
-GET http://localhost:8080/auth/realms/ONAP/protocol/openid-connect/userinfo
+GET http://localhost:8080/realms/ONAP/protocol/openid-connect/userinfo
 Authorization: Bearer {{access_token}}
 X-Auth-Identity: Bearer {{id_token}}
 
index 780fbe8..66284cd 100644 (file)
@@ -1,5 +1,5 @@
 # To be used with IntelliJ IDEA
-POST http://localhost:8080/auth/realms/ONAP/protocol/openid-connect/token
+POST http://localhost:8080/realms/ONAP/protocol/openid-connect/token
 Content-Type: application/x-www-form-urlencoded
 
 client_id=portal-app&client_secret=&scope=openid&grant_type=password&username=onap-admin&password=password
@@ -10,7 +10,7 @@ client_id=portal-app&client_secret=&scope=openid&grant_type=password&username=on
 
 ###
 
-GET http://localhost:8080/auth/realms/ONAP/protocol/openid-connect/userinfo
+GET http://localhost:8080/realms/ONAP/protocol/openid-connect/userinfo
 Authorization: Bearer {{access_token}}
 X-Auth-Identity: Bearer {{id_token}}
 
index 2ff3974..cca9c06 100644 (file)
@@ -71,7 +71,7 @@ public class KeycloakConfig extends AbstractClientConfig<ErrorResponseKeycloakDt
 
     // Extract service name and version from BasePath
     String urlBasePathPrefix =
-        String.format("%s/auth/admin/realms/%s", bffConfig.getKeycloakUrl(), bffConfig.getRealm());
+        String.format("%s/admin/realms/%s", bffConfig.getKeycloakUrl(), bffConfig.getRealm());
 
     return apiConstructor.apply(apiClient.setBasePath(urlBasePathPrefix));
   }