8942 - port in location header is -1 when doing SAML global logout
This commit is contained in:
parent
c474e770fe
commit
24e7ab6748
1 changed files with 7 additions and 1 deletions
|
@ -173,7 +173,13 @@ class KeycloakHttpServerAuthenticationMechanism implements HttpServerAuthenticat
|
||||||
String path = uri.getPath();
|
String path = uri.getPath();
|
||||||
String relativePath = exchange.getRequest().getRelativePath();
|
String relativePath = exchange.getRequest().getRelativePath();
|
||||||
String contextPath = path.substring(0, path.indexOf(relativePath));
|
String contextPath = path.substring(0, path.indexOf(relativePath));
|
||||||
String loc = exchange.getURI().getScheme() + "://" + exchange.getURI().getHost() + ":" + exchange.getURI().getPort() + contextPath + location;
|
String loc;
|
||||||
|
int port = uri.getPort();
|
||||||
|
if (port == -1) {
|
||||||
|
loc = uri.getScheme() + "://" + uri.getHost() + contextPath + location;
|
||||||
|
} else {
|
||||||
|
loc = uri.getScheme() + "://" + uri.getHost() + ":" + port + contextPath + location;
|
||||||
|
}
|
||||||
exchange.getResponse().setHeader("Location", loc);
|
exchange.getResponse().setHeader("Location", loc);
|
||||||
}
|
}
|
||||||
exchange.getResponse().setStatus(HttpServletResponse.SC_FOUND);
|
exchange.getResponse().setStatus(HttpServletResponse.SC_FOUND);
|
||||||
|
|
Loading…
Reference in a new issue