1. Container starten
docker compose up -d keycloak
docker compose up -d postgres rabbitmq wiremock mailhog prometheus grafana
2. Runtime starten
cd maven-project
mvn -pl runtime spring-boot:run
3. Token holen
./scripts/security/get-keycloak-token.sh order-admin admin
Oder direkt nur Access Token extrahieren:
TOKEN="$(
curl -s -X POST "http://localhost:8082/realms/order-platform/protocol/openid-connect/token" -H "Content-Type: application/x-www-form-urlencoded" -d "client_id=order-runtime" -d "grant_type=password" -d "username=order-admin" -d "password=admin" | python -c "import sys,json; print(json.load(sys.stdin)['access_token'])"
)"
4. Geschützten REST Flow aufrufen
curl -i -X POST "http://localhost:8080/api/orders/ORD-3001/accept" -H "Authorization: Bearer ${TOKEN}"
Erwartung:
HTTP/1.1 200
5. Negativtest
Mit order-reader darf POST /api/orders/{id}/accept nicht funktionieren.
./scripts/security/get-keycloak-token.sh order-reader reader
Erwartung:
HTTP/1.1 403