private static String buildIssuerWithRealm(String issuerServer, String realmName) {
        try {
            URIBuilder builder = new URIBuilder(issuerServer);

            List<String> pathSegments = Stream.of(builder.getPath(), "realms", realmName)
                    .filter(Objects::nonNull)
                    .collect(Collectors.toList());

           URI uri = builder
                    .setPathSegments(pathSegments)
                    .build();

           return uri.toString();
        } catch (URISyntaxException e) {
            throw new RuntimeException(e);
        }
    }
@author Marc Savy {@literal <marc@rhymewithgravy.com>}
gateway/platforms/vertx3/vertx3/src/main/java/io/apiman/gateway/platforms/vertx3/api/auth/KeycloakOAuthFactory.java