diff options
author | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2023-07-11 08:44:51 +0000 |
---|---|---|
committer | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2023-07-11 08:44:51 +0000 |
commit | b146259516cc90cc9084bdf2f69c358b896cfdf7 (patch) | |
tree | cfbe215be6415cd2ffb0f03d23eaae26b3886bf1 /development | |
parent | 24a8c0fc70f6493bd7f07f12c723b7e2acf3f558 (diff) |
history repo code is missing
Issue-ID: PORTALNG-8
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
Change-Id: I01f1789eb840661115bfd806a0622d02666100c0
Diffstat (limited to 'development')
-rw-r--r-- | development/.env | 15 | ||||
-rw-r--r-- | development/config/onap-realm.json | 70 | ||||
-rw-r--r-- | development/docker-compose.yml | 40 | ||||
-rw-r--r-- | development/request.http | 63 | ||||
-rwxr-xr-x | development/run.sh | 7 | ||||
-rwxr-xr-x | development/stop.sh | 8 |
6 files changed, 203 insertions, 0 deletions
diff --git a/development/.env b/development/.env new file mode 100644 index 0000000..ff65652 --- /dev/null +++ b/development/.env @@ -0,0 +1,15 @@ +KEYCLOAK_IMAGE=quay.io/keycloak/keycloak +KEYCLOAK_VERSION=18.0.2-legacy +KEYCLOAK_USER=admin +KEYCLOAK_PASSWORD=password +KEYCLOAK_DB=keycloak +KEYCLOAK_DB_USER=keycloak +KEYCLOAK_DB_PASSWORD=password +POSTGRES_IMAGE=postgres +POSTGRES_VERSION=15rc1 +MONGO_IMAGE=mongo +MONGO_VERSION=latest +MONGO_USER=root +MONGO_PASSWORD=password + + diff --git a/development/config/onap-realm.json b/development/config/onap-realm.json new file mode 100644 index 0000000..75bdb6a --- /dev/null +++ b/development/config/onap-realm.json @@ -0,0 +1,70 @@ +{ + "id": "ONAP", + "realm": "ONAP", + "enabled": true, + "clients": [ + { + "clientId": "portal-app", + "surrogateAuthRequired": false, + "enabled": true, + "alwaysDisplayInConsole": false, + "clientAuthenticatorType": "client-secret", + "redirectUris": [], + "webOrigins": [], + "notBefore": 0, + "bearerOnly": false, + "consentRequired": false, + "standardFlowEnabled": true, + "implicitFlowEnabled": false, + "directAccessGrantsEnabled": true, + "serviceAccountsEnabled": false, + "publicClient": true, + "frontchannelLogout": false, + "protocol": "openid-connect", + "attributes": { + "backchannel.logout.session.required": "true", + "backchannel.logout.revoke.offline.tokens": "false" + }, + "authenticationFlowBindingOverrides": {}, + "fullScopeAllowed": true, + "nodeReRegistrationTimeout": -1, + "defaultClientScopes": [ + "web-origins", + "acr", + "profile", + "roles", + "email" + ], + "optionalClientScopes": [ + "address", + "phone", + "offline_access", + "microprofile-jwt" + ] + } + ], + "users": [ + { + "createdTimestamp": 1664965113698, + "username": "onap-admin", + "enabled": true, + "totp": false, + "emailVerified": false, + "credentials": [ + { + "type": "password", + "createdDate": 1664965134586, + "secretData" : "{\"value\":\"nD4K4x8HEgk6xlWIAgzZOE+EOjdbovJfEa7N3WXwIMCWCfdXpn7Riys7hZhI1NbKcc9QPI9j8LQB/JSuZVcXKA==\",\"salt\":\"T8X9A9tT2cyLvEjHFo+zuQ==\",\"additionalParameters\":{}}", + "credentialData" : "{\"hashIterations\":27500,\"algorithm\":\"pbkdf2-sha256\",\"additionalParameters\":{}}" + } + ], + "disableableCredentialTypes": [], + "requiredActions": [], + "realmRoles": [ + "default-roles-onap" + ], + "notBefore": 0, + "groups": [] + } + ] +}
\ No newline at end of file diff --git a/development/docker-compose.yml b/development/docker-compose.yml new file mode 100644 index 0000000..b08f7d5 --- /dev/null +++ b/development/docker-compose.yml @@ -0,0 +1,40 @@ +version: '3' + +volumes: + postgres_data: + driver: local + +services: + postgres: + image: "${POSTGRES_IMAGE}:${POSTGRES_VERSION}" + volumes: + - postgres_data:/var/lib/postgresql/data + environment: + POSTGRES_DB: ${KEYCLOAK_DB} + POSTGRES_USER: ${KEYCLOAK_DB_USER} + POSTGRES_PASSWORD: ${KEYCLOAK_DB_PASSWORD} + keycloak: + image: "${KEYCLOAK_IMAGE}:${KEYCLOAK_VERSION}" + environment: + DB_VENDOR: POSTGRES + DB_ADDR: postgres + DB_DATABASE: ${KEYCLOAK_DB} + DB_USER: ${KEYCLOAK_DB_USER} + DB_SCHEMA: public + DB_PASSWORD: ${KEYCLOAK_DB_PASSWORD} + KEYCLOAK_USER: ${KEYCLOAK_USER} + KEYCLOAK_PASSWORD: ${KEYCLOAK_PASSWORD} + KEYCLOAK_IMPORT: /config/onap-realm.json + ports: + - 8080:8080 + volumes: + - ./config:/config + depends_on: + - postgres + mongo: + image: "${MONGO_IMAGE}:${MONGO_VERSION}" + ports: + - 27017:27017 + environment: + MONGO_INITDB_ROOT_USERNAME: ${MONGO_USER} + MONGO_INITDB_ROOT_PASSWORD: ${MONGO_PASSWORD} diff --git a/development/request.http b/development/request.http new file mode 100644 index 0000000..72bbb79 --- /dev/null +++ b/development/request.http @@ -0,0 +1,63 @@ + +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); + %} + +### + +POST http://localhost:9002/v1/actions/{{user_id}} +Accept: application/json +Authorization: Bearer {{access_token}} +X-Auth-Identity: Bearer {{id_token}} +X-Request-Id: {{$uuid}} +Content-Type: application/json + +{ + "userId": "{{user_id}}", + "actionCreatedAt": "{{$timestamp}}", + "action": { + "type": "DELETE", + "entity": "USERADMINISTRATION", + "entityParams": { + "userName": "uli", + "userId": "{{$randomInt}}" + } + } +} + +### + +GET http://localhost:9002/v1/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:9002/v1/actions?page=1&pageSize=10&showLastHours=1 +X-Request-Id: {{$uuid}} +Accept: application/json +Authorization: Bearer {{access_token}} +X-Auth-Identity: Bearer {{id_token}} + +### + + + + diff --git a/development/run.sh b/development/run.sh new file mode 100755 index 0000000..4f90ee5 --- /dev/null +++ b/development/run.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +docker compose -f "$SCRIPT_DIR/docker-compose.yml" up -d + +cd $SCRIPT_DIR/.. +SPRING_PROFILES_ACTIVE=local ./gradlew bootRun
\ No newline at end of file diff --git a/development/stop.sh b/development/stop.sh new file mode 100755 index 0000000..9752a7f --- /dev/null +++ b/development/stop.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +# shutdown all docker container +docker compose -f "$SCRIPT_DIR/docker-compose.yml" down -v + +cd $SCRIPT_DIR/.. +./gradlew -stop
\ No newline at end of file |