From 429863e83b596251bd83919a45196002d08b33b1 Mon Sep 17 00:00:00 2001 From: mhajas Date: Mon, 29 Apr 2019 13:03:07 +0200 Subject: [PATCH] KEYCLOAK-9095 Fix NPE in AuthenticatedActionsHandler --- .../org/keycloak/adapters/AuthenticatedActionsHandler.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/adapters/oidc/adapter-core/src/main/java/org/keycloak/adapters/AuthenticatedActionsHandler.java b/adapters/oidc/adapter-core/src/main/java/org/keycloak/adapters/AuthenticatedActionsHandler.java index 342cefce3d..e7124f171c 100755 --- a/adapters/oidc/adapter-core/src/main/java/org/keycloak/adapters/AuthenticatedActionsHandler.java +++ b/adapters/oidc/adapter-core/src/main/java/org/keycloak/adapters/AuthenticatedActionsHandler.java @@ -118,15 +118,14 @@ public class AuthenticatedActionsHandler { if (securityContext != null && origin != null && !origin.equals(requestOrigin)) { AccessToken token = securityContext.getToken(); Set allowedOrigins = token.getAllowedOrigins(); - if (log.isDebugEnabled()) { - for (String a : allowedOrigins) log.debug(" " + a); - } + + log.debugf("Allowed origins in token: %s", allowedOrigins); + if (allowedOrigins == null || (!allowedOrigins.contains("*") && !allowedOrigins.contains(origin))) { if (allowedOrigins == null) { log.debugv("allowedOrigins was null in token"); } else { log.debugv("allowedOrigins did not contain origin"); - } facade.getResponse().sendError(403); facade.getResponse().end();