Package org.keycloak.admin.client
Class Keycloak
java.lang.Object
org.keycloak.admin.client.Keycloak
- All Implemented Interfaces:
AutoCloseable
Provides a Keycloak client. By default, this implementation uses a the default RestEasy client builder settings.
To customize the underling client, use a
KeycloakBuilder
to create a Keycloak client.
To read Responses, you can use CreatedResponseUtil
for objects created- Author:
- rodrigo.sasaki@icarros.com.br
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the underlying client.static ResteasyClientProvider
static Keycloak
getInstance
(String serverUrl, String realm, String clientId, String authToken) SeegetInstance(String, String, String, String, String, String, SSLContext, Object, boolean, String, String)
for the details about the parameters and their default valuesstatic Keycloak
SeegetInstance(String, String, String, String, String, String, SSLContext, Object, boolean, String, String)
for the details about the parameters and their default valuesstatic Keycloak
getInstance
(String serverUrl, String realm, String username, String password, String clientId, String clientSecret) SeegetInstance(String, String, String, String, String, String, SSLContext, Object, boolean, String, String)
for the details about the parameters and their default valuesstatic Keycloak
getInstance
(String serverUrl, String realm, String username, String password, String clientId, String clientSecret, SSLContext sslContext) SeegetInstance(String, String, String, String, String, String, SSLContext, Object, boolean, String, String)
for the details about the parameters and their default valuesstatic Keycloak
getInstance
(String serverUrl, String realm, String username, String password, String clientId, String clientSecret, SSLContext sslContext, Object customJacksonProvider) SeegetInstance(String, String, String, String, String, String, SSLContext, Object, boolean, String, String)
for the details about the parameters and their default valuesstatic Keycloak
getInstance
(String serverUrl, String realm, String username, String password, String clientId, String clientSecret, SSLContext sslContext, Object customJacksonProvider, boolean disableTrustManager, String authToken) SeegetInstance(String, String, String, String, String, String, SSLContext, Object, boolean, String, String)
for the details about the parameters and their default valuesstatic Keycloak
getInstance
(String serverUrl, String realm, String username, String password, String clientId, String clientSecret, SSLContext sslContext, Object customJacksonProvider, boolean disableTrustManager, String authToken, String scope) Creates the java admin client instance to be used to call admin REST API against Keycloak server.static Keycloak
getInstance
(String serverUrl, String realm, String username, String password, String clientId, SSLContext sslContext) SeegetInstance(String, String, String, String, String, String, SSLContext, Object, boolean, String, String)
for the details about the parameters and their default valuesstatic Keycloak
getInstance
(String serverUrl, String realm, String clientId, String authToken, SSLContext sllSslContext) SeegetInstance(String, String, String, String, String, String, SSLContext, Object, boolean, String, String)
for the details about the parameters and their default valuesboolean
isClosed()
<T> T
Create a secure proxy based on an absolute URI.realms()
static void
setClientProvider
(ResteasyClientProvider provider)
-
Method Details
-
setClientProvider
-
getClientProvider
-
getInstance
public static Keycloak getInstance(String serverUrl, String realm, String username, String password, String clientId, String clientSecret, SSLContext sslContext, Object customJacksonProvider, boolean disableTrustManager, String authToken, String scope) Creates the java admin client instance to be used to call admin REST API against Keycloak server.- Parameters:
serverUrl
- Keycloak server URLrealm
- realm nameusername
- username of the admin user to be used.password
- password of the admin userclientId
- client IDclientSecret
- client secret. Could be left null in case that clientId parameter points to the public client, which does not require client authenticationsslContext
- ssl context. Could be left null in case that default SSL context should be used.customJacksonProvider
- custom Jackson provider. Could be left null in case that Jackson provider will be automatically provided by the admin client. Please see the documentation for additional details regarding the compatibilitydisableTrustManager
- If to disable trust manager for SSL checks. It is false by default. The value true should be used just for the development purposes, but should not be used in productionauthToken
- access token to be used to call admin REST API. This can be left null if you want admin client to login the user (based on the parameters username, password, clientId and clientSecret) and manage it's own login session. But in case you already have existing session, you can inject the existing access token with the use of this parameter. In that case, it is recommended to leave the properties username, password, clientId or clientSecret emptyscope
- Custom "scope" parameter to be used. Could be left null in case of default scope should be used. That is sufficient for most of the cases.- Returns:
- Java admin client instance
-
getInstance
public static Keycloak getInstance(String serverUrl, String realm, String username, String password, String clientId, String clientSecret, SSLContext sslContext, Object customJacksonProvider, boolean disableTrustManager, String authToken) SeegetInstance(String, String, String, String, String, String, SSLContext, Object, boolean, String, String)
for the details about the parameters and their default values -
getInstance
public static Keycloak getInstance(String serverUrl, String realm, String username, String password, String clientId, String clientSecret) SeegetInstance(String, String, String, String, String, String, SSLContext, Object, boolean, String, String)
for the details about the parameters and their default values -
getInstance
public static Keycloak getInstance(String serverUrl, String realm, String username, String password, String clientId, String clientSecret, SSLContext sslContext) SeegetInstance(String, String, String, String, String, String, SSLContext, Object, boolean, String, String)
for the details about the parameters and their default values -
getInstance
public static Keycloak getInstance(String serverUrl, String realm, String username, String password, String clientId, String clientSecret, SSLContext sslContext, Object customJacksonProvider) SeegetInstance(String, String, String, String, String, String, SSLContext, Object, boolean, String, String)
for the details about the parameters and their default values -
getInstance
public static Keycloak getInstance(String serverUrl, String realm, String username, String password, String clientId) SeegetInstance(String, String, String, String, String, String, SSLContext, Object, boolean, String, String)
for the details about the parameters and their default values -
getInstance
public static Keycloak getInstance(String serverUrl, String realm, String username, String password, String clientId, SSLContext sslContext) SeegetInstance(String, String, String, String, String, String, SSLContext, Object, boolean, String, String)
for the details about the parameters and their default values -
getInstance
public static Keycloak getInstance(String serverUrl, String realm, String clientId, String authToken) SeegetInstance(String, String, String, String, String, String, SSLContext, Object, boolean, String, String)
for the details about the parameters and their default values -
getInstance
public static Keycloak getInstance(String serverUrl, String realm, String clientId, String authToken, SSLContext sllSslContext) SeegetInstance(String, String, String, String, String, String, SSLContext, Object, boolean, String, String)
for the details about the parameters and their default values -
realms
-
realm
-
serverInfo
-
tokenManager
-
proxy
Create a secure proxy based on an absolute URI. All set up with appropriate token- Type Parameters:
T
-- Parameters:
proxyClass
-absoluteURI
-- Returns:
-
close
public void close()Closes the underlying client. After calling this method, thisKeycloak
instance cannot be reused.- Specified by:
close
in interfaceAutoCloseable
-
isClosed
public boolean isClosed()- Returns:
- true if the underlying client is closed.
-