p2-inc / keycloak-orgs

Single realm, multi-tenancy for SaaS apps
https://phasetwo.io
Other
405 stars 71 forks source link

Add a mechanism to export/import organization entities #147

Closed xgp closed 6 months ago

xgp commented 9 months ago

It is not currently possible to hook into how Keycloak does export and import of realms. We should add a way to export and import Organizations both from the admin UI and startup/CLI.

xgp commented 9 months ago

Update: This is possible via the ExportImportManager interface of the DatastoreProvider. https://www.keycloak.org/docs-api/23.0.3/javadocs/org/keycloak/storage/ExportImportManager.html

xgp commented 7 months ago

The goal is to provide an implementation of ExportImportManager that overrides the default by allowing organizations to be imported and exported.

Steps:

  1. define the schema for what is under the organizations key
  2. create the objects (reusing if possible) in src/main/java/io/phasetwo/service/representation
  3. override/implement the ExportImportManager methods
  4. tests
xgp commented 7 months ago

We should target Keycloak 24, which should be out next week. In order to compile against the main branch of Keycloak, you'll have to compile it. Directions are here https://github.com/keycloak/keycloak/blob/main/docs/building.md Then you will need temporarily change the keycloak.version variable in this pom to 999.0.0-SNAPSHOT in order to compile against your locally built Keycloak.

We are doing this because LegacyExportImportManager is being replaced with DefaultExportImportManager.

xgp commented 7 months ago
xgp commented 7 months ago

We need to make sure the presence of the organization key does not cause standard Keycloak (i.e. without this extension) to fail. Try this first

xgp commented 6 months ago

completed in #205