Run Service
docker-compose up --build -d
Stop Service
docker-compose down
Initializer FGA Service
newman run fga-initializer.postman_collection.json --export-globals ./target/generated-ids.json
Parse IDs into .env
file
jq -r '.values | map("export \(.key|sub("-";"_"; "g")|ascii_upcase)=\(.value|tostring)")|.[]' ./target/generated-ids.json > ./target/.spring-env
Load Env variables
source .spring-env
Run application
mvnw spring-boot:run
Debug mode
mvnw spring-boot:run -Dspring-boot.run.jvmArguments="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"
Compile Application
mvnw clean compile
mvnw verify
Running all tests
mvnw test
Running specific test class
mvnw -Dtest=RouteGatewayFilterIntegrationTest test
Testing Routes using default Predicates/Filters
# Test Route: 'code_rewrite_route'
curl -v 'http://localhost:8080/foo/ip' -H 'host: pedro.rewrite.org'
# Test Route: 'yml_header_path_rewrite_route'
curl -v 'http://localhost:8080/self/ip' -H 'X-Request-Id: 123'
Testing Routes using personalized Predicates/Filters
ApiVersionValidation
# Test Route: 'code_path_rewrite_apiversion_route'
# > Expected: 200
curl -v 'http://localhost:8080/version/ip' -H 'api-version: 4.5.0'
# > Expected: 403
curl -v 'http://localhost:8080/version/ip' -H 'api-version: 1.5.0'
# Test Route: 'httpbin_apiversionfilter_v1_route' (Default Header)
# > Expected: 200
curl -v 'http://localhost:8080/v1/ip' -H 'api-version: 4.5.0'
# > Expected: 403
curl -v 'http://localhost:8080/v1/ip' -H 'api-version: 1.5.0'
# Test Route: 'httpbin_apiversionfilter_v1_route' (Configured Header)
# > Expected: 200
curl -v 'http://localhost:8080/v1/ip' -H 'ApiVersion: 4.5.0'
# > Expected: 403
curl -v 'http://localhost:8080/v1/ip' -H 'ApiVersion: 1.5.0'
TraceRequest
# Test Route: 'httpbin_trace_route'
# > Expected: 200
curl -v 'http://localhost:8080/trace/ip' -H 'dummy: trace'