[keycloak-user] Get the realms through the Client Admin Api

Felix Knecht Felix.Knecht at hrm-systems.ch
Tue Feb 5 04:37:24 EST 2019


Ciao Luca

In my case it turned out, that the TestEasy client used the wrong annotations provider. So the @JsonProperty <access_token> was not recognized and was null therefore.

What helped in my case was to set  the annotation provider explicitely:

ResteasyClientBuilder clientBuilder = new ResteasyClientBuilder()
  .connectionPoolSize(20)
  .maxPooledPerRoute(2);

ResteasyJackson2Provider jacksonProvider = new ResteasyJackson2Provider() {};
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.setAnnotationIntrospector(new JacksonAnnotationIntrospector());
jacksonProvider.setMapper(objectMapper);
clientBuilder.register(jacksonProvider, 100);

client = clientBuilder.build();

Keycloak keycloak = KeycloakBuilder.builder()
  .serverUrl("http://localhost:8180/auth")
  .resteasyClient(client)
  .clientId("admin-cli")
  .realm("master")
  .username("admin")
  .password("admin")
  .build();

keycloak.realm("master").clients().findAll();



Cheers Felix


More information about the keycloak-user mailing list