1
votes

I didn't find anymore the guide on the extension quarkus-keycloak-admin-client.

My Version of Quarkus : 1.8.1.Final

Does someone have a source where I can have some example on how to use this extension ?

2

2 Answers

4
votes

The Keycloak Admin Client in Quarkus works exactly the same as in any other java app.

You can use Quarkus injection capabilities to help construct an injectable RealmResource :

public class KeycloakProvider {

@Inject
// Custom configuration class containing keycloak properties
KeycloakConfiguration keycloakConfiguration;

@ApplicationScoped
RealmResource provide() {
    Keycloak keycloak = KeycloakBuilder.builder()
            .serverUrl(keycloakConfiguration.getServerUrl())
            .realm(keycloakConfiguration.getRealm())
            .clientId(keycloakConfiguration.getClientId())
            .clientSecret(keycloakConfiguration.getClientSecret())
            .grantType(OAuth2Constants.CLIENT_CREDENTIALS)
            .build();

    return keycloak.realm(keycloakConfiguration.getRealm());
    }
}

And then use the realm resource to interact with your Keycloak realm, using the methods defined in the official documentation : https://www.keycloak.org/docs/11.0/api_documentation/

-1
votes

I hope that it's useful for you:

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