Rewrite camel-undertow to stick with 1.7

This commit is contained in:
stianst 2021-09-27 16:12:48 +02:00 committed by Stian Thorgersen
parent 9f79476520
commit 8b262e3094
2 changed files with 6 additions and 6 deletions

View file

@ -31,8 +31,8 @@
<packaging>bundle</packaging> <packaging>bundle</packaging>
<properties> <properties>
<maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.source>1.7</maven.compiler.source>
<keycloak.osgi.export> <keycloak.osgi.export>
org.keycloak.adapters.camel.undertow;version="${project.version}" org.keycloak.adapters.camel.undertow;version="${project.version}"

View file

@ -50,7 +50,6 @@ import io.undertow.util.AttachmentKey;
import io.undertow.util.StatusCodes; import io.undertow.util.StatusCodes;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Optional;
import java.util.Set; import java.util.Set;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -168,9 +167,10 @@ public class UndertowKeycloakConsumer extends UndertowConsumer {
httpExchange.putAttachment(KEYCLOAK_PRINCIPAL_KEY, (KeycloakPrincipal) kua.getPrincipal()); httpExchange.putAttachment(KEYCLOAK_PRINCIPAL_KEY, (KeycloakPrincipal) kua.getPrincipal());
} }
Set<String> roles = Optional Set<String> roles = authenticatedAccount.getRoles();
.ofNullable(authenticatedAccount.getRoles()) if (roles == null) {
.orElse((Set<String>) Collections.EMPTY_SET); roles = Collections.EMPTY_SET;
}
LOG.log(Level.FINE, "Allowed roles: {0}, current roles: {1}", new Object[] {allowedRoles, roles}); LOG.log(Level.FINE, "Allowed roles: {0}, current roles: {1}", new Object[] {allowedRoles, roles});