[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
Tue Nov 21 11:06:04 EST 2017


Hi Pedro,

Tkx a lot for your help.

With your comment/tip, it is working fine: I can now succesfuly delete 
albums, and access to the link "Request entitlement", without any failure.

Some comments for improvments of this example:

1) when you click on my profile, there is no way to get to the original 
panel (Welcome Screen)
I Have found the way to doing it, by cliking in the browser window to: 
http://localhost:8080/photoz-html5-client/#

2) When Clicking on the link "Request Entitlement", now it works (I.e 
there is no error in debugging window, compared as before)
But there is nothing displayed on the login screen.

It could be nice to add some information, such as the user entittlements.

Regards,
Olivier


Le 21/11/2017 à 13:04, Pedro Igor Silva a écrit :
> This is probably because you are importing the wrong file with the 
> authorization settings. When you build the example, there is a 
> filtered version of at 
> photoz-restful-api-authz-service.json photoz/photoz-restful-api/target/classes/photoz-restful-api-authz-service.json. 
> This is the file you need to import.
>
> README is not correct and I'll fix this.
>
> Btw, please send such questions to keycloak-user mailing list.
>
> Regards.
> Pedro Igor
>
> On Mon, Nov 20, 2017 at 7:21 PM, Olivier Rivat <orivat at janua.fr 
> <mailto:orivat at janua.fr>> wrote:
>
>     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
>     <http://localhost:8080/photoz-restful-api/album> 401
>     (Unauthorized)
>
>     GET
>     http://localhost:8180/auth/realms/photoz/authz/entitlement/photoz-restful-api
>     <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
>     <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
>
>
>
>
>
>
>
>
>     _______________________________________________
>     keycloak-dev mailing list
>     keycloak-dev at lists.jboss.org <mailto:keycloak-dev at lists.jboss.org>
>     https://lists.jboss.org/mailman/listinfo/keycloak-dev
>     <https://lists.jboss.org/mailman/listinfo/keycloak-dev>
>
>



More information about the keycloak-dev mailing list