[PR #5685] [MERGED] feat: adding support for SCIM provisioning #6158

Closed
opened 2026-03-13 12:49:35 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5685
Author: @jonathansamines
Created: 10/30/2025
Status: Merged
Merged: 11/22/2025
Merged by: @Bekacru

Base: canaryHead: feat/scim-plugin


📝 Commits (10+)

  • e2f3aa9 chore: create scim plugin boilerplate
  • e915f65 chore(scim): create database schemas
  • 571b605 chore(sso): add SCIM token provisioning support to SSO plugin
  • 08f3cb7 chore(better-auth/nextjs): add support for PUT, PATCH and DELETE methods
  • 6e2b416 feat(scim): implement SCIM user endpoints
  • 5d01b13 docs: add scim and sso docs
  • 56f104c chore(scim): fix linting
  • 417929c chore(scim): add basic filtering support
  • db34ec9 chore(scim): add debug filter logs
  • 61967e0 chore(scim): implement SCIM metadata endpoints

📊 Changes

22 files changed (+4446 additions, -29 deletions)

View changed files

📝 docs/components/api-method.tsx (+76 -29)
📝 docs/components/sidebar-content.tsx (+17 -0)
docs/content/docs/plugins/scim.mdx (+385 -0)
packages/scim/package.json (+57 -0)
packages/scim/src/client.ts (+9 -0)
packages/scim/src/index.ts (+1000 -0)
packages/scim/src/mappings.ts (+38 -0)
packages/scim/src/middlewares.ts (+64 -0)
packages/scim/src/patch-operations.ts (+80 -0)
packages/scim/src/scim-error.ts (+99 -0)
packages/scim/src/scim-filters.ts (+69 -0)
packages/scim/src/scim-metadata.ts (+128 -0)
packages/scim/src/scim-resources.ts (+35 -0)
packages/scim/src/scim-tokens.ts (+71 -0)
packages/scim/src/scim.test.ts (+1995 -0)
packages/scim/src/types.ts (+65 -0)
packages/scim/src/user-schemas.ts (+213 -0)
packages/scim/src/utils.ts (+5 -0)
packages/scim/tsconfig.json (+8 -0)
packages/scim/tsdown.config.ts (+7 -0)

...and 2 more files

📄 Description

What is changing?
Adding a new scim plugin which will expose a fully functional SCIM server that third party identity providers can use to provision users from their systems.

This is pretty much WIP, but wanted to get some initial feedback before further iterating and implementing the missing parts:

TODO:

  • Add tests
  • Tests against DummyIDP
  • Add more docs
  • Add metadata endpoints

Closes: #3276


Summary by cubic

Adds SCIM provisioning with a new plugin exposing SCIM 2.0 user endpoints and bearer token auth. Includes metadata endpoints and docs; tokens are generated via POST /api/auth/scim/generate-token and can be scoped to an organization.

  • New Features

    • New @better-auth/scim plugin with SCIM 2.0 user endpoints: list (basic filter), get, create, update, patch, delete.
    • Bearer token auth via scimProvider; tokens generated with POST /api/auth/scim/generate-token (session required) and endpoints are restricted to the issuing provider and optional organization scope.
    • SCIM metadata endpoints: ServiceProviderConfig, Schemas, ResourceTypes; docs include a SCIM setup guide.
    • Configurable token storage: plain, hashed, encrypted, or custom via storeSCIMToken.
    • Flexible hooks to control SCIM token generation and access (before/after generate).
    • Automatic account linking and organization membership when using an org-scoped token.
    • scimClient helper for Better Auth clients to enable token generation from the client (session required).
  • Migration

    • Install @better-auth/scim and add scim() to plugins.
    • Migrate the database to add the scimProvider table/fields.
    • Generate a SCIM token via POST /api/auth/scim/generate-token and share the SCIM base URL and token with your IdP.

Written for commit 8c7fd39275. Summary will update automatically on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/5685 **Author:** [@jonathansamines](https://github.com/jonathansamines) **Created:** 10/30/2025 **Status:** ✅ Merged **Merged:** 11/22/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `feat/scim-plugin` --- ### 📝 Commits (10+) - [`e2f3aa9`](https://github.com/better-auth/better-auth/commit/e2f3aa9db3f896926d3345af871579744fb2c631) chore: create scim plugin boilerplate - [`e915f65`](https://github.com/better-auth/better-auth/commit/e915f65b1b1665a599a112a6223e27a438b31bfb) chore(scim): create database schemas - [`571b605`](https://github.com/better-auth/better-auth/commit/571b6059d4a8810da4fb9e9cfe9c0f82d0d62ab2) chore(sso): add SCIM token provisioning support to SSO plugin - [`08f3cb7`](https://github.com/better-auth/better-auth/commit/08f3cb7a56c66797f8fb399a57a579b952c11199) chore(better-auth/nextjs): add support for PUT, PATCH and DELETE methods - [`6e2b416`](https://github.com/better-auth/better-auth/commit/6e2b4168f59efe2783157e30c1165ef425397ea1) feat(scim): implement SCIM user endpoints - [`5d01b13`](https://github.com/better-auth/better-auth/commit/5d01b135b1fb2af101e6a6aa6cf43b843daf73eb) docs: add scim and sso docs - [`56f104c`](https://github.com/better-auth/better-auth/commit/56f104cd101b0d5db19921a3b581e604bd9dbb0f) chore(scim): fix linting - [`417929c`](https://github.com/better-auth/better-auth/commit/417929c93689977d8c6ca478c9cc2780e1e8785a) chore(scim): add basic filtering support - [`db34ec9`](https://github.com/better-auth/better-auth/commit/db34ec94f505eb51d063c47cb2201c5a39fa8d19) chore(scim): add debug filter logs - [`61967e0`](https://github.com/better-auth/better-auth/commit/61967e0548f5b02ecb78e82fe6b775269433cc31) chore(scim): implement SCIM metadata endpoints ### 📊 Changes **22 files changed** (+4446 additions, -29 deletions) <details> <summary>View changed files</summary> 📝 `docs/components/api-method.tsx` (+76 -29) 📝 `docs/components/sidebar-content.tsx` (+17 -0) ➕ `docs/content/docs/plugins/scim.mdx` (+385 -0) ➕ `packages/scim/package.json` (+57 -0) ➕ `packages/scim/src/client.ts` (+9 -0) ➕ `packages/scim/src/index.ts` (+1000 -0) ➕ `packages/scim/src/mappings.ts` (+38 -0) ➕ `packages/scim/src/middlewares.ts` (+64 -0) ➕ `packages/scim/src/patch-operations.ts` (+80 -0) ➕ `packages/scim/src/scim-error.ts` (+99 -0) ➕ `packages/scim/src/scim-filters.ts` (+69 -0) ➕ `packages/scim/src/scim-metadata.ts` (+128 -0) ➕ `packages/scim/src/scim-resources.ts` (+35 -0) ➕ `packages/scim/src/scim-tokens.ts` (+71 -0) ➕ `packages/scim/src/scim.test.ts` (+1995 -0) ➕ `packages/scim/src/types.ts` (+65 -0) ➕ `packages/scim/src/user-schemas.ts` (+213 -0) ➕ `packages/scim/src/utils.ts` (+5 -0) ➕ `packages/scim/tsconfig.json` (+8 -0) ➕ `packages/scim/tsdown.config.ts` (+7 -0) _...and 2 more files_ </details> ### 📄 Description **What is changing?** Adding a new `scim` plugin which will expose a fully functional `SCIM` server that third party identity providers can use to provision users from their systems. This is pretty much WIP, but wanted to get some initial feedback before further iterating and implementing the missing parts: **TODO**: - [x] Add tests - [x] Tests against DummyIDP - [x] Add more docs - [x] Add metadata endpoints Closes: #3276 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds SCIM provisioning with a new plugin exposing SCIM 2.0 user endpoints and bearer token auth. Includes metadata endpoints and docs; tokens are generated via POST /api/auth/scim/generate-token and can be scoped to an organization. - **New Features** - New @better-auth/scim plugin with SCIM 2.0 user endpoints: list (basic filter), get, create, update, patch, delete. - Bearer token auth via scimProvider; tokens generated with POST /api/auth/scim/generate-token (session required) and endpoints are restricted to the issuing provider and optional organization scope. - SCIM metadata endpoints: ServiceProviderConfig, Schemas, ResourceTypes; docs include a SCIM setup guide. - Configurable token storage: plain, hashed, encrypted, or custom via storeSCIMToken. - Flexible hooks to control SCIM token generation and access (before/after generate). - Automatic account linking and organization membership when using an org-scoped token. - scimClient helper for Better Auth clients to enable token generation from the client (session required). - **Migration** - Install @better-auth/scim and add scim() to plugins. - Migrate the database to add the scimProvider table/fields. - Generate a SCIM token via POST /api/auth/scim/generate-token and share the SCIM base URL and token with your IdP. <sup>Written for commit 8c7fd392756cfeaddbc970f8c4a0d74a9df460cf. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 12:49:35 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#6158