keycloak-quickstarts icon indicating copy to clipboard operation
keycloak-quickstarts copied to clipboard

photoz-realm.json is can not been import to keycloak15.0.2

Open tlzskk opened this issue 3 years ago • 6 comments

Describe the bug

I can not be import file [keycloak-quickstarts/app-authz-uma-photoz/photoz-realm.json] to keycloak15.0.2 can you update the latest realm.json for me. Thank you !

Version

15.02

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

No response

Anything else?

No response

tlzskk avatar Nov 16 '21 07:11 tlzskk

Hi, can you please add some more details to issue?

stianst avatar Nov 16 '21 14:11 stianst

I do encounter the exact same behaviour.

How to reproduce ?

Simply start a docker container with the following command line docker run -p 8080:8080 -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin quay.io/keycloak/keycloak:latest

Then login as admin user. Finally click on Add realm the Select File.

The Keycloak UI page (in your browser) will display an error message : Error! An unexpected server error has occurred

Anything else ?

I took a quick look at the browser debug console. I can read the following 500 error

Possibly unhandled rejection: {"data":{"error":"unknown_error"},"status":500,"config":{"method":"POST","transformRequest":[null,null],"transformResponse":[null],"jsonpCallbackParam":"callback","data":{"realm":"... (the realm json content)

I equally notice that the first committed version of the json is valid.

remithomasn7 avatar Jan 12 '22 15:01 remithomasn7

Hummm, after a quick look at the project (mainly the readme), I realized I did not load the js policies in KC before importing the realm. It now makes sense that loading the json realm failed.

However I encountered another issue (trying to properly follow the readme). I was not able to do mvn clean install. I faced the following issue:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.6:war (default-war) on project photoz-uma-restful-api: Execution default-war of goal org.apache.maven.plugins:maven-war-plugin:2.6:war failed: Unable to load the mojo 'war' in the plugin 'org.apache.maven.plugins:maven-war-plugin:2.6' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: null

remithomasn7 avatar Jan 12 '22 16:01 remithomasn7

got the same error on mvn clean install, is there any update?

Shawydu avatar Apr 26 '22 20:04 Shawydu

I'm following README of photoz and getting the error of importing realm in keycloak 18

2022-08-11 08:41:40,290 ERROR [org.keycloak.services.error.KeycloakErrorHandler] (executor-thread-13) Uncaught server error: java.lang.RuntimeException: Error while importing policy [Only Owner and Administrators Policy].
	at org.keycloak.models.utils.RepresentationToModel.importPolicies(RepresentationToModel.java:2393)
	at org.keycloak.models.utils.RepresentationToModel.toModel(RepresentationToModel.java:2353)
	at org.keycloak.models.utils.RepresentationToModel.importAuthorizationSettings(RepresentationToModel.java:2300)
	at org.keycloak.models.utils.RepresentationToModel.lambda$importRealmAuthorizationSettings$9(RepresentationToModel.java:2278)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
...

I guess it is missing some step for this role creation

Kostanos avatar Aug 11 '22 08:08 Kostanos

You need to install the policies in order to import the realm:

 mvn clean install

# add the policies jar file to the container in /opt/keycloak/providers
docker run -p 8180:8180 -e KEYCLOAK_ADMIN=admin -e KEYCLOAK_ADMIN_PASSWORD=admin -v $PWD/photoz-js-policies/target/photoz-uma-js-policies.jar:/opt/keycloak/providers/photoz-uma-js-policies.jar quay.io/keycloak/keycloak:18.0.2 start-dev --http-port 8180 --http-relative-path 

From there you can 'add role' and import the photos-realm.json file.

dsummersl avatar Aug 22 '22 15:08 dsummersl