From 1a23a1bcdf17ba4cf1cafb8e65babd1ad8666e59 Mon Sep 17 00:00:00 2001 From: Fiete Ostkamp Date: Mon, 4 Sep 2023 16:32:37 +0200 Subject: Adjust mongo related environment variables in bff docker-compose file - services are expecting MONGO_ prefix instead of _ for mongo related settings - rename requests file Issue-ID: PORTALNG-55 Change-Id: I371485e5430955907de7ee58c60fd91dd021c2f2 Signed-off-by: Fiete Ostkamp --- .../bff/users/GetUserDetailIntegrationTest.java | 3 +- development/.env | 21 ++-- development/docker-compose.yml | 28 ++--- development/requests-idea.http | 119 +++++++++++++++++++++ development/requests.http | 119 --------------------- 5 files changed, 145 insertions(+), 145 deletions(-) create mode 100644 development/requests-idea.http delete mode 100644 development/requests.http diff --git a/app/src/test/java/org/onap/portalng/bff/users/GetUserDetailIntegrationTest.java b/app/src/test/java/org/onap/portalng/bff/users/GetUserDetailIntegrationTest.java index 9c620bb..7360a63 100644 --- a/app/src/test/java/org/onap/portalng/bff/users/GetUserDetailIntegrationTest.java +++ b/app/src/test/java/org/onap/portalng/bff/users/GetUserDetailIntegrationTest.java @@ -52,7 +52,8 @@ class GetUserDetailIntegrationTest extends BaseIntegrationTest { .withHeader("Content-Type", MediaType.APPLICATION_JSON_VALUE) .withBody(objectMapper.writeValueAsString(keycloakUser)))); - final RoleKeycloakDto keycloackRole = new RoleKeycloakDto().id(randomUUID()).name("portal_admin"); + final RoleKeycloakDto keycloackRole = + new RoleKeycloakDto().id(randomUUID()).name("portal_admin"); mockAssignedRoles(keycloakUser.getId(), List.of(keycloackRole)); final UserResponseApiDto response = diff --git a/development/.env b/development/.env index 2775969..2a2a73d 100644 --- a/development/.env +++ b/development/.env @@ -23,18 +23,17 @@ MONGO_VERSION=latest # preferences PREFERENCES_IMAGE_NAME=preferences PREFERENCES_IMAGE_TAG=latest -PREFERENCES_USERNAME=root -PREFERENCES_PASSWORD=password -PREFERENCES_DATABASE=Preferences -PREFERENCES_HOST=mongo-preferences -PREFERENCES_PORT=27017 +PREFERENCES_MONGO_USERNAME=root +PREFERENCES_MONGO_PASSWORD=password +PREFERENCES_MONGO_DATABASE=Preferences +PREFERENCES_MONGO_HOST=mongo-preferences +PREFERENCES_MONGO_PORT=27017 # history HISTORY_IMAGE_NAME=history HISTORY_IMAGE_TAG=latest -HISTORY_USERNAME=root -HISTORY_PASSWORD=password -HISTORY_DATABASE=History -HISTORY_HOST=mongo-history -HISTORY_PORT=27017 - +HISTORY_MONGO_USERNAME=root +HISTORY_MONGO_PASSWORD=password +HISTORY_MONGO_DATABASE=History +HISTORY_MONGO_HOST=mongo-history +HISTORY_MONGO_PORT=27017 \ No newline at end of file diff --git a/development/docker-compose.yml b/development/docker-compose.yml index 1082419..1e7d282 100644 --- a/development/docker-compose.yml +++ b/development/docker-compose.yml @@ -37,41 +37,41 @@ services: container_name: mongo-history image: "${MONGO_IMAGE}:${MONGO_VERSION}" environment: - MONGO_INITDB_ROOT_USERNAME: ${HISTORY_USERNAME} - MONGO_INITDB_ROOT_PASSWORD: ${HISTORY_PASSWORD} + MONGO_INITDB_ROOT_USERNAME: ${HISTORY_MONGO_USERNAME} + MONGO_INITDB_ROOT_PASSWORD: ${HISTORY_MONGO_PASSWORD} history: container_name: history image: "${IMAGE_REPOSITORY}/${HISTORY_IMAGE_NAME}:${HISTORY_IMAGE_TAG}" ports: - 9002:9002 environment: - HISTORY_USERNAME: ${HISTORY_USERNAME} - HISTORY_PASSWORD: ${HISTORY_PASSWORD} - HISTORY_DATABASE: ${HISTORY_DATABASE} + MONGO_USERNAME: ${HISTORY_MONGO_USERNAME} + MONGO_PASSWORD: ${HISTORY_MONGO_PASSWORD} + MONGO_DATABASE: ${HISTORY_MONGO_DATABASE} + MONGO_HOST: ${HISTORY_MONGO_HOST} + MONGO_PORT: ${HISTORY_MONGO_PORT} KEYCLOAK_URL: ${KEYCLOAK_URL} KEYCLOAK_REALM: ${KEYCLOAK_REALM} - HISTORY_HOST: ${HISTORY_HOST} - HISTORY_PORT: ${HISTORY_PORT} depends_on: - mongo-history mongo-preferences: container_name: mongo-preferences image: "${MONGO_IMAGE}:${MONGO_VERSION}" environment: - MONGO_INITDB_ROOT_USERNAME: ${PREFERENCES_USERNAME} - MONGO_INITDB_ROOT_PASSWORD: ${PREFERENCES_PASSWORD} + MONGO_INITDB_ROOT_USERNAME: ${PREFERENCES_MONGO_USERNAME} + MONGO_INITDB_ROOT_PASSWORD: ${PREFERENCES_MONGO_PASSWORD} preferences: container_name: preferences image: "${IMAGE_REPOSITORY}/${PREFERENCES_IMAGE_NAME}:${PREFERENCES_IMAGE_TAG}" ports: - 9001:9001 environment: - PREFERENCES_USERNAME: ${PREFERENCES_USERNAME} - PREFERENCES_PASSWORD: ${PREFERENCES_PASSWORD} - PREFERENCES_DATABASE: ${PREFERENCES_DATABASE} + MONGO_USERNAME: ${PREFERENCES_MONGO_USERNAME} + MONGO_PASSWORD: ${PREFERENCES_MONGO_PASSWORD} + MONGO_DATABASE: ${PREFERENCES_MONGO_DATABASE} + MONGO_HOST: ${PREFERENCES_MONGO_HOST} + MONGO_PORT: ${PREFERENCES_MONGO_PORT} KEYCLOAK_URL: ${KEYCLOAK_URL} KEYCLOAK_REALM: ${KEYCLOAK_REALM} - PREFERENCES_HOST: ${PREFERENCES_HOST} - PREFERENCES_PORT: ${PREFERENCES_PORT} depends_on: - mongo-preferences \ No newline at end of file diff --git a/development/requests-idea.http b/development/requests-idea.http new file mode 100644 index 0000000..780fbe8 --- /dev/null +++ b/development/requests-idea.http @@ -0,0 +1,119 @@ +# To be used with IntelliJ IDEA +POST http://localhost:8080/auth/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 +> {% + client.global.set("access_token", response.body.access_token); + client.global.set("id_token", response.body.id_token); + %} + +### + +GET http://localhost:8080/auth/realms/ONAP/protocol/openid-connect/userinfo +Authorization: Bearer {{access_token}} +X-Auth-Identity: Bearer {{id_token}} + +> {% + client.global.set("user_id", response.body.sub); + client.global.set("user_name", response.body.preferred_username); + %} + +### + +POST http://localhost:9080/preferences +X-Request-Id: {{$uuid}} +Accept: application/json +Content-Type: application/json +Authorization: Bearer {{access_token}} +X-Auth-Identity: Bearer {{id_token}} + + +{ + "properties": { + "dashboard": { + "apps": { + "availableTiles": [ + { + "type": "USER_LAST_ACTION_TILE", + "displayed": false + } + ], + "lastUserAction": { + "interval": "1H", + "filterType": "ALL" + } + } + } + } +} + +### + +GET http://localhost:9080/preferences +Accept: application/json +Authorization: Bearer {{access_token}} +X-Auth-Identity: Bearer {{id_token}} +X-Request-Id: {{$uuid}} + +### + +POST http://localhost:9080/actions/{{user_id}} +X-Request-Id: {{$uuid}} +Accept: application/json +Authorization: Bearer {{access_token}} +X-Auth-Identity: Bearer {{id_token}} +Content-Type: application/json + +{ + "userId": "{{user_id}}", + "actionCreatedAt": "{{$timestamp}}", + "action": { + "type": "DELETE", + "entity": "USERADMINISTRATION", + "entityParams": { + "userName": "uli", + "userId": "{{$randomInt}}" + } + } +} + +### + +GET http://localhost:9080/actions/{{user_id}}?page=1&pageSize=10&showLastHours=1 +X-Request-Id: {{$uuid}} +Accept: application/json +Authorization: Bearer {{access_token}} +X-Auth-Identity: Bearer {{id_token}} + +### + +GET http://localhost:9080/actions?page=1&pageSize=10&showLastHours=1 +X-Request-Id: {{$uuid}} +Accept: application/json +Authorization: Bearer {{access_token}} +X-Auth-Identity: Bearer {{id_token}} + +### requests to keycloak + +GET http://localhost:9080/users +X-Request-Id: {{$uuid}} +Accept: application/json +Authorization: Bearer {{access_token}} +X-Auth-Identity: Bearer {{id_token}} + +### + +GET http://localhost:9080/users/{{user_id}} +X-Request-Id: {{$uuid}} +Accept: application/json +Authorization: Bearer {{access_token}} +X-Auth-Identity: Bearer {{id_token}} + +### + +GET http://localhost:9080/users/{{user_id}}/roles +X-Request-Id: {{$uuid}} +Accept: application/json +Authorization: Bearer {{access_token}} +X-Auth-Identity: Bearer {{id_token}} diff --git a/development/requests.http b/development/requests.http deleted file mode 100644 index 6b9d12c..0000000 --- a/development/requests.http +++ /dev/null @@ -1,119 +0,0 @@ -# To be used with IntelliJ. Use the requests-code.http with the REST Client Extension if you are using VSCode -POST http://localhost:8080/auth/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 -> {% - client.global.set("access_token", response.body.access_token); - client.global.set("id_token", response.body.id_token); - %} - -### - -GET http://localhost:8080/auth/realms/ONAP/protocol/openid-connect/userinfo -Authorization: Bearer {{access_token}} -X-Auth-Identity: Bearer {{id_token}} - -> {% - client.global.set("user_id", response.body.sub); - client.global.set("user_name", response.body.preferred_username); - %} - -### - -POST http://localhost:9080/preferences -X-Request-Id: {{$uuid}} -Accept: application/json -Content-Type: application/json -Authorization: Bearer {{access_token}} -X-Auth-Identity: Bearer {{id_token}} - - -{ - "properties": { - "dashboard": { - "apps": { - "availableTiles": [ - { - "type": "USER_LAST_ACTION_TILE", - "displayed": false - } - ], - "lastUserAction": { - "interval": "1H", - "filterType": "ALL" - } - } - } - } -} - -### - -GET http://localhost:9080/preferences -Accept: application/json -Authorization: Bearer {{access_token}} -X-Auth-Identity: Bearer {{id_token}} -X-Request-Id: {{$uuid}} - -### - -POST http://localhost:9080/actions/{{user_id}} -X-Request-Id: {{$uuid}} -Accept: application/json -Authorization: Bearer {{access_token}} -X-Auth-Identity: Bearer {{id_token}} -Content-Type: application/json - -{ - "userId": "{{user_id}}", - "actionCreatedAt": "{{$timestamp}}", - "action": { - "type": "DELETE", - "entity": "USERADMINISTRATION", - "entityParams": { - "userName": "uli", - "userId": "{{$randomInt}}" - } - } -} - -### - -GET http://localhost:9080/actions/{{user_id}}?page=1&pageSize=10&showLastHours=1 -X-Request-Id: {{$uuid}} -Accept: application/json -Authorization: Bearer {{access_token}} -X-Auth-Identity: Bearer {{id_token}} - -### - -GET http://localhost:9080/actions?page=1&pageSize=10&showLastHours=1 -X-Request-Id: {{$uuid}} -Accept: application/json -Authorization: Bearer {{access_token}} -X-Auth-Identity: Bearer {{id_token}} - -### requests to keycloak - -GET http://localhost:9080/users -X-Request-Id: {{$uuid}} -Accept: application/json -Authorization: Bearer {{access_token}} -X-Auth-Identity: Bearer {{id_token}} - -### - -GET http://localhost:9080/users/{{user_id}} -X-Request-Id: {{$uuid}} -Accept: application/json -Authorization: Bearer {{access_token}} -X-Auth-Identity: Bearer {{id_token}} - -### - -GET http://localhost:9080/users/{{user_id}}/roles -X-Request-Id: {{$uuid}} -Accept: application/json -Authorization: Bearer {{access_token}} -X-Auth-Identity: Bearer {{id_token}} -- cgit 1.2.3-korg