Merge pull request #2418 from schmeedy/master
Fix k_query_bearer_token endpoint in proxy
This commit is contained in:
commit
b2d8c6bca2
2 changed files with 29 additions and 2 deletions
|
@ -247,8 +247,7 @@ public class ProxyServerBuilder {
|
|||
}
|
||||
|
||||
private HttpHandler addSecurity(final HttpHandler toWrap) {
|
||||
HttpHandler handler = toWrap;
|
||||
handler = new UndertowAuthenticatedActionsHandler(deploymentContext, toWrap);
|
||||
HttpHandler handler = new UndertowAuthenticatedActionsHandler(deploymentContext, toWrap);
|
||||
if (errorPage != null) {
|
||||
if (base.endsWith("/")) {
|
||||
errorPage = base + errorPage;
|
||||
|
@ -256,6 +255,7 @@ public class ProxyServerBuilder {
|
|||
errorPage = base + "/" + errorPage;
|
||||
}
|
||||
}
|
||||
handler = new TokenRequestPreHandler(handler);
|
||||
handler = new ConstraintAuthorizationHandler(handler, errorPage, sendAccessToken, headerNameConfig);
|
||||
handler = new ProxyAuthenticationCallHandler(handler);
|
||||
handler = new ConstraintMatcherHandler(matches, handler, toWrap, errorPage);
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package org.keycloak.proxy;
|
||||
|
||||
import io.undertow.server.HttpHandler;
|
||||
import io.undertow.server.HttpServerExchange;
|
||||
import org.keycloak.constants.AdapterConstants;
|
||||
|
||||
/**
|
||||
* Dispatches requests for k_query_bearer_token through a worker thread (handler for this
|
||||
* resource performs blocking IO).
|
||||
*/
|
||||
public class TokenRequestPreHandler implements HttpHandler {
|
||||
|
||||
private final HttpHandler next;
|
||||
|
||||
public TokenRequestPreHandler(HttpHandler next) {
|
||||
this.next = next;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRequest(HttpServerExchange exchange) throws Exception {
|
||||
if (exchange.getRequestURI().endsWith(AdapterConstants.K_QUERY_BEARER_TOKEN)) {
|
||||
exchange.dispatch(next);
|
||||
} else {
|
||||
next.handleRequest(exchange);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue