diff --git a/adapters/oidc/adapter-core/src/main/java/org/keycloak/adapters/authorization/PolicyEnforcer.java b/adapters/oidc/adapter-core/src/main/java/org/keycloak/adapters/authorization/PolicyEnforcer.java index 8a6a0a5bb1..679a33c867 100644 --- a/adapters/oidc/adapter-core/src/main/java/org/keycloak/adapters/authorization/PolicyEnforcer.java +++ b/adapters/oidc/adapter-core/src/main/java/org/keycloak/adapters/authorization/PolicyEnforcer.java @@ -220,7 +220,14 @@ public class PolicyEnforcer { pathConfig.setId(resourceDescription.getId()); pathConfig.setName(resourceDescription.getName()); - pathConfig.setPath(resourceDescription.getUri()); + + String uri = resourceDescription.getUri(); + + if (uri == null || "".equals(uri.trim())) { + throw new RuntimeException("Failed to configure paths. Resource [" + resourceDescription.getName() + "] has an invalid or empty URI [" + uri + "]."); + } + + pathConfig.setPath(uri); List scopeNames = new ArrayList<>();