From 8b262e3094b8481e05c81f9bb0fed31e61f91360 Mon Sep 17 00:00:00 2001 From: stianst Date: Mon, 27 Sep 2021 16:12:48 +0200 Subject: [PATCH] Rewrite camel-undertow to stick with 1.7 --- adapters/oidc/fuse7/camel-undertow/pom.xml | 4 ++-- .../adapters/camel/undertow/UndertowKeycloakConsumer.java | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/adapters/oidc/fuse7/camel-undertow/pom.xml b/adapters/oidc/fuse7/camel-undertow/pom.xml index a90916f0d8..c9ee3a4853 100644 --- a/adapters/oidc/fuse7/camel-undertow/pom.xml +++ b/adapters/oidc/fuse7/camel-undertow/pom.xml @@ -31,8 +31,8 @@ bundle - 1.8 - 1.8 + 1.7 + 1.7 org.keycloak.adapters.camel.undertow;version="${project.version}" diff --git a/adapters/oidc/fuse7/camel-undertow/src/main/java/org/keycloak/adapters/camel/undertow/UndertowKeycloakConsumer.java b/adapters/oidc/fuse7/camel-undertow/src/main/java/org/keycloak/adapters/camel/undertow/UndertowKeycloakConsumer.java index 8ce2330270..15a9e1a339 100644 --- a/adapters/oidc/fuse7/camel-undertow/src/main/java/org/keycloak/adapters/camel/undertow/UndertowKeycloakConsumer.java +++ b/adapters/oidc/fuse7/camel-undertow/src/main/java/org/keycloak/adapters/camel/undertow/UndertowKeycloakConsumer.java @@ -50,7 +50,6 @@ import io.undertow.util.AttachmentKey; import io.undertow.util.StatusCodes; import java.util.Collections; import java.util.List; -import java.util.Optional; import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; @@ -168,9 +167,10 @@ public class UndertowKeycloakConsumer extends UndertowConsumer { httpExchange.putAttachment(KEYCLOAK_PRINCIPAL_KEY, (KeycloakPrincipal) kua.getPrincipal()); } - Set roles = Optional - .ofNullable(authenticatedAccount.getRoles()) - .orElse((Set) Collections.EMPTY_SET); + Set roles = authenticatedAccount.getRoles(); + if (roles == null) { + roles = Collections.EMPTY_SET; + } LOG.log(Level.FINE, "Allowed roles: {0}, current roles: {1}", new Object[] {allowedRoles, roles});