2022-05-02 12:43:47 +00:00
# SCIM Service Provider
2022-04-29 12:50:07 +00:00
2023-03-03 11:21:27 +00:00
This app allows to provision users and groups in Nextcloud from a scim client. It is based on [audriga/scim-server-php ](https://github.com/audriga/scim-server-php ) SCIM library.
2022-05-02 13:52:56 +00:00
2022-05-02 13:57:29 +00:00
You can see the [video ](https://hot-objects.liiib.re/meet-liiib-re-recordings/pair_2022-05-02-15-40-37.mp4 ) that shows how it works.
2022-05-02 13:52:56 +00:00
2024-02-06 17:04:49 +00:00
## Installation
2022-07-13 16:37:14 +00:00
2024-02-06 17:04:49 +00:00
Like any other app, it's available on Nextcloud's [app store ](https://apps.nextcloud.com/apps/scimserviceprovider ).
2023-03-03 11:21:27 +00:00
2024-02-06 17:04:49 +00:00
## Authentication
2023-03-03 11:21:27 +00:00
2024-02-06 17:04:49 +00:00
Basic and bearer authentication are supported. For now, only admin users are authorized to access SCIM APIs.
2022-07-13 16:37:14 +00:00
2024-02-06 17:04:49 +00:00
### Basic authentication
2022-05-02 13:52:56 +00:00
2024-02-06 17:04:49 +00:00
You just have to generate an app password in `/settings/user/security` .
2023-03-03 11:21:27 +00:00
2024-02-06 17:04:49 +00:00
### Bearer authentication
2023-03-03 11:21:27 +00:00
2024-02-06 17:04:49 +00:00
It requires a JWT secret, to be enabled.
```shell
php occ config:app:set scimserviceprovider jwt-secret --value="CHANGE_ME"
2023-03-03 11:21:27 +00:00
```
2024-02-06 17:04:49 +00:00
Then you should generate a JWT signed with this secret and with `sub` in the payload referring to an existing username. ([Handy CLI tool](https://github.com/mike-engel/jwt-cli))
```shell
jwt encode --secret "CHANGE_ME" '{"sub":"admin"}'
2023-03-03 11:21:27 +00:00
```
2024-02-06 17:04:49 +00:00
## Usage
2023-03-03 11:21:27 +00:00
```
2024-02-06 17:04:49 +00:00
$ curl http://< path-to-nextcloud > /index.php/apps/scimserviceprovider/< Resource > -H 'Authorization: < Auth > ' -H 'Content-Type: application/scim+json'
2023-03-03 11:21:27 +00:00
```
2022-05-02 13:52:56 +00:00
2024-02-06 17:04:49 +00:00
Where `<Resource>` designates a SCIM resource, such as `Users` or `Groups` .
2022-05-02 13:52:56 +00:00
2024-02-06 17:04:49 +00:00
### With Keycloak
2022-05-02 13:52:56 +00:00
2024-02-06 17:04:49 +00:00
You can use with the [SCIM plugin we developped for keycloak ](https://lab.libreho.st/libre.sh/scim/keycloak-scim ).
2023-03-03 11:21:27 +00:00
2024-02-06 17:04:49 +00:00
### With AzureAD
2023-03-03 11:21:27 +00:00
2024-02-06 17:04:49 +00:00
You can provision users from AzureAD to Nextcloud with this app. For this, you need to setup [Bearer authentication ](#bearer-authentication ).
2023-03-03 11:21:27 +00:00
2022-04-29 13:58:14 +00:00
## Running tests
2022-04-29 12:50:07 +00:00
2024-02-06 17:04:49 +00:00
Broken.
2022-04-29 12:50:07 +00:00
2022-05-02 13:52:56 +00:00
## Todo
2023-03-03 11:21:27 +00:00
- [ ] Meta -> ([can't implement yet](https://github.com/nextcloud/server/issues/22640))
2022-05-02 13:52:56 +00:00
- createdAt
- lastModified
2023-03-03 11:21:27 +00:00
- [ ] ExternalID
- [ ] Groups - [waiting for feedback ](https://help.nextcloud.com/t/add-metadata-to-groups/139271 )
2022-05-19 10:23:46 +00:00
- [ ] json exceptions
2024-02-06 17:04:49 +00:00
- [x] group member removal
- [x] pagination
2022-05-19 10:23:46 +00:00
- [ ] CI/CD
- [ ] Lint cs:check
- [ ] test psalm
- [ ] test insomnia
2024-02-06 17:04:49 +00:00
- [x] publish app on app store
- [x] Allow for simultaneous usage of basic auth and bearer token auth (see **Authentication TODOs / Open issues** )
2023-03-03 11:21:27 +00:00
## Disclaimer
This app relies on the fixes, being introduced to Nextcloud in [PR #34172 ](https://github.com/nextcloud/server/pull/34172 ), since Nextcloud can't properly handle the `Content-Type` header value for SCIM (`application/scim+json`) otherwise. In the meantime until this PR is merged, SCIM clients interacting with this app might need to resort to using the standard value of `application/json` instead.
2022-05-02 13:52:56 +00:00
## NextGov Hackathon
2022-05-02 13:57:29 +00:00
This app was started during the [Nextgov hackathon ](https://eventornado.com/submission/automatic-sso-saml-sync-from-identity-provider-keycloak-through-a-well-known-protocol-scim?s=1#idea )!