Merge pull request #3787 from pedroigor/KEYCLOAK-3261
[KEYCLOAK-3261] - Properly handle apps deployed at the ROOT context
This commit is contained in:
commit
04c4110f76
10 changed files with 48 additions and 2 deletions
|
@ -253,8 +253,7 @@ public abstract class AbstractPolicyEnforcer {
|
|||
}
|
||||
|
||||
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) {
|
||||
|
|
|
@ -66,6 +66,11 @@ public class JaxrsHttpFacade implements OIDCHttpFacade {
|
|||
return requestContext.getUriInfo().getRequestUri().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRelativePath() {
|
||||
return requestContext.getUriInfo().getPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSecure() {
|
||||
return securityContext.isSecure();
|
||||
|
|
|
@ -218,6 +218,11 @@ public class ServletOAuthClient extends KeycloakDeploymentDelegateOAuthClient {
|
|||
return servletRequest.getRequestURL().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRelativePath() {
|
||||
return servletRequest.getServletPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSecure() {
|
||||
return servletRequest.isSecure();
|
||||
|
|
|
@ -70,6 +70,11 @@ class WrappedHttpServletRequest implements Request {
|
|||
return buf.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRelativePath() {
|
||||
return request.getServletPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSecure() {
|
||||
return request.isSecure();
|
||||
|
|
|
@ -43,6 +43,13 @@ public interface HttpFacade {
|
|||
*/
|
||||
String getURI();
|
||||
|
||||
/**
|
||||
* Get the request relative path.
|
||||
*
|
||||
* @return the request relative path
|
||||
*/
|
||||
String getRelativePath();
|
||||
|
||||
/**
|
||||
* HTTPS?
|
||||
*
|
||||
|
|
|
@ -78,6 +78,11 @@ public class JettyHttpFacade implements HttpFacade {
|
|||
return buf.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRelativePath() {
|
||||
return request.getServletPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFirstParam(String param) {
|
||||
return request.getParameter(param);
|
||||
|
|
|
@ -65,6 +65,11 @@ public class ServletHttpFacade implements HttpFacade {
|
|||
return buf.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRelativePath() {
|
||||
return request.getServletPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSecure() {
|
||||
return request.isSecure();
|
||||
|
|
|
@ -78,6 +78,11 @@ public class CatalinaHttpFacade implements HttpFacade {
|
|||
return buf.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRelativePath() {
|
||||
return request.getServletPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSecure() {
|
||||
return request.isSecure();
|
||||
|
|
|
@ -83,6 +83,11 @@ public class UndertowHttpFacade implements HttpFacade {
|
|||
return uriBuilder.build().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRelativePath() {
|
||||
return exchange.getRelativePath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSecure() {
|
||||
String protocol = exchange.getRequestScheme();
|
||||
|
|
|
@ -181,6 +181,11 @@ public class OfflineAccessPortalServlet extends HttpServlet {
|
|||
return servletRequest.getRequestURL().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRelativePath() {
|
||||
return servletRequest.getServletPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSecure() {
|
||||
return servletRequest.isSecure();
|
||||
|
|
Loading…
Reference in a new issue