No description, website, or topics provided.
Clone or download
AlistairDoswald
AlistairDoswald Added maven assembly to produce tar.gz
- Also minor update in documentation
Latest commit 3b69a1b Dec 5, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Corrections for maven build Nov 22, 2018
.gitignore
LICENSE Initial commit Feb 22, 2018
README.md Added maven assembly to produce tar.gz Dec 5, 2018
assembly.xml Added maven assembly to produce tar.gz Dec 5, 2018
install.sh Removed build from install.sh Nov 30, 2018
module.xml Fix module.xml with correct dependencies Apr 30, 2018
pom.xml

README.md

Keycloak export Module

This module allows you to perform a full export from the REST-API, while keycloak is still running.

This version currently works with keycloak 4.6.0.Final.

Install keycloak-export

You need Java-8-x Java environment. To build, you must have the keycloak test artifacts in one of your repositories. This can be done by dowloading the keycloak source, and building it as recommended on their webpage. Make sure that you build the tag 4.6.0.Final.

Run

mvn clean install

Deploy manually

You can deploy as a module by running:

$KEYCLOAK_HOME/bin/jboss-cli.sh --command="module add --name=io.cloudtrust.keycloak-export --resources=target/keycloak-export-0.1-SNAPSHOT.jar --dependencies=org.keycloak.keycloak-core,org.keycloak.keycloak-server-spi,org.keycloak.keycloak-server-spi-private,org.keycloak.keycloak-services,javax.ws.rs.api"

Then registering the provider by editing standalone/configuration/standalone.xml and adding the module to the providers element:

<providers>
    ...
    <provider>module:io.cloudtrust.keycloak-export</provider>
</providers>

Deploy automatically

Simply call the install.sh script with the base directory of Keycloak as parameter.

Then start (or restart) the server. To use this module, the client (i.e. admin-cli) must have full scope allowed in the master realm.

Using the module

The module is used as for other REST-API endpoints (see here):

  1. Call the api to get an access token
curl \
  -d "client_id=admin-cli" \
  -d "username=admin" \
  -d "password=password" \
  -d "grant_type=password" \
  "http://localhost:8080/auth/realms/master/protocol/openid-connect/token"

Then call the http://localhost:8080/auth/realms/master/export/realm endpoint, using the token

curl \
  -H "Authorization: bearer eyJhbGciOiJSUz..." \
  "http://localhost:8080/auth/realms/master/export/realm"

You should see a json with the exported content. You can also invoke the endpoint for other realms by replacing master with the realm name in the above url.

Testing

Tests run with arquillian, as standard unit tests, similar to what is done on the keycloak project.