fix(gateway-api): allow additional path in Keycloak auth `authServerUrl`
The previous implementation did not supported URL like `http://localhost:8080/additional/path`.
The additional path was always replaced.
Closes:
MODIFY
gateway/platforms/vertx3/vertx3/src/main/java/io/apiman/gateway/platforms/vertx3/api/auth/KeycloakOAuthFactory.java
gateway/platforms/vertx3/vertx3/src/main/java/io/apiman/gateway/platforms/vertx3/api/auth/KeycloakOAuthFactory.java
@@ -25,7 +25,6 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.text.MessageFormat;
import java.util.Arrays;
-import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
@@ -185,8 +184,11 @@ public class KeycloakOAuthFactory {
URI uri;
try {
- uri = new URIBuilder(authServer)
- .setPathSegments(List.of("realms", realmName))
+ // Parse out initial segments
+ URIBuilder builder = new URIBuilder(authServer);
+ // Prepend builder.getPath to allow us to use URI with a non-zero path element (e.g. foo.com/keycloak)
+ uri = builder
+ .setPathSegments(builder.getPath(), "realms", realmName)
.build();
} catch (URISyntaxException e) {
throw new RuntimeException(e);

fix(gateway-api): allow additional path in Keycloak auth `authServerUrl`

The previous implementation did not supported URL like `http://localhost:8080/additional/path`.
The additional path was always replaced.

Closes: #2402

Co-Authored-By: Florian Volk <florian.volk@scheer-group.com>