### System Configuration Example
Source: https://github.com/mayope/keycloakmigration/blob/master/docsbuild/themes/book/exampleSite/content/_index.md
This code snippet demonstrates a system configuration setup. It involves reading file data and initializing a sidebar engine device with various parameters.
```javascript
var panel = ram_design;
if (backup + system) {
file.readPoint = network_native;
sidebar_engine_device(cell_tftp_raster,
dual_login_paper.adf_vci.application_reader_design(
graphicsNvramCdma, lpi_footer_snmp, integer_model));
}
```
--------------------------------
### Info Hint Example
Source: https://github.com/mayope/keycloakmigration/blob/master/docsbuild/themes/book/exampleSite/content/docs/shortcodes/hints.md
An example of using the hint shortcode with the 'info' color option to display a message.
```html
{{< hint info >}}
**Markdown content**
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
{{< /hint >}}
```
--------------------------------
### Add Organization Migration Example
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/migrations/organization/index.html
This example demonstrates how to add a new organization with a specified name and domain. The 'alias' and 'redirectUrl' parameters are optional.
```yaml
id: add-organization
author: isaac.mercieca
changes:
- addOrganization:
name: test
domains:
- name: test.com
```
--------------------------------
### Warning Hint Example
Source: https://github.com/mayope/keycloakmigration/blob/master/docsbuild/themes/book/exampleSite/content/docs/shortcodes/hints.md
An example of using the hint shortcode with the 'warning' color option to display a message.
```html
{{< hint warning >}}
**Markdown content**
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
{{< /hint >}}
```
--------------------------------
### Add Role Migration Example
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/migrations/role/index.html
Demonstrates how to add a new role to Keycloak, including specifying attributes. This is useful for initial role setup or creating new roles programmatically.
```yaml
id: add-role
author: klg71
changes:
- addRole:
realm: master
name: test3
attributes:
role:
- value1
- value2
```
--------------------------------
### Danger Hint Example
Source: https://github.com/mayope/keycloakmigration/blob/master/docsbuild/themes/book/exampleSite/content/docs/shortcodes/hints.md
An example of using the hint shortcode with the 'danger' color option to display a message.
```html
{{< hint danger >}}
**Markdown content**
Lorem markdownum insigne. Olympo signis Delphis! Retexi Nereius nova develat
stringit, frustra Saturnius uteroque inter! Oculis non ritibus Telethusa
{{< /hint >}}
```
--------------------------------
### Add User Realm Role Mapper Example
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/migrations/mapper/index.html
This example demonstrates how to add a user realm role mapper to a client. It specifies the client ID, the mapper name, and a prefix for the role.
```yaml
id: add-client-mappers
author: klg71
realm: integ-test
changes:
- addSimpleClient:
clientId: testMappers
- addUserRealmRoleMapper:
clientId: testMappers
name: userRealmRole
prefix: rolePrefix
```
--------------------------------
### Button Shortcode Examples
Source: https://github.com/mayope/keycloakmigration/blob/master/docsbuild/themes/book/exampleSite/content/docs/shortcodes/buttons.md
Demonstrates how to use the button shortcode for internal and external links. The first example shows linking to the home page using `relref`, and the second shows linking to an external GitHub repository using `href`. Optional CSS classes can be passed as the first argument.
```html
{{* button relref="/" [class="..."] */>}}Get Home{{* /button */>}}
```
```html
{{* button href="https://github.com/alex-shpak/hugo-book" */>}}Contribute{{* /button */>}}
```
--------------------------------
### Update Role Migration Example
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/migrations/role/index.html
Shows how to update an existing role in Keycloak, allowing modification of its description and attributes. This example also includes adding a role first, demonstrating a common workflow.
```yaml
id: add-role
author: klg71
changes:
- addRole:
realm: master
name: test3
- updateRole:
realm: master
name: test3
description: I am a test role
attributes:
role:
- value1
- value2
```
--------------------------------
### Update Required Action Migration Example
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/migrations/requiredactions/index.html
This example demonstrates how to register and update a required action using a migration file. It shows the structure for defining changes related to required actions, including specifying provider IDs, aliases, and names.
```yaml
id: add-required-action
author: klg71
realm: integ-test
changes:
- registerRequiredAction:
providerId: verify-email
name: Verify Email
- updateRequiredAction:
providerId: verify-email
alias: VERIFY_EMAIL
name: Verify Email 2
```
--------------------------------
### Show Keycloak Migration Tool Help
Source: https://github.com/mayope/keycloakmigration/blob/master/README.md
Invoke the fat jar with the --help argument to display all available command-line options and their descriptions. This is useful for understanding configuration parameters.
```bash
java -jar keycloakmigration.jar --help
```
--------------------------------
### ChangeSet Example
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/migration_files/index.html
Illustrates a changeset file, which contains the actual migration actions. It includes parameters like id, author, realm, and a list of changes.
```yaml
id: initial-keycloak
author: klg71
realm: master
changes:
- addUser:
name: test
enabled: true
emailVerified: true
attributes:
test:
- test
- test2
- updateUser:
realm: otherRealm
name: test
enabled: false
lastName: Lukas
```
--------------------------------
### Basic Hugo Command Line Example
Source: https://github.com/mayope/keycloakmigration/blob/master/docsbuild/themes/book/exampleSite/content/posts/creating-a-new-theme.md
Demonstrates basic command-line operations in Hugo, including creating a file with front matter and displaying its content.
```bash
## this is a comment
$ echo this is a command
this is a command
## edit the file
$ vi foo.md
+++
date = "2014-09-28"
title = "creating a new theme"
+++
bah and humbug
:wq
## show it
$ cat foo.md
+++
date = "2014-09-28"
title = "creating a new theme"
+++
bah and humbug
$
```
--------------------------------
### Keycloakmigration JAR Usage with Arguments
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/quickstart/jar/index.html
Example of running the Keycloakmigration JAR with various arguments. This demonstrates how to specify user, password, base URL, realm, client, and custom parameters for the migration.
```bash
java -jar keycloakmigration.jar -u USER -p PASSWORD -b BASEURL -r REALM -c CLIENT --correct-hashes -k PARAMETER=value
```
--------------------------------
### Delete User Federation Example
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/migrations/userfederation/index.html
Example of deleting a user federation configuration. Ensure the realm and name match your existing configuration.
```yaml
id: delete-ad-ldap
author: klg71
changes:
- deleteUserFederation:
realm: integ-test
name: testLdap
```
--------------------------------
### Serve Hugo Site with Book Theme
Source: https://github.com/mayope/keycloakmigration/blob/master/docsbuild/themes/book/README.md
Starts a local Hugo development server with the Book theme applied. Use the --minify flag for a production-like build during development.
```bash
hugo server --minify --theme book
```
--------------------------------
### Create New Hugo Site with Book Theme
Source: https://github.com/mayope/keycloakmigration/blob/master/docsbuild/themes/book/README.md
Scaffolds a new Hugo site, initializes it as a Git repository, adds the Book theme as a submodule, and copies example content.
```sh
hugo new site mydocs; cd mydocs
git init
git submodule add https://github.com/alex-shpak/hugo-book themes/book
cp -R themes/book/exampleSite/content .
```
--------------------------------
### Add Organization Migration Example
Source: https://github.com/mayope/keycloakmigration/blob/master/docsbuild/content/migrations/organization.md
Example of an 'addOrganization' migration change. This configuration adds a new organization with a specified name and domain.
```yaml
id: add-organization
author: isaac.mercieca
changes:
- addOrganization:
name: test
domains:
- name: test.com
```
--------------------------------
### executeIt()
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/documentation/keycloakmigration/de.klg71.keycloakmigration.changeControl.actions/-action/index.html
Executes the migration action.
```APIDOC
## executeIt()
### Description
Executes the Action.
### Method
fun executeIt()
```
--------------------------------
### initKeycloakClient
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/documentation/keycloakapi/de.klg71.keycloakmigration.keycloakapi/init-keycloak-client.html
Builds the KeycloakClient with the provided configuration.
```APIDOC
## initKeycloakClient
### Description
Builds the [KeycloakClient](-keycloak-client/index.html)
### Function Signature
fun initKeycloakClient(baseUrl: String, adminUser: String, adminPassword: String, adminUseOauth: Boolean, adminUseOauthLocalPort: Int, realm: String, clientId: String, clientSecret: String? = null, loginWithClientCredentials: Boolean = false, logger: Logger? = null, totp: String = "", tokenOffsetMs: Long = 1000): KeycloakClient
### Parameters
#### Path Parameters
- **baseUrl** (String) - Required - The base URL of the Keycloak instance.
- **adminUser** (String) - Required - The username for Keycloak administration.
- **adminPassword** (String) - Required - The password for Keycloak administration.
- **adminUseOauth** (Boolean) - Required - Whether to use OAuth for admin authentication.
- **adminUseOauthLocalPort** (Int) - Required - The local port to use for OAuth.
- **realm** (String) - Required - The Keycloak realm name.
- **clientId** (String) - Required - The client ID for authentication.
- **clientSecret** (String) - Optional - The client secret for authentication.
- **loginWithClientCredentials** (Boolean) - Optional - Whether to log in with client credentials. Defaults to false.
- **logger** (Logger) - Optional - A logger instance for logging. Defaults to null.
- **totp** (String) - Optional - The Time-based One-Time Password. Defaults to "".
- **tokenOffsetMs** (Long) - Optional - Offset in milliseconds for token expiration. Defaults to 1000.
```
--------------------------------
### Delete Required Action Example
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/migrations/defaultrequiredactions/index.html
This example demonstrates how to delete a required action, specifically the 'VERIFY_EMAIL' action, from Keycloak. It includes adding the action first and then deleting it.
```yaml
id: delete-required-action
author: klg71
realm: integ-test
changes:
- addRequiredAction:
providerId: verify-email
alias: VERIFY_EMAIL
name: Verify Email
defaultAction: true
enabled: true
- deleteRequiredAction:
alias: VERIFY_EMAIL
```
--------------------------------
### Start Hugo Development Server
Source: https://github.com/mayope/keycloakmigration/blob/master/docsbuild/themes/book/exampleSite/content/posts/creating-a-new-theme.md
Run the Hugo development server to preview your site. It will output logs and the URL to access the site in your browser.
```bash
$ hugo server --verbose
INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
WARN: 2014/09/29 Unable to locate layout: [404.html]
0 draft content
0 future content
0 pages created
0 tags created
0 categories created
in 2 ms
Serving pages from /Users/quoha/Sites/zafta/public
Web Server is available at http://localhost:1313
Press Ctrl+C to stop
```
--------------------------------
### Build and Verify Static Site
Source: https://github.com/mayope/keycloakmigration/blob/master/docsbuild/themes/book/exampleSite/content/posts/creating-a-new-theme.md
Build the Hugo site using the --verbose flag to see detailed build information. Then, verify the generated index.html file using find and cat commands.
```bash
$ hugo --verbose
INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
0 draft content
0 future content
0 pages created
0 tags created
0 categories created
in 2 ms
$ find public -type f -name '*.html' | xargs ls -l
-rw-r--r-- 1 quoha staff 78 Sep 29 21:26 public/index.html
$ cat public/index.html
hugo says hello!
```
--------------------------------
### Parameter Substitution Example
Source: https://github.com/mayope/keycloakmigration/blob/master/docsbuild/content/migration_files.md
Demonstrates using environment variable substitution within migration files. `${JAVA_HOME}` will be replaced by the system's JAVA_HOME variable at runtime.
```yaml
id: initial-keycloak
author: klg71
realm: master
changes:
- addUser:
name: test
enabled: true
emailVerified: true
attributes:
test:
- ${JAVA_HOME}
- test2
```
--------------------------------
### Get Flows
Source: https://github.com/mayope/keycloakmigration/blob/master/docsbuild/static/documentation/keycloakapi/index-outline.html
Retrieves all authentication flows for a realm.
```APIDOC
## GET /realms/{realm}/authentication/flows
### Description
Retrieves a list of all available authentication flows within a specified realm.
### Method
GET
### Endpoint
/realms/{realm}/authentication/flows
### Parameters
#### Path Parameters
- **realm** (String) - Required - The name of the realm.
```
--------------------------------
### initKeycloakLoginClient
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/documentation/keycloakapi/de.klg71.keycloakmigration.keycloakapi/init-keycloak-login-client.html
Builds the KeycloakLoginClient. Only build this if you just need a token and don't need any other keycloak resources. initKeycloakClient automatically acquires tokens.
```APIDOC
## fun initKeycloakLoginClient(baseUrl: String, logger: Logger? = null): KeycloakLoginClient
### Description
Builds the KeycloakLoginClient. Only build this if you just need a token and don't need any other keycloak resources. initKeycloakClient automatically acquires tokens.
### Parameters
#### Path Parameters
- **baseUrl** (String) - Required - base url of the keycloak instance e.g. http://localhost:8080/auth
- **logger** (Logger?) - Optional - logger instance
```
--------------------------------
### Get Client
Source: https://github.com/mayope/keycloakmigration/blob/master/docsbuild/static/documentation/keycloakapi/de.klg71.keycloakmigration.keycloakapi/-keycloak-client/index.html
Retrieves details for a specific client.
```APIDOC
## client
### Description
Retrieves details for a specific client.
### Method
GET (Assumed, based on typical API patterns for retrieval)
### Endpoint
`/admin/realms/{realm}/clients/{clientId}` (Assumed structure)
### Parameters
#### Path Parameters
- **realm** (String) - Required - The name of the realm.
- **clientId** (UUID) - Required - The ID of the client.
### Response
#### Success Response (200 OK)
- **id** (UUID) - The unique identifier of the client.
- **clientId** (String) - The client identifier.
- **name** (String) - The name of the client.
- ... (other client details)
#### Response Example
```json
{
"id": "client-uuid",
"clientId": "my-client",
"name": "My Application",
"baseUrl": "http://localhost:8080/my-app"
}
```
```
--------------------------------
### Get User
Source: https://github.com/mayope/keycloakmigration/blob/master/docsbuild/static/documentation/keycloakapi/index-outline.html
Retrieves a specific user by their ID from a realm.
```APIDOC
## GET USER
### Description
Retrieves a specific user by their ID from a realm.
### Method
GET
### Endpoint
`/realms/{realm}/users/{userId}` (Assumed structure)
### Parameters
#### Path Parameters
- **realm** (String) - Required - The name of the realm.
- **userId** (UUID) - Required - The ID of the user to retrieve.
### Response
#### Success Response (200 OK)
- **user** (User) - The user object containing user details.
#### Response Example
```json
{
"id": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
"username": "testuser",
"firstName": "Test",
"lastName": "User"
}
```
```
--------------------------------
### Keycloak Migration Tool Command-Line Arguments
Source: https://github.com/mayope/keycloakmigration/blob/master/README.md
This is the output of the --help command, detailing optional and positional arguments for the Keycloak Migration Tool. Configure user credentials, Keycloak base URL, realm, client, and migration file.
```text
usage: [-h] [-u USER] [-p PASSWORD] [-b BASEURL] [MIGRATION-FILE] [-r REALM]
[-c CLIENT] [--correct-hashes] [-k PARAMETER]... [--wait-for-keycloak]
[--wait-for-keycloak-timeout WAIT_FOR_KEYCLOAK_TIMEOUT]
optional arguments:
-h, --help show this help message and exit
-u USER, --user USER Username for the migration user, defaulting to admin.
-p PASSWORD, --password PASSWORD Password for the migration user, defaulting to admin.
-b BASEURL, --baseurl BASEURL Base url of keycloak server, defaulting to
http://localhost:18080/auth.
-r REALM, --realm REALM Realm to use for migration, defaulting to master
-c CLIENT, --client CLIENT Client to use for
migration,
defaulting to master
--correct-hashes Correct hashes to most recent version, defaulting to false
Just choose this option if you didn't change anything in
the changelog since the last migration!
This will replace all old hashes with the new hash version
and can be omitted next time the migration is run.
See README.md for further explanation!
-k PARAMETER, --parameter PARAMETER Parameters to substitute in changelog, syntax is:
-k param1=value1
will replace
${param1} with
value1 in changelog
--wait-for-keycloak Wait for Keycloak to become ready.
--wait-for-keycloak-timeout WAIT_FOR_KEYCLOAK_TIMEOUT Wait for Keycloak to become ready timeout in seconds (defaulting to 0=infinit).
--fail-on-undefined-variables Fail if variables could not be replaced, defaulting to false.
--warn-on-undefined-variables Fail if variables could not bereplaced, to true.
positional arguments:
MIGRATION-FILE File to migrate, defaulting to keycloak-changelog.yml
```
--------------------------------
### initKeycloakClient
Source: https://github.com/mayope/keycloakmigration/blob/master/docsbuild/static/documentation/keycloakapi/de.klg71.keycloakmigration.keycloakapi/index.html
Initializes a Keycloak client with the provided configuration.
```APIDOC
## initKeycloakClient
### Description
Initializes a Keycloak client with the provided configuration.
### Method
`initKeycloakClient(baseUrl: String, adminUser: String, adminPassword: String, adminUseOauth: Boolean, adminUseOauthLocalPort: Int, realm: String, clientId: String, clientSecret: String? = null, loginWithClientCredentials: Boolean = false, logger: Logger? = null, totp: String = "", tokenOffsetMs: Long = 1000)`
### Parameters
- **baseUrl** (String) - The base URL of the Keycloak instance.
- **adminUser** (String) - The username for Keycloak administration.
- **adminPassword** (String) - The password for Keycloak administration.
- **adminUseOauth** (Boolean) - Whether to use OAuth for admin authentication.
- **adminUseOauthLocalPort** (Int) - The local port to use for OAuth.
- **realm** (String) - The target realm.
- **clientId** (String) - The client ID for authentication.
- **clientSecret** (String?) - The client secret for authentication (optional).
- **loginWithClientCredentials** (Boolean) - Whether to log in using client credentials (defaults to false).
- **logger** (Logger?) - An optional logger instance.
- **totp** (String) - Time-based One-Time Password for authentication (defaults to "").
- **tokenOffsetMs** (Long) - Offset in milliseconds for token refresh (defaults to 1000).
### Returns
- [KeycloakClient](-keycloak-client/index.html) - An initialized Keycloak client instance.
```
--------------------------------
### Get Roles
Source: https://github.com/mayope/keycloakmigration/blob/master/docsbuild/static/documentation/keycloakapi/index-outline.html
Retrieves a list of roles for a specified realm.
```APIDOC
## GET /roles
### Description
Retrieves a list of roles for a specified realm.
### Method
GET
### Endpoint
/roles
### Parameters
#### Query Parameters
- **realm** (String) - Required - The name of the realm.
### Response
#### Success Response (200)
- **roles** (List) - A list of role items.
```
--------------------------------
### Get Client Mappers
Source: https://github.com/mayope/keycloakmigration/blob/master/docsbuild/static/documentation/keycloakapi/index-outline.html
Retrieves the mappers for a specific client.
```APIDOC
## clientMappers
### Description
Retrieves the mappers for a specific client.
### Method
GET
### Endpoint
`/realms/{realm}/clients/{clientId}/protocolmappers/models`
### Parameters
#### Path Parameters
- **realm** (String) - Required - The name of the realm.
- **clientId** (UUID) - Required - The ID of the client.
### Response
#### Success Response (200)
- **mappers** (List) - A list of mappers associated with the client.
- **id** (UUID) - The mapper's ID.
- **name** (String) - The mapper's name.
- **protocol** (String) - The protocol associated with the mapper.
```
--------------------------------
### Keycloak Migration JAR Help and Arguments
Source: https://github.com/mayope/keycloakmigration/blob/master/docsbuild/content/quickstart/jar.md
Display help and available arguments for the Keycloak migration JAR. This shows options for specifying user credentials, Keycloak base URL, realm, client, and migration parameters.
```shell
java -jar keycloakmigration.jar --help
usage: [-h] [-u USER] [-p PASSWORD] [-b BASEURL] [MIGRATION-FILE] [-r REALM]
[-c CLIENT] [--correct-hashes] [-k PARAMETER]... [--wait-for-keycloak]
[--wait-for-keycloak-timeout WAIT_FOR_KEYCLOAK_TIMEOUT]
optional arguments:
-h, --help show this help message and exit
-u USER, --user USER Username for the migration user, defaulting to admin.
-p PASSWORD, --password PASSWORD Password for the migration user, defaulting to admin.
-b BASEURL, --baseurl BASEURL Base url of keycloak server, defaulting to
http://localhost:18080/auth.
-r REALM, --realm REALM Realm to use for migration, defaulting to master
-c CLIENT, --client CLIENT Client to use for
migration,
defaulting to master
--correct-hashes Correct hashes to most recent version, defaulting to false
Just choose this option if you didn't change anything in
the changelog since the last migration!
This will replace all old hashes with the new hash version
and can be omitted next time the migration is run.
See README.md for further explanation!
-k PARAMETER, --parameter PARAMETER Parameters to substitute in changelog, syntax is:
-k param1=value1
will replace
${param1} with
value1 in changelog
--wait-for-keycloak Wait for Keycloak to become ready.
--wait-for-keycloak-timeout WAIT_FOR_KEYCLOAK_TIMEOUT Wait for Keycloak to become ready timeout in seconds (defaulting to 0=infinit).
--fail-on-undefined-variables Fail if variables could not be replaced, defaulting to false.
--warn-on-undefined-variables warn if variables could not bereplaced, defaulting to true.
positional arguments:
MIGRATION-FILE File to migrate, defaulting to keycloak-changelog.yml
Available migrations are listed here: [Migrations]({{[}})
```
--------------------------------
### Chaining Actions with Pipes
Source: https://github.com/mayope/keycloakmigration/blob/master/docsbuild/themes/book/exampleSite/content/posts/goisforlovers.md
Demonstrates how to chain actions using pipes, where the output of one action becomes the input of the next. This is useful for complex operations and function calls.
```go-template
{{ if eq 1 1 }} Same {{ end }}
```
```go-template
{{ eq 1 1 | if }} Same {{ end }}
```
--------------------------------
### Get User
Source: https://github.com/mayope/keycloakmigration/blob/master/docsbuild/static/documentation/keycloakapi/de.klg71.keycloakmigration.keycloakapi/-keycloak-client/index.html
Retrieves details for a specific user by their ID.
```APIDOC
## GET /admin/realms/{realm}/users/{userId}
### Description
Retrieves details for a specific user by their ID.
### Method
GET
### Endpoint
/admin/realms/{realm}/users/{userId}
### Parameters
#### Path Parameters
- **realm** (String) - Required - The name of the realm.
- **userId** (UUID) - Required - The ID of the user to retrieve.
```
--------------------------------
### Get All Roles
Source: https://github.com/mayope/keycloakmigration/blob/master/docsbuild/static/documentation/keycloakapi/de.klg71.keycloakmigration.keycloakapi/-keycloak-client/index.html
Retrieves a list of all roles within a realm.
```APIDOC
## roles
### Description
Retrieves a list of all roles within a realm.
### Method
GET
### Endpoint
`/admin/realms/{realm}/roles` (Assumed structure based on typical Keycloak API patterns)
### Parameters
#### Path Parameters
- **realm** (String) - Required - The name of the realm.
### Response
#### Success Response (200)
- **List** (List) - A list of role summary objects.
```
--------------------------------
### migrationFile
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/documentation/keycloakmigration/de.klg71.keycloakmigration/-migration-args/migration-file.html
Abstract function to get the migration file path.
```APIDOC
## migrationFile
### Description
Abstract function to retrieve the path to the migration file.
### Method
abstract fun
### Signature
migrationFile(): String
### Returns
A String representing the path to the migration file.
```
--------------------------------
### Get Realm by ID
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/documentation/keycloakapi/de.klg71.keycloakmigration.keycloakapi/-keycloak-client/index.html
Retrieves a realm by its unique identifier.
```APIDOC
## GET /realms/{id}
### Description
Fetches a realm using its unique ID.
### Method
GET
### Endpoint
/realms/{id}
### Parameters
#### Path Parameters
- **id** (String) - Required - The ID of the realm.
### Response
#### Success Response (200)
- **Realm** - The realm object.
```
--------------------------------
### initKeycloakClient
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/documentation/navigation.html
Initializes a Keycloak client instance.
```APIDOC
## initKeycloakClient()
### Description
Initializes and returns a Keycloak client instance for API interactions.
### Method
POST
### Endpoint
/keycloak/client/init
```
--------------------------------
### build()
Source: https://github.com/mayope/keycloakmigration/blob/master/docsbuild/static/documentation/keycloakapi/de.klg71.keycloakmigration.keycloakapi.model/-realm-update-builder/build.html
Constructs and returns the configured Realm object.
```APIDOC
## build()
### Description
Constructs and returns the configured Realm object.
### Signature
```kotlin
fun build(): Realm
```
### Returns
A `Realm` object representing the configured realm.
```
--------------------------------
### Get Clients
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/documentation/keycloakapi/de.klg71.keycloakmigration.keycloakapi/-keycloak-client/index.html
Retrieves a list of all clients within the realm.
```APIDOC
## clients
### Description
Retrieves a list of all clients in the realm.
### Parameters
#### Path Parameters
- **realm** (String) - Required - The name of the realm.
### Response
#### Success Response (200)
- **List** - A list of client list items.
```
--------------------------------
### Get Client Roles
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/documentation/keycloakapi/de.klg71.keycloakmigration.keycloakapi/-keycloak-client/index.html
Retrieves all roles associated with a client.
```APIDOC
## clientRoles
### Description
Retrieves all roles belonging to a specific client.
### Parameters
#### Path Parameters
- **realm** (String) - Required - The name of the realm.
- **clientId** (UUID) - Required - The UUID of the client.
### Response
#### Success Response (200)
- **List** - A list of role list items.
```
--------------------------------
### Keycloak Migration Execution in Kotlin
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/contributing/index.html
Example of how to execute Keycloak migrations using the library in Kotlin. It demonstrates setting up migration arguments and calling the migration function.
```kotlin
class MyMigrationArgs(private val adminUser: String,
private val adminPassword: String,
private val migrationFile: String,
private val baseUrl: String,
private val realm: String,
private val clientId: String,
private val correctHashes: Boolean,
private val parameters: Map) : MigrationArgs {
override fun adminUser() = adminUser
override fun adminPassword() = adminPassword
override fun baseUrl() = baseUrl
override fun migrationFile() = migrationFile
override fun realm() = realm
override fun clientId() = clientId
override fun correctHashes() = correctHashes
override fun parameters() = parameters
}
class KeycloakMigrationExecution {
fun migrate() {
MyMigrationArgs("admin", "adminPass", "keycloak-changelog.yml",
"https://myauthserver", "master",
"admin-cli", false, emptyMap())
.let {
de.klg71.keycloakmigration.migrate(it)
}
}
}
```
--------------------------------
### Get Client Mappers
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/documentation/keycloakapi/de.klg71.keycloakmigration.keycloakapi/-keycloak-client/index.html
Retrieves all mappers associated with a client.
```APIDOC
## clientMappers
### Description
Retrieves the mappers for a given client.
### Parameters
#### Path Parameters
- **realm** (String) - Required - The name of the realm.
- **clientId** (UUID) - Required - The UUID of the client.
### Response
#### Success Response (200)
- **List** - A list of mappers.
```
--------------------------------
### Changelog Example
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/migration_files/index.html
Defines the structure of a changelog file, listing changesets to be applied. Supports 'includes' for referencing other changeset files.
```yaml
includes:
- path: 01_initial.yml
- path: 02_second.yml
- path: changes/03_third.yml
relativeToFile: true
```
--------------------------------
### Build Hugo Documentation Site
Source: https://github.com/mayope/keycloakmigration/blob/master/docsbuild/themes/book/exampleSite/content/posts/hugoisforlovers.md
Commands to clone the Hugo repository, navigate into it, and run the Hugo server to build the documentation site. This allows you to view the documentation locally.
```bash
git clone https://github.com/spf13/hugo
cd hugo
/path/to/where/you/installed/hugo server --source=./docs
> 29 pages created
> 0 tags index created
> in 27 ms
> Web Server is available at http://localhost:1313
> Press ctrl+c to stop
```
--------------------------------
### Get Authentication Flows
Source: https://github.com/mayope/keycloakmigration/blob/master/docsbuild/static/documentation/keycloakapi/index-outline.html
Retrieves all authentication flows available in a realm.
```APIDOC
## GET AUTHENTICATION FLOWS
### Description
Retrieves a list of all available authentication flows within a realm.
### Method
GET
### Endpoint
`/realms/{realm}/authentication/flows`
### Parameters
#### Path Parameters
- **realm** (String) - Required - The name of the realm.
```
--------------------------------
### From Existing Configuration
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/documentation/navigation.html
Function to create configurations based on existing resources.
```APIDOC
## From Existing Configuration
### Description
Creates new configurations by referencing or copying from existing ones.
### Function
- **fromExisting()**: Initializes a configuration based on an existing resource.
```
--------------------------------
### Get Client
Source: https://github.com/mayope/keycloakmigration/blob/master/docsbuild/static/documentation/keycloakapi/index-outline.html
Retrieves details of a specific client within a realm.
```APIDOC
## Get Client
### Description
Retrieves details of a specific client.
### Method
GET
### Endpoint
`/realms/{realm}/clients/{clientId}`
### Parameters
#### Path Parameters
- **realm** (String) - Required - The name of the realm.
- **clientId** (UUID) - Required - The ID of the client.
```
--------------------------------
### Get All Users
Source: https://github.com/mayope/keycloakmigration/blob/master/docsbuild/static/documentation/keycloakapi/index-outline.html
Retrieves a list of all users within a specified realm.
```APIDOC
## GET /users
### Description
Retrieves a list of all users within a specified realm.
### Method
GET
### Endpoint
/admin/realms/{realm}/users
### Parameters
#### Path Parameters
- **realm** (String) - Required - The name of the realm.
#### Response
#### Success Response (200)
- **users** (List) - A list of all users in the realm.
```
--------------------------------
### Execute Keycloakmigration JAR
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/quickstart/jar/index.html
Run the Keycloakmigration tool by executing its fat JAR file. This is the primary command to start the migration process.
```bash
java -jar keycloakmigration-x.x.x-fat.jar
```
--------------------------------
### Client Initialization Functions
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/documentation/keycloakmigration/navigation.html
Functions for initializing Keycloak clients.
```APIDOC
## initKeycloakClient()
### Description
Initializes a Keycloak client.
### Method
Not specified (likely a function call within the SDK)
### Endpoint
Not applicable (SDK function)
### Parameters
- **keycloakConfig** (KeycloakConfig) - Required - The configuration for the Keycloak client.
### Response
- **KeycloakClient** - The initialized Keycloak client.
## initKeycloakLoginClient()
### Description
Initializes a Keycloak login client.
### Method
Not specified (likely a function call within the SDK)
### Endpoint
Not applicable (SDK function)
### Parameters
- **keycloakConfig** (KeycloakConfig) - Required - The configuration for the Keycloak login client.
### Response
- **KeycloakLoginClient** - The initialized Keycloak login client.
```
--------------------------------
### Get Server Info
Source: https://github.com/mayope/keycloakmigration/blob/master/docsbuild/static/documentation/keycloakapi/de.klg71.keycloakmigration.keycloakapi/-keycloak-client/index.html
Retrieves general information about the Keycloak server.
```APIDOC
## serverInfo
### Description
Retrieves general information about the Keycloak server.
### Method
GET
### Endpoint
/serverinfo
### Response
#### Success Response (200)
- **ServerInfo** - An object containing server information.
```
--------------------------------
### build()
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/documentation/keycloakapi/de.klg71.keycloakmigration.keycloakapi.model/-realm-update-builder/build.html
Constructs and returns a Realm object.
```APIDOC
## build()
### Description
Constructs and returns a Realm object.
### Signature
```kotlin
fun build(): Realm
```
```
--------------------------------
### ChangeLog.includes Property
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/documentation/keycloakmigration/de.klg71.keycloakmigration.changeControl.model/-change-log/index.html
Gets the list of ChangeSetEntry items included in this ChangeLog.
```APIDOC
## ChangeLog.includes Property
### Description
Gets the list of ChangeSetEntry items included in this ChangeLog.
### Property Signature
val includes: List
```
--------------------------------
### Get Realm Names
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/documentation/keycloakapi/de.klg71.keycloakmigration.keycloakapi/-keycloak-client/index.html
Retrieves a list of all available realm names.
```APIDOC
## GET /realm-names
### Description
Retrieves a list of all realm names configured in Keycloak.
### Method
GET
### Endpoint
/realm-names
### Response
#### Success Response (200)
- **List** - A list of realm name objects.
```
--------------------------------
### Get All Organizations
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/documentation/keycloakapi/de.klg71.keycloakmigration.keycloakapi/-keycloak-client/index.html
Retrieves a list of all organizations within a specific realm.
```APIDOC
## GET /organizations
### Description
Retrieves a list of all organizations available in the specified realm.
### Method
GET
### Endpoint
/realms/{realm}/organizations
### Parameters
#### Path Parameters
- **realm** (String) - Required - The name of the realm.
### Response
#### Success Response (200)
- **List** - A list of organization objects.
```
--------------------------------
### build()
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/documentation/keycloakapi/de.klg71.keycloakmigration.keycloakapi.model/-update-user-builder/build.html
Builds and returns the configured User object.
```APIDOC
## build()
### Description
Constructs and returns the User object based on the builder's configuration.
### Signature
```kotlin
fun build(): User
```
### Returns
A [User](../-user/index.html) object representing the configured user.
```
--------------------------------
### myModule Function
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/documentation/keycloakmigration/de.klg71.keycloakmigration/index.html
Initializes dependency injection and creates beans based on provided parameters for Keycloak integration.
```APIDOC
fun myModule(
adminUser: String,
adminPassword: String,
adminTotp: String,
adminUseOauth: Boolean,
adminUseOauthLocalPort: Int,
baseUrl: String,
realm: String,
clientId: String,
clientSecret: String?,
loginWithClientCredentials: Boolean,
parameters: Map,
failOnUndefinedVariabled: Boolean,
warnOnUndefinedVariables: Boolean,
logger: Logger? = null
): Module
```
--------------------------------
### Get Clients
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/documentation/keycloakapi/de.klg71.keycloakmigration.keycloakapi/-keycloak-client/index.html
Retrieves a list of all clients within a specified realm.
```APIDOC
## Get Clients
### Description
Retrieves a list of all clients within a specified realm.
### Method
GET (Implied)
### Endpoint
/realms/{realm}/clients
### Parameters
#### Path Parameters
- **realm** (string) - Required - The name of the realm.
### Response
#### Success Response (200)
- **List[ClientListItem]** - A list of client items.
```
--------------------------------
### Add User Migration Example
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/migrations/user/index.html
Demonstrates how to add a new user to Keycloak, including specifying attributes, groups, and roles. This migration fails if a user with the same name already exists.
```yaml
id: test
author: klg71
changes:
- addUser:
realm: master
name: test
enabled: true
email: test@example.de
emailVerified: true
attributes:
test:
- test
- test2
groups:
- testGroup
realmRoles:
- testRealmRole
clientRoles:
- client: testClient
role: testClientRole
```
--------------------------------
### Get Client Role
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/documentation/keycloakapi/de.klg71.keycloakmigration.keycloakapi/-keycloak-client/index.html
Retrieves a specific client role by its ID.
```APIDOC
## clientRole
### Description
Retrieves a specific client role by its ID.
### Parameters
#### Path Parameters
- **realm** (String) - Required - The name of the realm.
- **clientId** (UUID) - Required - The UUID of the client.
- **roleId** (UUID) - Required - The UUID of the role.
### Response
#### Success Response (200)
- **Role** (Role) - Details of the client role.
```
--------------------------------
### Get ClientSecret Value
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/documentation/keycloakapi/de.klg71.keycloakmigration.keycloakapi.model/-client-secret/value.html
Retrieves the string representation of the client secret.
```APIDOC
## Get ClientSecret Value
### Description
Retrieves the string value of the client secret.
### Method
Getter
### Endpoint
N/A (Object property access)
### Parameters
None
### Request Example
```kotlin
val clientSecretValue: String = clientSecretObject.value
```
### Response
#### Success Response
- **value** (String) - The secret string.
```
--------------------------------
### Client Constructor
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/documentation/keycloakapi/de.klg71.keycloakmigration.keycloakapi.model/-client/-client.html
Represents a Keycloak client with various configuration options.
```APIDOC
## Client Constructor
### Description
Constructs a new Client object with detailed configuration for Keycloak integration.
### Parameters
* **id** (UUID) - Required - The unique identifier for the client.
* **clientId** (String) - Required - The client's identifier string.
* **name** (String?) - Optional - The display name of the client.
* **description** (String?) - Optional - A description for the client.
* **surrogateAuthRequired** (Boolean) - Required - Indicates if surrogate authentication is required.
* **enabled** (Boolean) - Required - Whether the client is enabled.
* **alwaysDisplayInConsole** (Boolean) - Optional, defaults to false - Whether to always display the client in the console.
* **clientAuthenticatorType** (String) - Required - The type of client authenticator.
* **redirectUris** (List) - Required - A list of valid redirect URIs.
* **webOrigins** (List) - Required - A list of allowed web origins.
* **notBefore** (Int) - Required - The time before which the token is not valid.
* **bearerOnly** (Boolean) - Required - Whether the client is bearer-only.
* **consentRequired** (Boolean) - Required - Whether user consent is required.
* **standardFlowEnabled** (Boolean) - Required - Whether the standard OAuth 2.0 flow is enabled.
* **implicitFlowEnabled** (Boolean) - Required - Whether the implicit OAuth 2.0 flow is enabled.
* **directAccessGrantsEnabled** (Boolean) - Required - Whether direct access grants are enabled.
* **serviceAccountsEnabled** (Boolean) - Required - Whether service accounts are enabled.
* **publicClient** (Boolean) - Required - Whether the client is public.
* **frontchannelLogout** (Boolean) - Required - Whether front-channel logout is enabled.
* **protocol** (String?) - Optional - The protocol used by the client.
* **attributes** (Map) - Required - Custom attributes for the client.
* **authenticationFlowBindingOverrides** (Map) - Required - Overrides for authentication flows.
* **authorizationServicesEnabled** (Boolean) - Required - Whether authorization services are enabled.
* **fullScopeAllowed** (Boolean) - Required - Whether full scope is allowed.
* **nodeReRegistrationTimeout** (Int) - Required - Timeout for node re-registration.
* **protocolMappers** (List?) - Optional - List of protocol mappers.
* **defaultClientScopes** (List) - Required - List of default client scopes.
* **optionalClientScopes** (List) - Required - List of optional client scopes.
* **access** (ClientAccess) - Required - Client access information.
* **baseUrl** (String?) - Optional - The base URL for the client.
* **adminUrl** (String?) - Optional - The admin URL for the client.
* **secret** (String?) - Optional - The client secret.
* **rootUrl** (String?) - Optional - The root URL for the client.
```
--------------------------------
### Get ClientScope Description
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/documentation/keycloakapi/de.klg71.keycloakmigration.keycloakapi.model/-client-scope/description.html
Retrieves the description of a ClientScope. This is a nullable String.
```APIDOC
## Get ClientScope Description
### Description
Retrieves the description of a ClientScope. This is a nullable String.
### Method Signature
val description: String?
### Return Type
String? - The description of the client scope, or null if not set.
```
--------------------------------
### Keycloak Migration Fat Jar Command-Line Options
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/index.html
This output details the various command-line arguments for the Keycloak migration fat jar. It covers options for authentication, server configuration, realm and client selection, and advanced features like hash correction and variable substitution.
```bash
usage: [-h] [-u USER] [-p PASSWORD] [-t TOTP] [-o] [-P]... [-b BASEURL]
[MIGRATION-FILE] [-r REALM] [-c CLIENT] [--correct-hashes]
[-k PARAMETER]... [--wait-for-keycloak]
[--wait-for-keycloak-timeout WAIT_FOR_KEYCLOAK_TIMEOUT]
[--fail-on-undefined-variables] [--disable-warn-on-undefined-variables]
optional arguments:
-h, --help show this help message
and exit
-u USER, --user USER Username for the
migration user,
defaulting to admin.
-p PASSWORD, --password PASSWORD Password for the
migration user,
defaulting to admin.
-t TOTP, --totp TOTP Time based one time
password for the
migration user,
empty per default
-o, --use-oauth Use OAuth2 for login
instead of
user/pass/(totp),
defaulting to false.
-P, --use-oauth-local-port Which port to listen
for the auth code
callback, defaulting
to 8081.
-b BASEURL, --baseurl BASEURL Base url of keycloak
server, defaulting
to
http://localhost:80
80/auth.
-r REALM, --realm REALM Realm to use for
migration,
defaulting to master
-c CLIENT, --client CLIENT Client to use for
migration,
defaulting to
admin-cli
--correct-hashes Correct hashes to
most recent version,
defaulting to false
Just choose this
option if you didn't
change anything in
the changelog since
the last migration!
This will replace
all old hashes with
the new hash version
and can be omitted
next time the
migration is run.
See README.md for
further explanation!
-k PARAMETER, --parameter PARAMETER Parameters to
substitute in
changelog, syntax
is: -k param1=value1
will replace
${param1} with
value1 in changelog
```
--------------------------------
### Create from Existing Configuration
Source: https://github.com/mayope/keycloakmigration/blob/master/docsbuild/static/documentation/navigation.html
Create a new configuration based on an existing one.
```APIDOC
## fromExisting()
### Description
Initializes a configuration from an existing source.
### Method
Not specified (likely a builder method)
### Endpoint
Not applicable (SDK method)
### Parameters
None explicitly documented.
```
--------------------------------
### Get All Realms
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/documentation/keycloakapi/de.klg71.keycloakmigration.keycloakapi/-keycloak-client/realms.html
Retrieves a list of all realms available in the Keycloak instance.
```APIDOC
## realms
### Description
Retrieves a list of all realms configured in the Keycloak instance.
### Method
abstract fun realms(): List
### Returns
A list of Realm objects, where each object represents a Keycloak realm.
```
--------------------------------
### Verify Archetype File
Source: https://github.com/mayope/keycloakmigration/blob/master/docsbuild/themes/book/exampleSite/content/posts/creating-a-new-theme.md
List archetype files to confirm the new 'post.md' file has been created successfully. This step verifies the fix for the archetype error.
```bash
$ find themes/zafta/archetypes -type f | xargs ls -l
-rw-r--r-- 1 quoha staff 0 Sep 29 21:53 themes/zafta/archetypes/default.md
-rw-r--r-- 1 quoha staff 51 Sep 29 21:54 themes/zafta/archetypes/post.md
```
--------------------------------
### build()
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/documentation/keycloakapi/de.klg71.keycloakmigration.keycloakapi.model/-update-client-builder/build.html
Constructs and returns a Client object based on the builder's configuration.
```APIDOC
## build()
### Description
Constructs and returns a Client object based on the builder's configuration.
### Signature
fun build(): Client
```
--------------------------------
### Get Group by Name
Source: https://github.com/mayope/keycloakmigration/blob/master/docsbuild/static/documentation/keycloakapi/index-outline.html
Retrieves a group by its name within a specified realm.
```APIDOC
## groupByName
### Description
Retrieves a group by its name in the specified realm.
### Method
KeycloakClient.groupByName
### Parameters
#### Path Parameters
- **name** (String) - The name of the group.
- **realm** (String) - The name of the realm.
### Returns
- - Represents the group information.
```
--------------------------------
### Get User Groups
Source: https://github.com/mayope/keycloakmigration/blob/master/docsbuild/static/documentation/keycloakapi/index-outline.html
Retrieves the groups a user is a member of within a realm.
```APIDOC
## GET /users/{id}/groups
### Description
Retrieves the groups a user is a member of within a realm.
### Method
GET
### Endpoint
/admin/realms/{realm}/users/{id}/groups
### Parameters
#### Path Parameters
- **id** (UUID) - Required - The unique identifier of the user.
- **realm** (String) - Required - The name of the realm.
#### Response
#### Success Response (200)
- **groups** (List) - A list of groups the user belongs to.
```
--------------------------------
### executeIt()
Source: https://github.com/mayope/keycloakmigration/blob/master/docs/documentation/keycloakmigration/de.klg71.keycloakmigration.changeControl.actions/-action/execute-it.html
Executes the Action. Any exceptions are caught to allow for undoing the action if necessary.
```APIDOC
## executeIt()
### Description
Executes the Action. We want to catch any exception to be able to undo the action if needed.
### Method
N/A (This is a method call within the SDK)
### Parameters
This method does not take any parameters.
### Response
This method does not explicitly return a value, but it performs an action and handles exceptions.
```]