2022-02-04 14:12:59 +00:00
# keycloak-scim-client
2024-10-22 07:26:28 +00:00
This extension add [SCIM2 ](http://www.simplecloud.info ) client capabilities to Keycloak.
2022-04-29 12:59:10 +00:00
2024-10-22 07:26:28 +00:00
It allows to :
2022-04-29 12:59:10 +00:00
2024-10-22 07:26:28 +00:00
* Declare SCIM endpoints (through the identity federation UI). Any tool implementing SCIM protocol can be wired to the
Keycloack instance through this declaration.
* Propagate users and groups from Keycloack to SCIM endpoints : when a user/group gets created or modified in Keycloack,
the modification is fowarded to all declared SCIM endpoints through SCIM calls within the transaction scope. If
propagation fails, changes can be rolled back or not according to a configurable rollback strategy.
* Import users and groups from SCIM endpoints (through the Keycloack synchronization mechanism).
2022-04-29 12:59:10 +00:00
2024-10-22 07:26:28 +00:00
See [RFC7643 ](https://datatracker.ietf.org/doc/html/rfc7643 )
and [RFC7644 ](https://datatracker.ietf.org/doc/html/rfc7644 )) for further details
2022-04-29 12:59:10 +00:00
2024-10-22 07:26:28 +00:00
## Overview
2022-04-29 12:59:10 +00:00
2024-10-22 07:26:28 +00:00
### Motivation
2022-04-29 12:59:10 +00:00
2024-10-22 07:26:28 +00:00
We want to build a unified collaborative platform based on multiple applications. To do that, we need a way to propagate
immediately changes made in Keycloak to all these applications. And we want to keep using OIDC or SAML as the
authentication protocol.
2022-04-29 12:59:10 +00:00
2024-10-22 07:26:28 +00:00
This will allow users to collaborate seamlessly across the platform without requiring every user to have connected once
to each application. This will also ease GDRP compliance because deleting a user in Keycloak will delete the user from
every app. The SCIM protocol is standard, comprehensible and easy to implement. It's a perfect fit for our goal.
We chose to build application extensions/plugins because it's easier to deploy and thus will benefit to a larger portion
of the FOSS community.
2022-04-29 12:59:10 +00:00
#### Keycloak specific
2024-10-22 07:26:28 +00:00
This extension uses 3 concepts in KeyCloack :
2022-04-29 12:59:10 +00:00
2024-10-22 07:26:28 +00:00
- Event Listener : used to listen for changes within Keycloack (e.g. User creation, Group deletion...) and propagate
them to registered SCIM service providers through SCIM requests.
- Federation Provider : used to set up all the SCIM service providers endpoint without creating our own UI.
- JPA Entity Provider : used to save the mapping between the local IDs and the service providers IDs.
2022-04-29 12:59:10 +00:00
## Usage
2024-10-22 07:26:28 +00:00
### Development mode
From the repository root :
* Launch the docker-compose image (composed of a postgre and keycloack instance runing on localhost:8080) :
``docker compose up -d``
* Execute ``gradle jar shadowJar && docker compose restart keycloak`` to build extension and update the Keycloack
instance
* You can access extension logs through ``docker compose logs -f``
2022-04-29 12:59:10 +00:00
2024-10-22 07:26:28 +00:00
### Installation
1. Download
the [latest version ](https://lab.libreho.st/libre.sh/scim/keycloak-scim/-/jobs/artifacts/main/raw/build/libs/keycloak-scim-1.0-SNAPSHOT-all.jar?job=package )
2022-05-19 13:08:27 +00:00
2. Put it in `/opt/keycloak/providers/` .
2022-04-29 12:59:10 +00:00
2022-05-19 13:08:27 +00:00
It's also possible to build your own custom image if you run Keycloak in a [container ](/docs/container.md ).
2022-04-29 12:59:10 +00:00
2022-05-19 13:08:27 +00:00
Other [installation options ](/docs/installation.md ) are available.
2022-05-12 11:48:21 +00:00
2022-04-29 12:59:10 +00:00
### Setup
2024-10-22 07:26:28 +00:00
#### Enable SCIM Event listeners
2022-04-29 12:59:10 +00:00
1. Go to `Admin Console > Events > Config` .
2. Add `scim` in `Event Listeners` .
3. Save.
![Event listener page ](/docs/img/event-listener-page.png )
2024-10-22 07:26:28 +00:00
#### Register SCIM Service Providers
2022-04-29 12:59:10 +00:00
2024-10-22 07:26:28 +00:00
1. Go to `Admin Console > Realm Settings > Events` .
2. Add `scim` to the list of event listers
3. Save
2022-04-29 12:59:10 +00:00
![Federation provider page ](/docs/img/federation-provider-page.png )
### Configuration
2024-10-22 07:26:28 +00:00
Add the endpoint - for a local set up you have to add the two containers in a docker network and use the container ip
see [here ](https://docs.docker.com/engine/reference/commandline/network/ )
If you use the [rocketchat app ](https://lab.libreho.st/libre.sh/scim/rocketchat-scim ) you get the endpoint from your
rocket Chat Scim Adapter App Details.
2022-05-12 11:48:21 +00:00
Endpoint content type is application/json.
Auth mode Bearer or None for local test setup.
Copy the bearer token from your app details in rocketchat.
If you enable import during sync then you can choose between to following import actions:
2024-10-22 07:26:28 +00:00
2022-05-12 11:48:21 +00:00
- Create Local - adds users to keycloak
- Nothing
- Delete Remote - deletes users from the remote application
2022-04-29 12:59:10 +00:00
### Sync
2024-10-22 07:26:28 +00:00
You can set up a periodic sync for all users or just changed users - it's not mandatory. You can either do:
2022-05-12 11:48:21 +00:00
- Periodic Full Sync
- Periodic Changed User Sync
2022-04-29 12:59:10 +00:00
2024-10-31 15:10:21 +00:00
## License
Licensed under the [Apache License, Version 2.0 ](/LICENSE ).
2024-10-31 15:10:40 +00:00
## Funding
This project is funded through [NGI0 Entrust ](https://nlnet.nl/entrust ), a fund established by [NLnet ](https://nlnet.nl ) with financial support from the European Commission's [Next Generation Internet ](https://ngi.eu ) program. Learn more at the [NLnet project page ](https://nlnet.nl/project/Libre.sh-SCIM ).
[<img src="https://nlnet.nl/logo/banner.png" alt="NLnet foundation logo" width="20%" /> ](https://nlnet.nl )
[<img src="https://nlnet.nl/image/logos/NGI0_tag.svg" alt="NGI Zero Logo" width="20%" /> ](https://nlnet.nl/entrust )