diff --git a/integration-tests/integration-tests-trusty-service/integration-tests-trusty-service-common/pom.xml b/integration-tests/integration-tests-trusty-service/integration-tests-trusty-service-common/pom.xml
index a6843457ac..62b89d495c 100644
--- a/integration-tests/integration-tests-trusty-service/integration-tests-trusty-service-common/pom.xml
+++ b/integration-tests/integration-tests-trusty-service/integration-tests-trusty-service-common/pom.xml
@@ -50,6 +50,15 @@
awaitility
compile
+
+ org.kie.kogito
+ kogito-test-utils
+ compile
+
+
+ org.keycloak
+ keycloak-core
+
diff --git a/integration-tests/integration-tests-trusty-service/integration-tests-trusty-service-common/src/main/java/org/kie/kogito/it/trusty/AbstractTrustyExplainabilityEnd2EndIT.java b/integration-tests/integration-tests-trusty-service/integration-tests-trusty-service-common/src/main/java/org/kie/kogito/it/trusty/AbstractTrustyExplainabilityEnd2EndIT.java
index 8af8d9f110..85c80ac0e2 100644
--- a/integration-tests/integration-tests-trusty-service/integration-tests-trusty-service-common/src/main/java/org/kie/kogito/it/trusty/AbstractTrustyExplainabilityEnd2EndIT.java
+++ b/integration-tests/integration-tests-trusty-service/integration-tests-trusty-service-common/src/main/java/org/kie/kogito/it/trusty/AbstractTrustyExplainabilityEnd2EndIT.java
@@ -20,8 +20,10 @@
import java.util.function.BiFunction;
import org.junit.jupiter.api.Test;
+import org.keycloak.representations.AccessTokenResponse;
import org.kie.kogito.testcontainers.ExplainabilityServiceMessagingContainer;
import org.kie.kogito.testcontainers.InfinispanContainer;
+import org.kie.kogito.testcontainers.KogitoKeycloakContainer;
import org.kie.kogito.testcontainers.KogitoServiceContainer;
import org.kie.kogito.testcontainers.TrustyServiceContainer;
import org.kie.kogito.trusty.service.responses.ExecutionsResponse;
@@ -53,10 +55,36 @@ public abstract class AbstractTrustyExplainabilityEnd2EndIT {
private static final String KAFKA_ALIAS = "kafka";
private static final String KAFKA_BOOTSTRAP_SERVERS = KAFKA_ALIAS + ":9092";
+ private static final String KEYCLOAK_ALIAS = "keycloak";
+ private static final String KEYCLOAK_DB_VENDOR_VARIABLE = "DB_VENDOR";
+ private static final String KEYCLOAK_DB_VENDOR_VALUE = "h2";
+ private static final String KEYCLOAK_ACCESS_TOKEN_PATH = "/auth/realms/kogito/protocol/openid-connect/token";
+ private static final String KEYCLOAK_GRANT_TYPE_PARAM_NAME = "grant_type";
+ private static final String KEYCLOAK_GRANT_TYPE_PARAM_VALUE = "password";
+ private static final String KEYCLOAK_USERNAME_PARAM_NAME = "username";
+ private static final String KEYCLOAK_USERNAME_PARAM_VALUE = "jdoe";
+ private static final String KEYCLOAK_PASSWORD_PARAM_NAME = "password";
+ private static final String KEYCLOAK_PASSWORD_PARAM_VALUE = "jdoe";
+ private static final String KEYCLOAK_CLIENT_ID_PARAM_NAME = "client_id";
+ private static final String KEYCLOAK_CLIENT_ID_PARAM_VALUE = KogitoKeycloakContainer.CLIENT_ID;
+ private static final String KEYCLOAK_CLIENT_SECRET_PARAM_NAME = "client_secret";
+ private static final String KEYCLOAK_CLIENT_SECRET_PARAM_VALUE = KogitoKeycloakContainer.CLIENT_SECRET;
+
private static final String KOGITO_SERVICE_ALIAS = "kogito-service";
private static final String KOGITO_SERVICE_URL = "http://" + KOGITO_SERVICE_ALIAS + ":8080";
+ private static final List KOGITO_SERVICE_PAYLOADS = List.of(
+ "{\"Driver\":{\"Age\":25,\"Points\":13},\"Violation\":{\"Type\":\"speed\",\"Actual Speed\":105,\"Speed Limit\":100}}",
+ "{\"Driver\":{\"Age\":37,\"Points\":20},\"Violation\":{\"Type\":\"speed\",\"Actual Speed\":135,\"Speed Limit\":100}}",
+ "{\"Driver\":{\"Age\":18,\"Points\": 0},\"Violation\":{\"Type\":\"speed\",\"Actual Speed\": 85,\"Speed Limit\": 70}}",
+ "{\"Driver\":{\"Age\":56,\"Points\":13},\"Violation\":{\"Type\":\"speed\",\"Actual Speed\": 35,\"Speed Limit\": 25}}",
+ "{\"Driver\":{\"Age\":40,\"Points\":13},\"Violation\":{\"Type\":\"speed\",\"Actual Speed\":215,\"Speed Limit\":120}}"
+ );
private static final String TRUSTY_SERVICE_ALIAS = "trusty-service";
+ private static final String TRUSTY_SERVICE_OIDC_AUTH_SERVER_URL_VARIABLE = "QUARKUS_OIDC_AUTH_SERVER_URL";
+ private static final String TRUSTY_SERVICE_OIDC_AUTH_SERVER_URL_VALUE = "http://" + KEYCLOAK_ALIAS + ":8080/auth/realms/kogito";
+ private static final String TRUSTY_SERVICE_OIDC_CLIENT_ID_VARIABLE = "QUARKUS_OIDC_CLIENT_ID";
+ private static final String TRUSTY_SERVICE_OIDC_CLIENT_ID_VALUE = "kogito-trusty-service";
private final BiFunction kogitoServiceContainerProducer;
@@ -65,7 +93,7 @@ protected AbstractTrustyExplainabilityEnd2EndIT(BiFunction jsonList = List.of(
- "{\"Driver\":{\"Age\":25,\"Points\":13},\"Violation\":{\"Type\":\"speed\",\"Actual Speed\":105,\"Speed Limit\":100}}",
- "{\"Driver\":{\"Age\":37,\"Points\":20},\"Violation\":{\"Type\":\"speed\",\"Actual Speed\":135,\"Speed Limit\":100}}",
- "{\"Driver\":{\"Age\":18,\"Points\": 0},\"Violation\":{\"Type\":\"speed\",\"Actual Speed\": 85,\"Speed Limit\": 70}}",
- "{\"Driver\":{\"Age\":56,\"Points\":13},\"Violation\":{\"Type\":\"speed\",\"Actual Speed\": 35,\"Speed Limit\": 25}}",
- "{\"Driver\":{\"Age\":40,\"Points\":13},\"Violation\":{\"Type\":\"speed\",\"Actual Speed\":215,\"Speed Limit\":120}}"
- );
- final int expectedExecutions = jsonList.size();
+ final String accessToken = given()
+ .port(keycloak.getFirstMappedPort())
+ .param(KEYCLOAK_GRANT_TYPE_PARAM_NAME, KEYCLOAK_GRANT_TYPE_PARAM_VALUE)
+ .param(KEYCLOAK_USERNAME_PARAM_NAME, KEYCLOAK_USERNAME_PARAM_VALUE)
+ .param(KEYCLOAK_PASSWORD_PARAM_NAME, KEYCLOAK_PASSWORD_PARAM_VALUE)
+ .param(KEYCLOAK_CLIENT_ID_PARAM_NAME, KEYCLOAK_CLIENT_ID_PARAM_VALUE)
+ .param(KEYCLOAK_CLIENT_SECRET_PARAM_NAME, KEYCLOAK_CLIENT_SECRET_PARAM_VALUE)
+ .when()
+ .post(KEYCLOAK_ACCESS_TOKEN_PATH)
+ .as(AccessTokenResponse.class).getToken();
+
+ assertNotNull(accessToken);
+
+ final int expectedExecutions = KOGITO_SERVICE_PAYLOADS.size();
- jsonList.forEach(json ->
+ KOGITO_SERVICE_PAYLOADS.forEach(json ->
given()
.port(kogitoService.getFirstMappedPort())
.contentType("application/json")
@@ -132,6 +176,7 @@ public void doTest() throws Exception {
.untilAsserted(() -> {
ExecutionsResponse executionsResponse = given()
.port(trustyService.getFirstMappedPort())
+ .auth().oauth2(accessToken)
.when().get(String.format("/executions?limit=%d", expectedExecutions))
.then().statusCode(200)
.extract().as(ExecutionsResponse.class);
@@ -145,6 +190,7 @@ public void doTest() throws Exception {
SalienciesResponse salienciesResponse = given()
.port(trustyService.getFirstMappedPort())
+ .auth().oauth2(accessToken)
.when().get("/executions/decisions/" + executionId + "/explanations/saliencies")
.then().statusCode(200)
.extract().as(SalienciesResponse.class);
diff --git a/trusty/trusty-service/src/main/resources/application.properties b/trusty/trusty-service/src/main/resources/application.properties
index 56705dc5e7..cf7dbadac7 100644
--- a/trusty/trusty-service/src/main/resources/application.properties
+++ b/trusty/trusty-service/src/main/resources/application.properties
@@ -1,8 +1,5 @@
quarkus.http.cors=true
-# Quarkus OIDC
-quarkus.oidc.enabled=false
-quarkus.oidc.auth-server-url=none
# HTTP Security Configuration
quarkus.http.auth.permission.authenticated.paths=/*