forked from keycloak/keycloak
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix k_query_bearer_token endpoint in proxy
`org.keycloak.adapters.AuthenticatedActionsHandler` which handles token requests performs blocking IO. However, the exchange is in non-blocking mode when it reaches this handler in Keycloak proxy.
- Loading branch information
Showing
2 changed files
with
29 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
proxy/proxy-server/src/main/java/org/keycloak/proxy/TokenRequestPreHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} | ||
} |