### Get Keycloak Instance with Minimal Parameters
Source: https://www.keycloak.org/docs/latest/-api/26.4.0/javadocs/org/keycloak/admin/client/class-use/Keycloak
Demonstrates a simplified method for obtaining a Keycloak client instance with minimal required parameters. This overload is useful for quick setup when default values for optional parameters are acceptable. It includes server URL, realm, client ID, and SSL context.
```java
static Keycloak getInstance(String serverUrl, String realm, String clientId, SSLContext sllSslContext)
```
--------------------------------
### GET /admin/realms/{realm}/clients/{client-uuid}/installation/providers/{providerId}
Source: https://www.keycloak.org/docs/latest/-api/latest/rest-api/openapi
Retrieves the installation configuration for a specific client installation provider.
```APIDOC
## GET /admin/realms/{realm}/clients/{client-uuid}/installation/providers/{providerId}
### Description
Get the installation configuration for a client.
### Method
GET
### Endpoint
/admin/realms/{realm}/clients/{client-uuid}/installation/providers/{providerId}
### Parameters
#### Path Parameters
- **realm** (string) - Required - realm name (not id!)
- **client-uuid** (string) - Required - id of client (not client-id!)
- **providerId** (string) - Required - The ID of the installation provider.
### Response
#### Success Response (200)
- **OK** - The installation configuration.
```
--------------------------------
### Installation Provider API
Source: https://www.keycloak.org/docs/latest/-api/latest/javadocs/org/keycloak/admin/client/resource/ClientResource
Provides installation configurations for clients in various formats.
```APIDOC
## GET /websites/keycloak/installation/providers/{providerId}
### Description
Returns the installation provider configuration as a String. The content is typically in XML format specific to the requested provider.
### Method
GET
### Endpoint
/websites/keycloak/installation/providers/{providerId}
### Parameters
#### Path Parameters
- **providerId** (String) - Required - The ID of the installation provider (e.g., 'keycloak-oidc', 'keycloak-saml').
### Response
#### Success Response (200)
- **String** (String) - The installation configuration content as a string.
#### Response Example
```xml
my-realm
...
```
## GET /websites/keycloak/installation/providers/{providerId} (as Response)
### Description
Returns the installation provider configuration as a Jakarta Response object.
### Method
GET
### Endpoint
/websites/keycloak/installation/providers/{providerId}
### Parameters
#### Path Parameters
- **providerId** (String) - Required - The ID of the installation provider.
### Response
#### Success Response (200)
- **Response** (jakarta.ws.rs.core.Response) - The installation configuration as a Jakarta Response.
#### Response Example
(Response is a Jakarta Response object)
```
--------------------------------
### Client Installation Provider Methods (Java)
Source: https://www.keycloak.org/docs/latest/-api/26.4.0/javadocs/org/keycloak/protocol/docker/installation/DockerRegistryConfigFileInstallationProvider
Provides methods for generating and retrieving client installation details, including the installation response, protocol, display type, filename, help text, media type, and download-only status.
```java
public jakarta.ws.rs.core.Response generateInstallation(KeycloakSession session, RealmModel realm, ClientModel client, URI serverBaseUri)
```
```java
public String getProtocol()
```
```java
public String getDisplayType()
```
```java
public String getFilename()
```
```java
public String getMediaType()
```
```java
public boolean isDownloadOnly()
```
--------------------------------
### GET /admin/realms/{realm}/clients/{client-uuid}/evaluate-scopes/generate-example-access-token
Source: https://www.keycloak.org/docs/latest/-api/latest/rest-api/index
Generates an example access token for a client.
```APIDOC
## GET /admin/realms/{realm}/clients/{client-uuid}/evaluate-scopes/generate-example-access-token
### Description
Create JSON with payload of example access token.
### Method
GET
### Endpoint
`/admin/realms/{realm}/clients/{client-uuid}/evaluate-scopes/generate-example-access-token`
### Parameters
#### Path Parameters
- **realm** (string) - Required - realm name (not id!)
- **client-uuid** (string) - Required - id of client (not client-id!)
#### Query Parameters
- **audience** (string) - Optional - The audience for the token.
- **scope** (string) - Optional - The scope for the token.
- **userId** (string) - Optional - The ID of the user for whom the token is generated.
### Response
#### Success Response (200)
- **AccessToken** - The generated access token payload.
#### Error Response (403)
Forbidden
#### Error Response (404)
Not Found
```
--------------------------------
### GET /admin/realms/{realm}/clients/{client-uuid}/evaluate-scopes/generate-example-userinfo
Source: https://www.keycloak.org/docs/latest/-api/latest/rest-api/index
Generates an example user info payload for a client.
```APIDOC
## GET /admin/realms/{realm}/clients/{client-uuid}/evaluate-scopes/generate-example-userinfo
### Description
Create JSON with payload of example user info.
### Method
GET
### Endpoint
`/admin/realms/{realm}/clients/{client-uuid}/evaluate-scopes/generate-example-userinfo`
### Parameters
#### Path Parameters
- **realm** (string) - Required - realm name (not id!)
- **client-uuid** (string) - Required - id of client (not client-id!)
#### Query Parameters
- **scope** (string) - Optional - The scope for the user info.
- **userId** (string) - Optional - The ID of the user for whom the info is generated.
### Response
#### Success Response (200)
- **[Object]** - The generated user info payload.
#### Error Response (403)
Forbidden
```
--------------------------------
### GET /admin/realms/{realm}/clients/{client-uuid}/installation/providers/{providerId}
Source: https://www.keycloak.org/docs/latest/-api/latest/rest-api/index
Retrieves installation information for a specific client provider.
```APIDOC
## GET /admin/realms/{realm}/clients/{client-uuid}/installation/providers/{providerId}
### Description
Retrieves installation information for a specific client provider.
### Method
GET
### Endpoint
/admin/realms/{realm}/clients/{client-uuid}/installation/providers/{providerId}
### Parameters
#### Path Parameters
- **realm** (string) - Required - realm name (not id!)
- **client-uuid** (string) - Required - id of client (not client-id!)
- **providerId** (string) - Required -
### Response
#### Success Response (200)
- **installationData** (any) - The installation data for the provider.
#### Response Example
```json
{
"data": "string"
}
```
```
--------------------------------
### Get Installation Provider (Java)
Source: https://www.keycloak.org/docs/latest/-api/latest/javadocs/org/keycloak/services/resources/admin/ClientResource
Retrieves an installation provider for a client, identified by a provider ID. This method is accessed via a GET request at a specific path.
```java
@GET @Path("installation/providers/{providerId}") public jakarta.ws.rs.core.Response getInstallationProvider(@PathParam("providerId") String providerId)
```
--------------------------------
### Keycloak Client Initialization
Source: https://www.keycloak.org/docs/latest/-api/26.4.0/javadocs/org/keycloak/admin/client/class-use/Keycloak
Demonstrates various methods for building and initializing a Keycloak client instance.
```APIDOC
## Keycloak Admin Client Initialization
This section details the methods available for creating an instance of the Keycloak admin client.
### Methods
#### `KeycloakBuilder.build()`
* **Description**: Builds a new Keycloak client from the current builder configuration.
* **Method**: static
* **Returns**: `Keycloak`
#### `Keycloak.getInstance()` Overloads
These methods provide different ways to instantiate a `Keycloak` client, varying in the authentication and configuration parameters provided.
* **`static Keycloak getInstance(String serverUrl, String realm, String clientId, String authToken)`**
* **Description**: See `getInstance(String, String, String, String, String, String, SSLContext, Object, boolean, String, String)` for parameter details.
* **Method**: static
* **Returns**: `Keycloak`
* **`static Keycloak getInstance(String serverUrl, String realm, String username, String password, String clientId)`**
* **Description**: See `getInstance(String, String, String, String, String, String, SSLContext, Object, boolean, String, String)` for parameter details.
* **Method**: static
* **Returns**: `Keycloak`
* **`static Keycloak getInstance(String serverUrl, String realm, String username, String password, String clientId, String clientSecret)`**
* **Description**: See `getInstance(String, String, String, String, String, String, SSLContext, Object, boolean, String, String)` for parameter details.
* **Method**: static
* **Returns**: `Keycloak`
* **`static Keycloak getInstance(String serverUrl, String realm, String username, String password, String clientId, String clientSecret, SSLContext sslContext)`**
* **Description**: See `getInstance(String, String, String, String, String, String, SSLContext, Object, boolean, String, String)` for parameter details.
* **Method**: static
* **Returns**: `Keycloak`
* **`static Keycloak getInstance(String serverUrl, String realm, String username, String password, String clientId, String clientSecret, SSLContext sslContext, Object customJacksonProvider)`**
* **Description**: See `getInstance(String, String, String, String, String, String, SSLContext, Object, boolean, String, String)` for parameter details.
* **Method**: static
* **Returns**: `Keycloak`
* **`static Keycloak getInstance(String serverUrl, String realm, String username, String password, String clientId, String clientSecret, SSLContext sslContext, Object customJacksonProvider, boolean disableTrustManager, String authToken)`**
* **Description**: See `getInstance(String, String, String, String, String, String, SSLContext, Object, boolean, String, String)` for parameter details.
* **Method**: static
* **Returns**: `Keycloak`
* **`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)`**
* **Description**: Creates the java admin client instance to be used to call admin REST API against Keycloak server.
* **Method**: static
* **Returns**: `Keycloak`
* **`static Keycloak getInstance(String serverUrl, String realm, String clientId, String sslSslContext)`**
* **Description**: See `getInstance(String, String, String, String, String, String, SSLContext, Object, boolean, String, String)` for parameter details.
* **Method**: static
* **Returns**: `Keycloak`
* **`static Keycloak getInstance(String serverUrl, String realm, String username, String password, String clientId, SSLContext sslContext)`**
* **Description**: See `getInstance(String, String, String, String, String, String, SSLContext, Object, boolean, String, String)` for parameter details.
* **Method**: static
* **Returns**: `Keycloak`
```
--------------------------------
### Keycloak getInstallationProvider Method Detail (Java)
Source: https://www.keycloak.org/docs/latest/-api/26.4.0/javadocs/org/keycloak/admin/client/resource/ClientResource
This snippet illustrates the `getInstallationProvider` method of the Keycloak ClientResource interface. It retrieves the installation provider configuration as a String, typically in XML format, for a given provider ID. The method uses an HTTP GET request. It requires the Keycloak client libraries.
```java
@GET @Path("installation/providers/{providerId}") @Produces("application/json")
String getInstallationProvider(@PathParam("providerId") String providerId);
```
--------------------------------
### Get Installation Provider
Source: https://www.keycloak.org/docs/latest/-api/latest/javadocs/org/keycloak/services/resources/admin/ClientResource
Retrieves installation information for a specific provider of a client.
```APIDOC
## GET /websites/keycloak/clients/{id}/installation/providers/{providerId}
### Description
Retrieves installation information for a specific provider of a client.
### Method
GET
### Endpoint
`/websites/keycloak/clients/{id}/installation/providers/{providerId}`
### Parameters
#### Path Parameters
- **id** (string) - Required - The ID of the client.
- **providerId** (string) - Required - The ID of the installation provider (e.g., 'KEYCLOAK', 'saml-identity-provider').
### Response
#### Success Response (200)
- **Response** (object) - The installation configuration for the provider. The content type will vary based on the provider (e.g., JSON, XML).
#### Error Response (404)
- **404**: Client or provider not found.
```
--------------------------------
### POST /websites/keycloak/setupAdminCli
Source: https://www.keycloak.org/docs/latest/-api/latest/javadocs/org/keycloak/services/migration/DefaultMigrationProvider
Sets up necessary configurations for the admin CLI.
```APIDOC
## POST /websites/keycloak/setupAdminCli
### Description
Initializes or configures settings required for the Keycloak administration CLI. This operation ensures the admin CLI has the necessary environment to function correctly.
### Method
POST
### Endpoint
/websites/keycloak/setupAdminCli
### Parameters
#### Request Body
- **realm** (RealmModel) - Required - The realm for which to set up the admin CLI.
### Request Example
```json
{
"realm": { "id": "realm-id", "name": "myrealm" }
}
```
### Response
#### Success Response (200)
- **message** (String) - A confirmation message indicating successful setup.
#### Response Example
```json
{
"message": "Admin CLI setup completed successfully for realm 'myrealm'."
}
```
```
--------------------------------
### Client Installation Provider API
Source: https://www.keycloak.org/docs/latest/-api/latest/javadocs/org/keycloak/protocol/ClientInstallationProvider
This section details the methods available for generating client installation files.
```APIDOC
## Client Installation Provider API
### Description
Provides a template/sample client config adapter file. For example keycloak.json for our OIDC adapter. keycloak-saml.xml for our SAML client adapter.
### Methods
#### `generateInstallation`
* **Description**: Generates the installation file for a client adapter.
* **Method**: `POST` (Implied, as it generates a resource)
* **Endpoint**: `/clients/{clientId}/installation` (Assumed based on context)
* **Parameters**:
* **Path Parameters**:
* `clientId` (string) - Required - The ID of the client.
* **Query Parameters**:
* `session` (KeycloakSession) - Required - The Keycloak session object.
* `realm` (RealmModel) - Required - The realm model.
* `client` (ClientModel) - Required - The client model.
* `serverBaseUri` (URI) - Required - The base URI of the server.
* **Response**:
* **Success Response (200)**:
* `Response` (jakarta.ws.rs.core.Response) - The generated installation file.
#### `getProtocol`
* **Description**: Returns the protocol used by the client adapter.
* **Method**: `GET`
* **Endpoint**: `/clients/installation/protocol` (Assumed)
* **Response**:
* **Success Response (200)**:
* `String` - The protocol name.
#### `getDisplayType`
* **Description**: Returns the display type of the client adapter.
* **Method**: `GET`
* **Endpoint**: `/clients/installation/display-type` (Assumed)
* **Response**:
* **Success Response (200)**:
* `String` - The display type.
#### `getHelpText`
* **Description**: Returns the help text for the client adapter.
* **Method**: `GET`
* **Endpoint**: `/clients/installation/help-text` (Assumed)
* **Response**:
* **Success Response (200)**:
* `String` - The help text.
#### `getFilename`
* **Description**: Returns the default filename for the installation file.
* **Method**: `GET`
* **Endpoint**: `/clients/installation/filename` (Assumed)
* **Response**:
* **Success Response (200)**:
* `String` - The filename.
#### `getMediaType`
* **Description**: Returns the media type of the installation file.
* **Method**: `GET`
* **Endpoint**: `/clients/installation/media-type` (Assumed)
* **Response**:
* **Success Response (200)**:
* `String` - The media type.
#### `isDownloadOnly`
* **Description**: Indicates if the installation file is download-only.
* **Method**: `GET`
* **Endpoint**: `/clients/installation/download-only` (Assumed)
* **Response**:
* **Success Response (200)**:
* `boolean` - `true` if download-only, `false` otherwise.
```
--------------------------------
### Client Installation Provider Methods
Source: https://www.keycloak.org/docs/latest/-api/26.4.0/javadocs/org/keycloak/protocol/ClientInstallationProvider
This section details the methods available for interacting with the ClientInstallationProvider interface to generate client installation files.
```APIDOC
## ClientInstallationProvider API
### Description
The `ClientInstallationProvider` interface provides a way to generate template/sample client configuration adapter files. Examples include `keycloak.json` for OIDC adapters and `keycloak-saml.xml` for SAML client adapters.
### Methods
#### `generateInstallation`
* **Description**: Generates the installation configuration file.
* **Method**: `jakarta.ws.rs.core.Response`
* **Parameters**:
* `session` (KeycloakSession) - The Keycloak session.
* `realm` (RealmModel) - The realm model.
* `client` (ClientModel) - The client model.
* `serverBaseUri` (URI) - The base URI of the server.
#### `getDisplayType`
* **Description**: Gets the display type of the provider.
* **Method**: `String`
#### `getFilename`
* **Description**: Gets the filename for the generated installation file.
* **Method**: `String`
#### `getHelpText`
* **Description**: Gets the help text for the provider.
* **Method**: `String`
#### `getMediaType`
* **Description**: Gets the media type of the generated file.
* **Method**: `String`
#### `getProtocol`
* **Description**: Gets the protocol supported by this provider.
* **Method**: `String`
#### `isDownloadOnly`
* **Description**: Checks if the installation is download-only.
* **Method**: `boolean`
### Implementing Classes
* `DockerComposeYamlInstallationProvider`
* `DockerRegistryConfigFileInstallationProvider`
* `DockerVariableOverrideInstallationProvider`
* `KeycloakOIDCClientInstallation`
* `KeycloakOIDCJbossSubsystemClientCliInstallation`
* `KeycloakOIDCJbossSubsystemClientInstallation`
* `KeycloakSamlClientInstallation`
* `KeycloakSamlSubsystemCliInstallation`
* `KeycloakSamlSubsystemInstallation`
* `ModAuthMellonClientInstallation`
* `SamlSPDescriptorClientInstallation`
```
--------------------------------
### Get Session Start Time
Source: https://www.keycloak.org/docs/latest/-api/latest/javadocs/org/keycloak/models/sessions/infinispan/UserSessionAdapter
Returns the time when the user session was started, represented as an integer timestamp.
```java
int getStarted()
```
--------------------------------
### Admin CLI Setup
Source: https://www.keycloak.org/docs/latest/-api/latest/javadocs/org/keycloak/migration/MigrationProvider
This section details the API endpoint for setting up the admin CLI for a realm.
```APIDOC
## POST /realms/{realm}/admin-cli/setup
### Description
Sets up the admin CLI for the specified realm. This typically involves configuring necessary permissions or roles.
### Method
POST
### Endpoint
/realms/{realm}/admin-cli/setup
### Parameters
#### Path Parameters
- **realm** (string) - Required - The realm name.
### Request Body
None
### Response
#### Success Response (204)
No content, indicating successful setup.
#### Response Example
(No content)
```
--------------------------------
### GET /oauth/oob
Source: https://www.keycloak.org/docs/latest/-api/26.4.0/javadocs/org/keycloak/protocol/oidc/OIDCLoginProtocolService
Callback endpoint for installed applications.
```APIDOC
## GET /oauth/oob
### Description
This endpoint serves as a callback for installed applications using the OAuth 2.0 Out-Of-Band (OOB) flow.
### Method
`GET`
### Endpoint
`/oauth/oob`
### Parameters
#### Path Parameters
None
#### Query Parameters
- **code** (String) - Optional - The authorization code received.
- **error** (String) - Optional - The error code if the authorization failed.
- **error_description** (String) - Optional - A description of the error.
#### Request Body
None.
### Request Example
(No specific request body example provided in the source)
### Response
#### Success Response (200)
- **Response** (jakarta.ws.rs.core.Response) - The HTTP response, typically redirecting or returning status.
#### Response Example
(No specific response example provided in the source)
```
--------------------------------
### Get Filename (Java)
Source: https://www.keycloak.org/docs/latest/-api/latest/javadocs/org/keycloak/protocol/oidc/installation/KeycloakOIDCClientInstallation
Returns the default filename for the installation artifact. This method is part of the ClientInstallationProvider interface.
```java
public String getFilename()
```
--------------------------------
### KeyProviderFactory Interface
Source: https://www.keycloak.org/docs/latest/-api/latest/javadocs/org/keycloak/keys/KeyProviderFactory
Documentation for the KeyProviderFactory interface, including its methods like create, init, postInit, and close.
```APIDOC
## KeyProviderFactory Interface
### Description
The `KeyProviderFactory` interface defines the contract for factories that create `KeyProvider` instances. It extends `ComponentFactory` and `ProviderFactory`, inheriting their functionalities.
### Methods
#### `create(KeycloakSession session, ComponentModel model)`
- **Description**: Creates a new `KeyProvider` instance.
- **Method**: `T` (Return Type)
- **Parameters**:
- `session` (KeycloakSession) - The current Keycloak session.
- `model` (ComponentModel) - The model representing the component configuration.
#### `init(Config.Scope config)`
- **Description**: Initializes the factory. This method is called only once when the factory is first created.
- **Method**: `void`
- **Parameters**:
- `config` (Config.Scope) - The configuration scope for the factory.
#### `postInit(KeycloakSessionFactory factory)`
- **Description**: Called after all provider factories have been initialized.
- **Method**: `void`
- **Parameters**:
- `factory` (KeycloakSessionFactory) - The Keycloak session factory.
#### `close()`
- **Description**: This method is called when the server shuts down.
- **Method**: `void`
#### `createFallbackKeys(KeycloakSession session, KeyUse keyUse, String algorithm)`
- **Description**: Creates fallback keys for a given key usage and algorithm.
- **Method**: `boolean`
- **Parameters**:
- `session` (KeycloakSession) - The current Keycloak session.
- `keyUse` (KeyUse) - The type of key usage.
- `algorithm` (String) - The algorithm for the key.
### Inherited Methods
- **From `org.keycloak.component.ComponentFactory`**: `create`, `getCommonProviderConfigProperties`, `getTypeMetadata`, `onCreate`, `onUpdate`, `preRemove`, `validateConfiguration`
- **From `org.keycloak.provider.ConfiguredProvider`**: `getConfig`, `getConfigProperties`, `getHelpText`
- **From `org.keycloak.provider.ProviderFactory`**: `dependsOn`, `getConfigMetadata`, `getId`, `order`
```
--------------------------------
### InstallationAdapterConfig
Source: https://www.keycloak.org/docs/latest/-api/latest/rest-api/index
Configuration details for client adapters used in applications.
```APIDOC
## InstallationAdapterConfig
### Description
Contains configuration parameters for Keycloak client adapters, typically used in applications to integrate with Keycloak for authentication and authorization.
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None (This is a representation of an adapter configuration).
### Request Example
None
### Response
#### Success Response (200)
Represents the structure of an Installation Adapter Configuration.
- **realm** (String) - Optional - The realm name.
- **realm-public-key** (String) - Optional - The realm's public key.
- **auth-server-url** (String) - Optional - The URL of the Keycloak authentication server.
- **ssl-required** (String) - Optional - SSL requirement ('external', 'all', 'none').
- **bearer-only** (Boolean) - Optional - Whether the client is bearer-only.
- **resource** (String) - Optional - The client ID (resource name).
- **public-client** (Boolean) - Optional - Whether the client is public.
- **verify-token-audience** (Boolean) - Optional - Whether to verify token audience.
- **credentials** (Map of AnyType) - Optional - Client credentials.
- **use-resource-role-mappings** (Boolean) - Optional - Whether to use resource role mappings.
- **confidential-port** (Integer) - Optional - The confidential port for clients.
- **policy-enforcer** (PolicyEnforcerConfig) - Optional - Configuration for the policy enforcer.
#### Response Example
```json
{
"realm": "myrealm",
"auth-server-url": "https://keycloak.example.com/auth/",
"resource": "myclient",
"public-client": true,
"bearer-only": false
}
```
```
--------------------------------
### GET /websites/keycloak/clients/{id}/installation/providers/{providerId}
Source: https://www.keycloak.org/docs/latest/-api/26.4.0/javadocs/org/keycloak/services/resources/admin/ClientResource
Get the installation configuration for a specific provider for a client. This is useful for obtaining client configuration files for various platforms.
```APIDOC
## GET /clients/{id}/installation/providers/{providerId}
### Description
Get installation configuration for a provider.
### Method
GET
### Endpoint
/clients/{id}/installation/providers/{providerId}
### Parameters
#### Path Parameters
- **id** (string) - Required - The unique identifier of the client.
- **providerId** (string) - Required - The ID of the installation provider.
### Response
#### Success Response (200)
- **Response** (jakarta.ws.rs.core.Response) - The installation configuration response.
#### Response Example
(Response will be a Jakarta RESTful Web Services Response object containing installation details)
```
--------------------------------
### KeycloakSamlClientInstallation Constructor and Methods (Java)
Source: https://www.keycloak.org/docs/latest/-api/26.4.0/javadocs/org/keycloak/protocol/saml/installation/KeycloakSamlClientInstallation
This snippet details the constructor and various methods of the KeycloakSamlClientInstallation class. It includes methods for generating installation configurations, retrieving protocol and display information, and managing the lifecycle of the provider.
```java
public class KeycloakSamlClientInstallation extends Object implements ClientInstallationProvider {
public KeycloakSamlClientInstallation() {}
public static void baseXml(KeycloakSession session, RealmModel realm, ClientModel client, URI baseUri, SamlClient samlClient, StringBuilder buffer) {}
public void close() {}
public ClientInstallationProvider create(KeycloakSession session) {}
public jakarta.ws.rs.core.Response generateInstallation(KeycloakSession session, RealmModel realm, ClientModel client, URI baseUri) {}
public String getDisplayType() {}
public String getFilename() {}
public String getHelpText() {}
public String getId() {}
public String getMediaType() {}
public String getProtocol() {}
public void init(Config.Scope config) {}
public boolean isDownloadOnly() {}
public void postInit(KeycloakSessionFactory factory) {}
}
```
--------------------------------
### Get Media Type (Java)
Source: https://www.keycloak.org/docs/latest/-api/latest/javadocs/org/keycloak/protocol/oidc/installation/KeycloakOIDCClientInstallation
Returns the MIME type of the installation artifact. This method is required by the ClientInstallationProvider interface.
```java
public String getMediaType()
```
--------------------------------
### Get Protocol Type (Java)
Source: https://www.keycloak.org/docs/latest/-api/latest/javadocs/org/keycloak/protocol/oidc/installation/KeycloakOIDCClientInstallation
Returns the protocol identifier for this installation provider. This method is required by the ClientInstallationProvider interface.
```java
public String getProtocol()
```
--------------------------------
### Generate Example UserInfo
Source: https://www.keycloak.org/docs/latest/-api/latest/javadocs/org/keycloak/admin/client/resource/ClientScopeEvaluateResource
Generates an example user-info response based on scope and user ID parameters.
```APIDOC
## GET /websites/keycloak/generate-example-userinfo
### Description
Generate example user-info response. Endpoint simulates generating of the user-info as if the "scope" parameter with specified value is used for generating the access-token, which would then be used for the user-info request.
### Method
GET
### Endpoint
/websites/keycloak/generate-example-userinfo
### Parameters
#### Query Parameters
- **scope** (String) - Optional - Value of the "scope" parameter. Could be null.
- **userId** (String) - Required - User ID
### Response
#### Success Response (200)
- **Map** (Object) - A map containing user information.
#### Response Example
{
"example": "{\"sub\": \"a1b2c3d4-...\", \"name\": \"John Doe\", \"email\": \"john.doe@example.com\"}"
}
```
--------------------------------
### UserSessionRepresentation: Get Session Start Time
Source: https://www.keycloak.org/docs/latest/-api/latest/javadocs/org/keycloak/representations/idm/UserSessionRepresentation
Retrieves the timestamp indicating when the user session started. This method is part of the UserSessionRepresentation class.
```java
public long getStart()
```
--------------------------------
### DefaultLiquibaseConnectionProvider Initialization Methods
Source: https://www.keycloak.org/docs/latest/-api/26.4.0/javadocs/org/keycloak/connections/jpa/updater/liquibase/conn/DefaultLiquibaseConnectionProvider
This snippet focuses on the initialization methods within the DefaultLiquibaseConnectionProvider. It includes `init` for factory creation, `postInit` for post-initialization tasks, and `baseLiquibaseInitialization` for core Liquibase setup.
```java
public void init(Config.Scope config)
public void postInit(KeycloakSessionFactory factory)
protected void baseLiquibaseInitialization()
```
--------------------------------
### Get Session Started Time - Java
Source: https://www.keycloak.org/docs/latest/-api/26.4.0/javadocs/org/keycloak/representations/account/SessionRepresentation
Retrieves the timestamp indicating when the session was started. This method returns an integer representing the time.
```java
public int getStarted()
```
--------------------------------
### Keycloak getInstallationProviderAsResponse Method Detail (Java)
Source: https://www.keycloak.org/docs/latest/-api/26.4.0/javadocs/org/keycloak/admin/client/resource/ClientResource
This snippet shows the `getInstallationProviderAsResponse` method from the Keycloak ClientResource interface. It returns the installation provider configuration as a Jakarta Response object for a specified provider ID. This method uses an HTTP GET request. It requires the Keycloak client libraries.
```java
import jakarta.ws.rs.core.Response;
@GET @Path("installation/providers/{providerId}")
Response getInstallationProviderAsResponse(@PathParam("providerId") String providerId);
```
--------------------------------
### Get Started (Java)
Source: https://www.keycloak.org/docs/latest/-api/26.4.0/javadocs/org/keycloak/models/sessions/infinispan/entities/RemoteAuthenticatedClientSessionEntity
Retrieves the time when the client session was initially started, often represented as a Unix timestamp. This helps in calculating session duration.
```java
@ProtoField(10) public int getStarted()
```
--------------------------------
### InstallationAdapterConfig
Source: https://www.keycloak.org/docs/latest/-api/26.4.0/rest-api
Represents the configuration for client adapters used for integration with applications.
```APIDOC
## InstallationAdapterConfig
### Description
Configuration object for Keycloak client adapters, typically used in application configuration files.
### Fields
- **realm** (String) - Optional - The name of the realm.
- **realm-public-key** (String) - Optional - The public key of the realm, used for token validation.
- **auth-server-url** (String) - Optional - The URL of the Keycloak authentication server.
- **ssl-required** (String) - Optional - SSL configuration ('external', 'all', 'none').
- **bearer-only** (Boolean) - Optional - Whether the client is bearer-only.
- **resource** (String) - Optional - The client ID (resource name) for this adapter.
- **public-client** (Boolean) - Optional - Whether the client is a public client.
- **verify-token-audience** (Boolean) - Optional - Whether to verify the audience of incoming tokens.
- **credentials** (Map of AnyType) - Optional - Credentials for confidential clients.
- **use-resource-role-mappings** (Boolean) - Optional - Whether to use resource role mappings.
- **confidential-port** (Integer) - Optional - The port for confidential clients.
- **policy-enforcer** (PolicyEnforcerConfig) - Optional - Configuration for the policy enforcer.
```
--------------------------------
### Get Keycloak Instance with Client Secret
Source: https://www.keycloak.org/docs/latest/-api/26.4.0/javadocs/org/keycloak/admin/client/class-use/Keycloak
Provides an example of getting a Keycloak client instance with server URL, realm, username, password, client ID, and client secret. This approach is often used for service-to-service authentication. The method supports advanced configurations such as SSL context and disabling trust manager.
```java
static Keycloak getInstance(String serverUrl, String realm, String username, String password, String clientId, String clientSecret)
```
--------------------------------
### Method Details: postInit()
Source: https://www.keycloak.org/docs/latest/-api/26.4.0/javadocs/org/keycloak/storage/datastore/DefaultDatastoreProviderFactory
Details the public void postInit(KeycloakSessionFactory factory) method, noting it's called after all provider factories have been initialized, as specified by the ProviderFactory interface.
```java
public void postInit(KeycloakSessionFactory factory)
Description copied from interface: ProviderFactory
Called after all provider factories have been initialized
Specified by:
postInit in interface ProviderFactory
```
--------------------------------
### Check if Keycloak is a New Install (Java)
Source: https://www.keycloak.org/docs/latest/-api/latest/javadocs/org/keycloak/services/managers/ApplianceBootstrap
This method checks if the current Keycloak installation is new. It returns a boolean value: true if it's a new installation, and false otherwise. This can be used to determine if initial setup steps are required.
```java
public boolean isNewInstall()
```
--------------------------------
### generateInstallation Method (Java)
Source: https://www.keycloak.org/docs/latest/-api/latest/javadocs/org/keycloak/protocol/oidc/installation/KeycloakOIDCJbossSubsystemClientInstallation
Generates the installation configuration response for a client. This method is part of the ClientInstallationProvider interface and is responsible for creating the necessary output format.
```java
public jakarta.ws.rs.core.Response generateInstallation(KeycloakSession session, RealmModel realm, ClientModel client, URI baseUri)
```
--------------------------------
### InfinispanUserSessionProviderFactory Method Summary (Java)
Source: https://www.keycloak.org/docs/latest/-api/latest/javadocs/org/keycloak/models/sessions/infinispan/InfinispanUserSessionProviderFactory
Details the instance methods of the InfinispanUserSessionProviderFactory, including initialization, session creation, configuration retrieval, and cluster listener registration. It also lists inherited methods from java.lang.Object.
```java
void close()
UserSessionProvider create(KeycloakSession session)
Set> dependsOn()
protected Long deriveOfflineClientSessionCacheEntryLifespanOverrideMs(RealmModel realm, ClientModel client, AuthenticatedClientSessionEntity entity)
protected Long deriveOfflineSessionCacheEntryLifespanMs(RealmModel realm, ClientModel client, UserSessionEntity entity)
List getConfigMetadata()
String getId()
Map getOperationalInfo()
void init(Config.Scope config)
void initializePersisterLastSessionRefreshStore(KeycloakSessionFactory sessionFactory)
boolean isSupported(Config.Scope config)
int order()
void postInit(KeycloakSessionFactory factory)
protected void registerClusterListeners(KeycloakSession session)
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
```
--------------------------------
### Installed App URN Callback Handler in Java
Source: https://www.keycloak.org/docs/latest/-api/26.4.0/javadocs/org/keycloak/protocol/oidc/OIDCLoginProtocolService
Handles GET requests at the /oauth/oob path for installed application URN callbacks. It processes 'code', 'error', and 'error_description' query parameters.
```java
@Path("oauth/oob") @GET public jakarta.ws.rs.core.Response installedAppUrnCallback(@QueryParam("code") String code, @QueryParam("error") String error, @QueryParam("error_description") String errorDescription)
```
--------------------------------
### Keycloak LDAP Provider Post-Initialization Method
Source: https://www.keycloak.org/docs/latest/-api/26.4.0/javadocs/org/keycloak/services/resources/admin/LdapServerCapabilitiesRealmAdminProvider
The `postInit` method is invoked after all provider factories have been initialized. This allows for setting up dependencies or performing actions that rely on other initialized providers.
```java
public void postInit(KeycloakSessionFactory factory)
// Description copied from interface: ProviderFactory
// Called after all provider factories have been initialized
```
--------------------------------
### GET /websites/keycloak/oauth/oob
Source: https://www.keycloak.org/docs/latest/-api/latest/javadocs/org/keycloak/protocol/oidc/OIDCLoginProtocolService
Callback endpoint for installed applications using the OAuth Out-of-Band flow.
```APIDOC
## GET /websites/keycloak/oauth/oob
### Description
This endpoint serves as a callback URL for installed applications utilizing the OAuth Out-of-Band (OOB) flow. It receives authorization codes or error information.
### Method
GET
### Endpoint
/websites/keycloak/oauth/oob
### Parameters
#### Path Parameters
None
#### Query Parameters
- **code** (String) - Optional - The authorization code granted by the server.
- **error** (String) - Optional - An error code if the authorization failed.
- **error_description** (String) - Optional - A description of the error.
#### Request Body
None
### Request Example
```json
{
"example": "GET /websites/keycloak/oauth/oob?code=AUTHORIZATION_CODE"
}
```
### Response
#### Success Response (200)
- **jakarta.ws.rs.core.Response** (jakarta.ws.rs.core.Response) - The response indicating the outcome of the callback.
#### Response Example
```json
{
"example": ""
}
```
```
--------------------------------
### Docker Compose YAML Installation Provider API
Source: https://www.keycloak.org/docs/latest/-api/latest/javadocs/org/keycloak/protocol/docker/installation/DockerComposeYamlInstallationProvider
This section details the methods available for the Docker Compose YAML Installation Provider, including installation generation and configuration retrieval.
```APIDOC
## Docker Compose YAML Installation Provider API
### Description
Provides functionality to generate Docker Compose YAML installation files for clients within Keycloak.
### Methods
#### `create(KeycloakSession session)`
- **Method**: `POST` (Implied, as it's a factory method)
- **Endpoint**: `/installation/docker-compose` (Hypothetical endpoint for creation)
- **Description**: Creates an instance of the `DockerComposeYamlInstallationProvider`.
- **Parameters**:
- `session` (KeycloakSession) - Required - The current Keycloak session.
#### `generateInstallation(KeycloakSession session, RealmModel realm, ClientModel client, URI serverBaseUri)`
- **Method**: `GET` (Implied, for retrieving installation)
- **Endpoint**: `/realms/{realm}/clients/{client}/installation/docker-compose`
- **Description**: Generates the Docker Compose YAML installation for a specific client.
- **Parameters**:
- **Path Parameters**:
- `realm` (String) - Required - The name of the realm.
- `client` (String) - Required - The client ID.
- **Query Parameters**:
- `serverBaseUri` (URI) - Required - The base URI of the Keycloak server.
#### `generateInstallation(ZipOutputStream zipOutput, ByteArrayOutputStream byteStream, Certificate realmCert, URL realmBaseURl, String realmName, String clientName)`
- **Method**: `POST` (Implied, for custom generation)
- **Endpoint**: `/installation/custom/docker-compose` (Hypothetical endpoint)
- **Description**: Generates the Docker Compose YAML installation with custom parameters.
- **Parameters**:
- `zipOutput` (ZipOutputStream) - Required - The output stream for the zip file.
- `byteStream` (ByteArrayOutputStream) - Required - A byte array output stream.
- `realmCert` (Certificate) - Required - The realm's certificate.
- `realmBaseURl` (URL) - Required - The base URL of the realm.
- `realmName` (String) - Required - The name of the realm.
- `clientName` (String) - Required - The name of the client.
- **Throws**: `IOException`
#### `getProtocol()`
- **Method**: `GET`
- **Endpoint**: `/protocol/docker-compose` (Hypothetical endpoint)
- **Description**: Returns the protocol identifier for Docker Compose installations.
- **Returns**: `String` - The protocol name.
#### `getDisplayType()`
- **Method**: `GET`
- **Endpoint**: `/display-type/docker-compose` (Hypothetical endpoint)
- **Description**: Returns the display type for this installation provider.
- **Returns**: `String` - The display type.
#### `getFilename()`
- **Method**: `GET`
- **Endpoint**: `/filename/docker-compose` (Hypothetical endpoint)
- **Description**: Returns the default filename for the generated installation file.
- **Returns**: `String` - The filename.
#### `getHelpText()`
- **Method**: `GET`
- **Endpoint**: `/help-text/docker-compose` (Hypothetical endpoint)
- **Description**: Returns help text related to Docker Compose installations.
- **Returns**: `String` - The help text.
#### `getMediaType()`
- **Method**: `GET`
- **Endpoint**: `/media-type/docker-compose` (Hypothetical endpoint)
- **Description**: Returns the media type of the generated installation file.
- **Returns**: `String` - The media type.
#### `isDownloadOnly()`
- **Method**: `GET`
- **Endpoint**: `/download-only/docker-compose` (Hypothetical endpoint)
- **Description**: Indicates if the installation is download-only.
- **Returns**: `boolean` - True if download-only, false otherwise.
```
--------------------------------
### Keycloak Instance Initialization
Source: https://www.keycloak.org/docs/latest/-api/26.4.0/javadocs/org/keycloak/admin/client/Keycloak
Provides various overloaded methods to create an instance of the Keycloak admin client, allowing configuration for server URL, realm, authentication credentials, SSL context, and more.
```APIDOC
## POST /websites/keycloak/instance
### Description
Initializes and returns an instance of the Keycloak admin client. This method is overloaded to provide flexibility in configuration.
### Method
POST
### Endpoint
/websites/keycloak/instance
### Parameters
#### Request Body
- **serverUrl** (string) - Required - Keycloak server URL
- **realm** (string) - Required - Realm name
- **username** (string) - Optional - Username of the admin user
- **password** (string) - Optional - Password of the admin user
- **clientId** (string) - Optional - Client ID
- **clientSecret** (string) - Optional - Client secret for client authentication
- **sslContext** (object) - Optional - SSL context for secure connections
- **customJacksonProvider** (object) - Optional - Custom Jackson provider for JSON serialization
- **disableTrustManager** (boolean) - Optional - Disables SSL trust manager (use with caution, false by default)
- **authToken** (string) - Optional - Pre-existing access token for authentication
- **scope** (string) - Optional - Custom scope parameter
### Request Example
```json
{
"serverUrl": "http://localhost:8080/auth",
"realm": "myrealm",
"username": "admin",
"password": "password",
"clientId": "admin-cli"
}
```
### Response
#### Success Response (200)
- **keycloakInstance** (object) - An initialized Keycloak admin client instance.
#### Response Example
```json
{
"message": "Keycloak instance created successfully."
}
```
```
--------------------------------
### GET /admin/realms/{realm}/clients/{client-uuid}/evaluate-scopes/generate-example-id-token
Source: https://www.keycloak.org/docs/latest/-api/latest/rest-api/index
Generates an example ID token for a client.
```APIDOC
## GET /admin/realms/{realm}/clients/{client-uuid}/evaluate-scopes/generate-example-id-token
### Description
Create JSON with payload of example id token.
### Method
GET
### Endpoint
`/admin/realms/{realm}/clients/{client-uuid}/evaluate-scopes/generate-example-id-token`
### Parameters
#### Path Parameters
- **realm** (string) - Required - realm name (not id!)
- **client-uuid** (string) - Required - id of client (not client-id!)
#### Query Parameters
- **audience** (string) - Optional - The audience for the token.
- **scope** (string) - Optional - The scope for the token.
- **userId** (string) - Optional - The ID of the user for whom the token is generated.
### Response
#### Success Response (200)
- **IDToken** - The generated ID token payload.
#### Error Response (403)
Forbidden
#### Error Response (404)
Not Found
```