Skip to content

Commit

Permalink
[KEYCLOAK-3261] - Properly handle apps deployed at the ROOT context
Browse files Browse the repository at this point in the history
  • Loading branch information
pedroigor committed Jan 23, 2017
1 parent bd271b2 commit 13e92cd
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,7 @@ private PathConfig resolvePathConfig(PathConfig originalConfig, Request request)
}

private String getPath(Request request) {
String pathInfo = URI.create(request.getURI()).getPath().substring(1);
return pathInfo.substring(pathInfo.indexOf('/'), pathInfo.length());
return request.getRelativePath();
}

private Set<String> getRequiredScopes(PathConfig pathConfig, Request request) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ public String getURI() {
return requestContext.getUriInfo().getRequestUri().toString();
}

@Override
public String getRelativePath() {
return requestContext.getUriInfo().getPath();
}

@Override
public boolean isSecure() {
return securityContext.isSecure();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ public String getURI() {
return servletRequest.getRequestURL().toString();
}

@Override
public String getRelativePath() {
return servletRequest.getServletPath();
}

@Override
public boolean isSecure() {
return servletRequest.isSecure();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ public String getURI() {
return buf.toString();
}

@Override
public String getRelativePath() {
return request.getServletPath();
}

@Override
public boolean isSecure() {
return request.isSecure();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ interface Request {
*/
String getURI();

/**
* Get the request relative path.
*
* @return the request relative path
*/
String getRelativePath();

/**
* HTTPS?
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ public String getURI() {
return buf.toString();
}

@Override
public String getRelativePath() {
return request.getServletPath();
}

@Override
public String getFirstParam(String param) {
return request.getParameter(param);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ public String getURI() {
return buf.toString();
}

@Override
public String getRelativePath() {
return request.getServletPath();
}

@Override
public boolean isSecure() {
return request.isSecure();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ public String getURI() {
return buf.toString();
}

@Override
public String getRelativePath() {
return request.getServletPath();
}

@Override
public boolean isSecure() {
return request.isSecure();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ public String getURI() {
return uriBuilder.build().toString();
}

@Override
public String getRelativePath() {
return exchange.getRelativePath();
}

@Override
public boolean isSecure() {
String protocol = exchange.getRequestScheme();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ public String getURI() {
return servletRequest.getRequestURL().toString();
}

@Override
public String getRelativePath() {
return servletRequest.getServletPath();
}

@Override
public boolean isSecure() {
return servletRequest.isSecure();
Expand Down

0 comments on commit 13e92cd

Please sign in to comment.