Fix KEYCLOAK-8832 (#5735)

Avoid NullPointerException when browser sends "Origin" header and
allowedOrigin is null. This happens on chrome with admin console
This commit is contained in:
Cédric Couralet 2018-11-19 17:53:05 +01:00 committed by Stian Thorgersen
parent f3bf1456ab
commit dc06a8cee3

View file

@ -143,7 +143,7 @@ public class Cors {
if (!preflight && (allowedOrigins == null || (!allowedOrigins.contains(origin) && !allowedOrigins.contains(ACCESS_CONTROL_ALLOW_ORIGIN_WILDCARD)))) { if (!preflight && (allowedOrigins == null || (!allowedOrigins.contains(origin) && !allowedOrigins.contains(ACCESS_CONTROL_ALLOW_ORIGIN_WILDCARD)))) {
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debugv("Invalid CORS request: origin {0} not in allowed origins {1}", origin, Arrays.toString(allowedOrigins.toArray())); logger.debugv("Invalid CORS request: origin {0} not in allowed origins {1}", origin, allowedOrigins);
} }
return builder.build(); return builder.build();
} }