org.keycloak.admin.client

## Class KeycloakBuilder

- java.lang.Object
- - org.keycloak.admin.client.KeycloakBuilder

-     public class KeycloakBuilder
      extends Object

  Provides a `Keycloak` client builder with the ability to customize the underlying `RESTEasy client` used to communicate with the Keycloak server.

  Example usage with a connection pool size of 20:

         Keycloak keycloak = KeycloakBuilder.builder()
           .serverUrl("https://sso.example.com/auth")
           .realm("realm")
           .username("user")
           .password("pass")
           .clientId("client")
           .clientSecret("secret")
           .resteasyClient(new ResteasyClientBuilder().connectionPoolSize(20).build())
           .build();

  Example usage with grant_type=client_credentials

         Keycloak keycloak = KeycloakBuilder.builder()
           .serverUrl("https://sso.example.com/auth")
           .realm("example")
           .grantType(OAuth2Constants.CLIENT_CREDENTIALS)
           .clientId("client")
           .clientSecret("secret")
           .build();

  Author:
    Scott Rossillo
  See Also:
    `ResteasyClientBuilder`

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `KeycloakBuilder` | `authorization(String auth)`
    `Keycloak` | `build()` Builds a new Keycloak client from this builder.
    `static KeycloakBuilder` | `builder()` Returns a new Keycloak builder.
    `KeycloakBuilder` | `clientId(String clientId)`
    `KeycloakBuilder` | `clientSecret(String clientSecret)`
    `KeycloakBuilder` | `grantType(String grantType)`
    `KeycloakBuilder` | `password(String password)`
    `KeycloakBuilder` | `realm(String realm)`
    `KeycloakBuilder` | `resteasyClient(org.jboss.resteasy.client.jaxrs.ResteasyClient resteasyClient)`
    `KeycloakBuilder` | `serverUrl(String serverUrl)`
    `KeycloakBuilder` | `username(String username)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### serverUrl

          public KeycloakBuilder serverUrl(String serverUrl)

    - #### realm

          public KeycloakBuilder realm(String realm)

    - #### grantType

          public KeycloakBuilder grantType(String grantType)

    - #### username

          public KeycloakBuilder username(String username)

    - #### password

          public KeycloakBuilder password(String password)

    - #### clientId

          public KeycloakBuilder clientId(String clientId)

    - #### clientSecret

          public KeycloakBuilder clientSecret(String clientSecret)

    - #### resteasyClient

          public KeycloakBuilder resteasyClient(org.jboss.resteasy.client.jaxrs.ResteasyClient resteasyClient)

    - #### authorization

          public KeycloakBuilder authorization(String auth)

    - #### build

          public Keycloak build()

      Builds a new Keycloak client from this builder.

    - #### builder

          public static KeycloakBuilder builder()

      Returns a new Keycloak builder.

Copyright © 2021 JBoss by Red Hat. All rights reserved.