Skip to content

Commit

Permalink
use context path for keycloak.js
Browse files Browse the repository at this point in the history
Yes, I know that Keycloak proper has stopped serving the keycloak.js file. But
since I want to stay somewhat backward-compatible regarding old Keycloak
versions, I should still ensure correctness.

Signed-off-by: Kai Helbig <[email protected]>
  • Loading branch information
ostrya committed Jan 18, 2025
1 parent 7d8959f commit ff0b286
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,19 @@ URI getBaseUrl() {
}
}

@Nonnull
public URI getContextPath(String path) {
return getBaseUrl().resolve(contextPath + path);
}

@Nonnull
public URI getIssuer() {
return getBaseUrl().resolve(contextPath + ISSUER_PATH + realm);
return getContextPath(ISSUER_PATH + realm);
}

@Nonnull
public URI getIssuerPath() {
return getBaseUrl().resolve(contextPath + ISSUER_PATH + realm + "/");
return getContextPath(ISSUER_PATH + realm + "/");
}

@Nonnull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ Router provideRouter(
.method(HttpMethod.POST)
.handler(logoutRoute);
router.get(routing.getOutOfBandLoginLoginEndpoint().getPath()).handler(outOfBandLoginRoute);
router.route("/auth/js/keycloak.js").handler(keycloakJsRoute);
router.route(routing.getContextPath("/js/keycloak.js").getPath()).handler(keycloakJsRoute);
return router;
}

Expand Down

0 comments on commit ff0b286

Please sign in to comment.