From 71bf079b6b28dbedc9f18a13ca41e6cc763e9e74 Mon Sep 17 00:00:00 2001
From: Francisco Javier Tirado Sarti
<65240126+fjtirado@users.noreply.github.com>
Date: Wed, 5 Jul 2023 15:23:18 +0200
Subject: [PATCH] [KOGITO-9520] Updating SDK to 4.0.4 (#3102)
---
kogito-build/kogito-dependencies-bom/pom.xml | 2 +-
.../kogito/serverless/workflow/io/HttpContentLoader.java | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/kogito-build/kogito-dependencies-bom/pom.xml b/kogito-build/kogito-dependencies-bom/pom.xml
index 1e0f5ff6f06..5afd0f9b953 100644
--- a/kogito-build/kogito-dependencies-bom/pom.xml
+++ b/kogito-build/kogito-dependencies-bom/pom.xml
@@ -58,7 +58,7 @@
1.10.2
9.8.3
42.5.1
- 4.0.3.Final
+ 4.0.4.Final
3.1.1
4.2.0
diff --git a/kogito-serverless-workflow/kogito-serverless-workflow-runtime/src/main/java/org/kie/kogito/serverless/workflow/io/HttpContentLoader.java b/kogito-serverless-workflow/kogito-serverless-workflow-runtime/src/main/java/org/kie/kogito/serverless/workflow/io/HttpContentLoader.java
index 53b29c5a5bc..9a4d413eb5d 100644
--- a/kogito-serverless-workflow/kogito-serverless-workflow-runtime/src/main/java/org/kie/kogito/serverless/workflow/io/HttpContentLoader.java
+++ b/kogito-serverless-workflow/kogito-serverless-workflow-runtime/src/main/java/org/kie/kogito/serverless/workflow/io/HttpContentLoader.java
@@ -20,6 +20,7 @@
import java.net.HttpURLConnection;
import java.net.URI;
import java.util.Base64;
+import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
@@ -38,6 +39,7 @@
import io.serverlessworkflow.api.auth.BasicAuthDefinition;
import io.serverlessworkflow.api.auth.BearerAuthDefinition;
import io.serverlessworkflow.api.auth.OauthDefinition;
+import io.serverlessworkflow.api.workflow.Auth;
class HttpContentLoader extends FallbackContentLoader {
@@ -58,9 +60,9 @@ protected byte[] loadURI(URI u) {
HttpURLConnection conn = (HttpURLConnection) u.toURL().openConnection();
// some http servers required specific accept header (*/* is specified for those we do not care about accept)
conn.setRequestProperty("Accept", "application/json,application/yaml,application/yml,application/text,text/*,*/*");
- workflow.map(Workflow::getAuth)
+ workflow.map(Workflow::getAuth).map(Auth::getAuthDefs).stream().flatMap(Collection::stream)
.filter(auth -> Objects.equals(auth.getName(), authRef))
- .ifPresent(auth -> addAuth(conn, auth));
+ .forEach(auth -> addAuth(conn, auth));
int code = conn.getResponseCode();
if (code == HttpURLConnection.HTTP_OK) {
try (InputStream is = conn.getInputStream()) {