[keycloak-dev] cannot run keycloak authz examples working correctly - unresolved dependency - Cannot find KieModule: org.keycloak:photoz-authz-policy:${project.version}

Olivier Rivat orivat at janua.fr
Mon Nov 20 16:21:19 EST 2017


Hi,

I am using RH-SSO 7.1 with Keycloack examples 2.5.X (2.5.11.Final-SNAPSHOT)

I have been able to ciompiel and upload the both photoz war:
-photoz-html5-client.war
-photoz-restful-api.war

1) on UI uinterface
=============

I have an issue when I am running the example.
When click on "Entitlement" or "Delete" I am getting Error 500.

I have screened it, and the reason is that:


angular.min.js:77 GET http://localhost:8080/photoz-restful-api/album 401 
(Unauthorized)

GET 
http://localhost:8180/auth/realms/photoz/authz/entitlement/photoz-restful-api 
500 (Internal Server Error)
:8080/photoz-html5-client/#/:1 Failed to load 
http://localhost:8180/auth/realms/photoz/authz/entitlement/photoz-restful-api: 

No 'Access-Control-Allow-Origin' header is present on the requested 
resource. Origin 'http://localhost:8080' is therefore not allowed access.
The response had HTTP status code 500.


2) in logs -of RH-SSO
=============
Meanwhile, I have had also a look at RH-SSO log, and it is displaying:

21:49:22,210 ERROR [org.jboss.resteasy.resteasy_jaxrs.i18n] (default 
task-79) RESTEASY002020: Unhandled asynchronous exception, sending back 
500: org.jboss.resteasy.spi.UnhandledException: 
java.lang.RuntimeException: Cannot find KieModule: 
org.keycloak:photoz-authz-policy:${project.version}
     at 
org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:255)

3) ${project.version} in photoz examples
========================
it can be foudn at:

3.1) examples/authz/photoz/photoz-restful-api/pom.xml

  <dependency>
             <groupId>org.keycloak</groupId>
<artifactId>keycloak-authz-client</artifactId>
             <version>${project.version}</version>
             <scope>provided</scope>
         </dependency>

3.2) 
examples/authz/photoz/photoz-restful-api/src/main/resources/photoz-restful-api-authz-service.json

"policies": [
     {
       "name": "Only Owner Policy",
       "description": "Defines that only the resource owner is allowed 
to do something",
       "type": "rules",
       "logic": "POSITIVE",
       "decisionStrategy": "UNANIMOUS",
       "config": {
         "mavenArtifactVersion": "${project.version}",
         "mavenArtifactId": "photoz-authz-policy",
         "sessionName": "MainOwnerSession",
         "mavenArtifactGroupId": "org.keycloak",
         "moduleName": "PhotozAuthzOwnerPolicy",
         "scannerPeriod": "1",
         "scannerPeriodUnit": "Hours"
       }
     },


and for info:

we also have:

examples/authz/photoz/photoz-authz-policy/pom.xml

  <parent>
         <groupId>org.keycloak</groupId>
<artifactId>keycloak-authz-photoz-parent</artifactId>
         <version>2.5.11.Final-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>



4) My analysis
=========
The error seen in RH-SSO server (Cannot find KieModule: 
org.keycloak:photoz-authz-policy:${project.version}) comes certainly 
from the fact that
${project.version} is not resolved  at all, although being defined in 
pom.xml of examples/authz/photoz/photoz-authz-policy.

It could be great if someone could help to resolve those unresolved 
dependency which are  preventing to run the example successfully.


Regards,

Olivier










More information about the keycloak-dev mailing list