Keycloak admin client

Using the Keycloak admin client to access the Keycloak Admin REST API

The Keycloak admin client is a Java library that facilitates the access and usage of the Keycloak Admin REST API. To use it from your application add a dependency on the keycloak-admin-client library. For example using Maven:

<dependency>
    <groupId>org.keycloak</groupId>
    <artifactId>keycloak-admin-client</artifactId>
    <version>999.0.0-SNAPSHOT</version>
</dependency>

The following example shows how to use the Java client library to get the details of the master realm:

import org.keycloak.admin.client.Keycloak;
import org.keycloak.representations.idm.RealmRepresentation;
...

Keycloak keycloak = Keycloak.getInstance(
    "http://localhost:8080",
    "master",
    "admin",
    "password",
    "admin-cli");
RealmRepresentation realm = keycloak.realm("master").toRepresentation();

Complete Javadoc for the admin client is available at API Documentation.

On this page