Reputation: 11
I am using keycloak 8.0.1, and trying one of the examples. While following the README for the steps in .\keycloakExample\keycloak-quickstarts-latest\app-authz-photoz
import a resource server configuration. Now select the file that is located at:
ERROR [org.keycloak.services.error.KeycloakErrorHandler] (default task-16) Uncaught server error: java.lang.RuntimeException: Error while importing policy [Only Owner and Administrators Policy]. at org.keycloak.models.utils.RepresentationToModel.importPolicies(RepresentationToModel.java:2220) at org.keycloak.models.utils.RepresentationToModel.toModel(RepresentationToModel.java:2180)
Upload
and the resource server will be updated accordingly.RuntimeException: Script upload is disabled at org.keycloak.authorization.policy.provider.js.JSPolicyProviderFactory.updatePolicy(JSPolicyProviderFactory.java:125)
==
Versions I am using: "Ubuntu" VERSION is "18.04.1 LTS (Bionic Beaver)" openjdk version "1.8.0_242"
Upvotes: 1
Views: 2567
Reputation: 31
The reason is JavascriptPolicies are no longer enabled by default in Keycloak for security reasons. You have two options on how to solve this. Either you can enable UPLOAD_SCRIPTS feature with (-Dkeycloak.profile.feature.upload_scripts=enabled), or you can use a new Javascript provider. The later is preferred and more secure.
edit: In the latest version of the quickstart repository, this issue should be fixed (upload script JS policies are replaced with deployed policies).
Upvotes: 3