[KEYCLOAK-13141] - Fixing filter
This commit is contained in:
parent
dc73397176
commit
582046bbfe
5 changed files with 43 additions and 20 deletions
25
.github/workflows/ci-x.yml
vendored
25
.github/workflows/ci-x.yml
vendored
|
@ -50,7 +50,30 @@ jobs:
|
|||
- name: Build testsuite
|
||||
run: mvn clean install -B -Pquarkus,auth-server-quarkus -DskipTests -f testsuite/pom.xml
|
||||
- name: Run base tests
|
||||
run: mvn clean install -B -Pquarkus,auth-server-quarkus -f testsuite/integration-arquillian/tests/base/pom.xml | misc/log/trimmer.sh; exit ${PIPESTATUS[0]}
|
||||
run: mvn clean install -B -Pquarkus,auth-server-quarkus -f testsuite/integration-arquillian/tests/base/pom.xml -Dtest='!org.keycloak.testsuite.adapter.**,!**.crossdc.**,!**.cluster.**' | misc/log/trimmer.sh; exit ${PIPESTATUS[0]}
|
||||
test-adapter:
|
||||
name: Test Adapter
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
MAVEN_OPTS: -Xmx1024m
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 1.8
|
||||
- name: Download Maven Repo
|
||||
uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: maven-repo
|
||||
path: .
|
||||
- name: Extract Maven Repo
|
||||
shell: bash
|
||||
run: tar -xzvf maven-repo.tgz -C ~
|
||||
- name: Build testsuite
|
||||
run: mvn clean install -B -Pquarkus,auth-server-quarkus -DskipTests -f testsuite/pom.xml
|
||||
- name: Run adapter tests
|
||||
run: mvn clean install -B -Pquarkus,auth-server-quarkus -f testsuite/integration-arquillian/tests/base/pom.xml -Dtest=org.keycloak.testsuite.adapter.** | misc/log/trimmer.sh; exit ${PIPESTATUS[0]}
|
||||
test-cluster:
|
||||
name: Test Clustering
|
||||
needs: build
|
||||
|
|
|
@ -148,6 +148,7 @@ public abstract class KeycloakPropertiesConfigSource extends PropertiesConfigSou
|
|||
case "hibernate-orm":
|
||||
case "datasource":
|
||||
case "http":
|
||||
case "vertx":
|
||||
case "log":
|
||||
namespace = NS_QUARKUS;
|
||||
break;
|
||||
|
|
|
@ -35,31 +35,30 @@ import io.vertx.ext.web.RoutingContext;
|
|||
*/
|
||||
public class QuarkusRequestFilter extends AbstractRequestFilter implements Handler<RoutingContext> {
|
||||
|
||||
private static final String KEYCLOAK_SESSION_KEY = KeycloakSession.class.getName();
|
||||
private static final Handler<AsyncResult<Object>> EMPTY_RESULT = result -> {
|
||||
// we don't really care about the result because any exception thrown should be handled by the parent class
|
||||
};
|
||||
|
||||
@Override
|
||||
public void handle(RoutingContext context) {
|
||||
ClientConnection clientConnection = createClientConnection(context.request());
|
||||
|
||||
// our code should always be run as blocking until we don't provide a better support for running non-blocking code
|
||||
// in the event loop
|
||||
context.vertx().executeBlocking(promise -> filter(clientConnection, (session) -> {
|
||||
try {
|
||||
// we need to close the session before response is sent to the client, otherwise subsequent requests could
|
||||
// not get the latest state because the session from the previous request is still being closed
|
||||
// other methods from Vert.x to add a handler to the response works asynchronously
|
||||
context.response().headersEndHandler(event -> close(session));
|
||||
context.next();
|
||||
promise.complete();
|
||||
} catch (Exception cause) {
|
||||
promise.fail(cause);
|
||||
// re-throw so that the any exception is handled from parent
|
||||
throw new RuntimeException(cause);
|
||||
}
|
||||
}), EMPTY_RESULT);
|
||||
context.vertx().executeBlocking(promise -> {
|
||||
filter(createClientConnection(context.request()), (session) -> {
|
||||
try {
|
||||
// we need to close the session before response is sent to the client, otherwise subsequent requests could
|
||||
// not get the latest state because the session from the previous request is still being closed
|
||||
// other methods from Vert.x to add a handler to the response works asynchronously
|
||||
context.addHeadersEndHandler(event -> close(session));
|
||||
context.next();
|
||||
promise.complete();
|
||||
} catch (Throwable cause) {
|
||||
promise.fail(cause);
|
||||
// re-throw so that the any exception is handled from parent
|
||||
throw new RuntimeException(cause);
|
||||
}
|
||||
});
|
||||
}, false, EMPTY_RESULT);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -133,7 +133,7 @@ public class DefaultHttpClientFactory implements HttpClientFactory {
|
|||
if (httpClient == null) {
|
||||
synchronized(this) {
|
||||
if (httpClient == null) {
|
||||
long socketTimeout = config.getLong("socket-timeout-millis", -1L);
|
||||
long socketTimeout = config.getLong("socket-timeout-millis", 5000L);
|
||||
long establishConnectionTimeout = config.getLong("establish-connection-timeout-millis", -1L);
|
||||
int maxPooledPerRoute = config.getInt("max-pooled-per-route", 64);
|
||||
int connectionPoolSize = config.getInt("connection-pool-size", 128);
|
||||
|
|
|
@ -237,7 +237,7 @@ public class KeycloakQuarkusServerDeployableContainer implements DeployableConta
|
|||
SSLSocketFactory socketFactory;
|
||||
|
||||
try {
|
||||
sslContext = SSLContext.getInstance("SSL");
|
||||
sslContext = SSLContext.getInstance("TLS");
|
||||
sslContext.init(null, trustAllCerts, new java.security.SecureRandom());
|
||||
socketFactory = sslContext.getSocketFactory();
|
||||
} catch (NoSuchAlgorithmException | KeyManagementException e) {
|
||||
|
|
Loading…
Reference in a new issue