[keycloak-user] Keycloak extension wiith admin-client

Spike J dev.spike.j at gmail.com
Tue May 15 07:02:58 EDT 2018


Hi everyone,

we try to build an additional keycloak REST endpoint that should use the
admin client.
Therefore in my code I copied the example from keycloak github and added:

Keycloak kc = KeycloakBuilder.builder()
    .serverUrl("https://localhost:8080/auth")
    .realm("master")
    .username("admin")
    .password("admin")
    .clientId("admin-cli")
    .resteasyClient(
        new ResteasyClientBuilder()
            .connectionPoolSize(5).build()
    ).build();


When I put my jar into standalone/deployments first it does not find
KeycloakBuilder. So I had to deploy keycloak-admin-client-4.0.0.Beta3.jar
as a module manually. In
"/opt/jboss/keycloak/modules/system/layers/keycloak/org/keycloak" seem to
be lots of modules but keycloak-admin-client is missing.
After manually deployment of the keycloak-admin-client as a module, I added
a jboss-deployment-structure.xml to my extension with:

<jboss-deployment-structure>
<deployment>
    <dependencies>
      <module name="org.keycloak.keycloak-admin-client" />
    </dependencies>
</deployment>
</jboss-deployment-structure>

When I hot-deploy my REST extension now I get
09:53:29,655 ERROR [org.keycloak.services.error.KeycloakErrorHandler]
(default task-1) Uncaught server error: java.lang.IllegalArgumentException:
interface org.keycloak.admin.client.token.TokenService is not visible from
class loader

By the way, the same errors returns when I go the long way and build a
module.xml and deploy my extension with the standalone.xml

Any suggestions how to solve that?

Thanks and kind regards
Spike


More information about the keycloak-user mailing list