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) {
|
private String getPath(Request request) {
|
||||||
String pathInfo = URI.create(request.getURI()).getPath().substring(1);
|
return request.getRelativePath();
|
||||||
return pathInfo.substring(pathInfo.indexOf('/'), pathInfo.length());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Set<String> getRequiredScopes(PathConfig pathConfig, Request request) {
|
private Set<String> getRequiredScopes(PathConfig pathConfig, Request request) {
|
||||||
|
|
|
@ -66,6 +66,11 @@ public class JaxrsHttpFacade implements OIDCHttpFacade {
|
||||||
return requestContext.getUriInfo().getRequestUri().toString();
|
return requestContext.getUriInfo().getRequestUri().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRelativePath() {
|
||||||
|
return requestContext.getUriInfo().getPath();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSecure() {
|
public boolean isSecure() {
|
||||||
return securityContext.isSecure();
|
return securityContext.isSecure();
|
||||||
|
|
|
@ -218,6 +218,11 @@ public class ServletOAuthClient extends KeycloakDeploymentDelegateOAuthClient {
|
||||||
return servletRequest.getRequestURL().toString();
|
return servletRequest.getRequestURL().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRelativePath() {
|
||||||
|
return servletRequest.getServletPath();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSecure() {
|
public boolean isSecure() {
|
||||||
return servletRequest.isSecure();
|
return servletRequest.isSecure();
|
||||||
|
|
|
@ -70,6 +70,11 @@ class WrappedHttpServletRequest implements Request {
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRelativePath() {
|
||||||
|
return request.getServletPath();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSecure() {
|
public boolean isSecure() {
|
||||||
return request.isSecure();
|
return request.isSecure();
|
||||||
|
|
|
@ -43,6 +43,13 @@ public interface HttpFacade {
|
||||||
*/
|
*/
|
||||||
String getURI();
|
String getURI();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the request relative path.
|
||||||
|
*
|
||||||
|
* @return the request relative path
|
||||||
|
*/
|
||||||
|
String getRelativePath();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HTTPS?
|
* HTTPS?
|
||||||
*
|
*
|
||||||
|
|
|
@ -78,6 +78,11 @@ public class JettyHttpFacade implements HttpFacade {
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRelativePath() {
|
||||||
|
return request.getServletPath();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getFirstParam(String param) {
|
public String getFirstParam(String param) {
|
||||||
return request.getParameter(param);
|
return request.getParameter(param);
|
||||||
|
|
|
@ -65,6 +65,11 @@ public class ServletHttpFacade implements HttpFacade {
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRelativePath() {
|
||||||
|
return request.getServletPath();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSecure() {
|
public boolean isSecure() {
|
||||||
return request.isSecure();
|
return request.isSecure();
|
||||||
|
|
|
@ -78,6 +78,11 @@ public class CatalinaHttpFacade implements HttpFacade {
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRelativePath() {
|
||||||
|
return request.getServletPath();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSecure() {
|
public boolean isSecure() {
|
||||||
return request.isSecure();
|
return request.isSecure();
|
||||||
|
|
|
@ -83,6 +83,11 @@ public class UndertowHttpFacade implements HttpFacade {
|
||||||
return uriBuilder.build().toString();
|
return uriBuilder.build().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRelativePath() {
|
||||||
|
return exchange.getRelativePath();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSecure() {
|
public boolean isSecure() {
|
||||||
String protocol = exchange.getRequestScheme();
|
String protocol = exchange.getRequestScheme();
|
||||||
|
|
|
@ -181,6 +181,11 @@ public class OfflineAccessPortalServlet extends HttpServlet {
|
||||||
return servletRequest.getRequestURL().toString();
|
return servletRequest.getRequestURL().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRelativePath() {
|
||||||
|
return servletRequest.getServletPath();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSecure() {
|
public boolean isSecure() {
|
||||||
return servletRequest.isSecure();
|
return servletRequest.isSecure();
|
||||||
|
|
Loading…
Reference in a new issue