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});