[PR #6589] [MERGED] feat(scim): add Microsoft Entra ID SCIM Compatibility #6763

Closed
opened 2026-03-13 13:10:59 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6589
Author: @cemcevik
Created: 12/7/2025
Status: Merged
Merged: 1/13/2026
Merged by: @himself65

Base: canaryHead: feat/scim-microsoft-entra-id-support


📝 Commits (10+)

  • 582c58d feat(scim): add support for Microsoft Entra ID
  • 4076705 docs: add 'active' field to user table for SCIM integration
  • c57bdc6 feat(scim): set default value for 'active' field in user schema
  • 8b03626 feat(scim): update mapping functions to allow updating multiple name sub-attributes
  • 3808394 feat(scim): update PATCH /scim/v2/users tests
  • f0c7834 feat(scim): make path parameter optional in applyPatchValue
  • df29fec docs: add 'active' field to create new user, update new user and attribute mapping sections
  • 814e497 feat(scim): remove 'active' field from user schema and related operations
  • 2cc5a2a docs: remove 'active' field
  • 9e0b0a6 Merge branch 'canary' into feat/scim-microsoft-entra-id-support

📊 Changes

3 files changed (+521 additions, -20 deletions)

View changed files

📝 packages/scim/src/patch-operations.ts (+83 -15)
📝 packages/scim/src/routes.ts (+6 -2)
📝 packages/scim/src/scim.test.ts (+432 -3)

📄 Description

The current SCIM implementation does not fully cover the SCIM protocol requirements for Microsoft Entra ID.

This PR addresses those gaps by implementing the necessary changes to achieve full compatibility. The implementation has been validated using Microsoft's official SCIM Validator tool (https://scimvalidator.microsoft.com/) and passes all required tests.

Changes

1. Added active Field to User Schema

  • Added an active boolean field to the user table to track user status
  • This enables soft-delete functionality, which is essential for Microsoft Entra ID user deprovisioning workflows

2. Case-Insensitive Operation Handling

  • Microsoft sends SCIM operations (Replace, Add, Remove) with uppercase first letters
  • Implemented normalization to convert operations to lowercase before processing

3. Empty Media Type Support for DELETE Requests

  • Microsoft does not send a media type header for DELETE user requests
  • Added empty string ("") as an allowed media type for the delete endpoint

4. Path Normalization for Microsoft's Format

  • Microsoft uses dot notation without leading slashes (e.g., name.formatted instead of /name/formatted)
  • Implemented a path normalizer that converts Microsoft's format to the expected internal format

5. Added Support for add Operation

  • The previous implementation only handled the replace operation
  • Added full support for the add operation, including nested object value handling

Summary by cubic

Adds full Microsoft Entra ID SCIM compatibility across user CRUD and patch operations. Normalizes Microsoft-specific payloads; this implementation passes Microsoft’s SCIM Validator.

  • New Features
    • Supports add operations, nested values, operations without a path, and dot-notation paths.
    • Normalizes operation casing and allows empty media type headers on DELETE.
    • Improves name sub-attribute updates and skips no-op add operations.

Written for commit ac3e689f18. Summary will update 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/6589 **Author:** [@cemcevik](https://github.com/cemcevik) **Created:** 12/7/2025 **Status:** ✅ Merged **Merged:** 1/13/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `feat/scim-microsoft-entra-id-support` --- ### 📝 Commits (10+) - [`582c58d`](https://github.com/better-auth/better-auth/commit/582c58d7a02999e1304ee770745314e069063052) feat(scim): add support for Microsoft Entra ID - [`4076705`](https://github.com/better-auth/better-auth/commit/407670525fedd04c81be2208aad9960b64698e68) docs: add 'active' field to user table for SCIM integration - [`c57bdc6`](https://github.com/better-auth/better-auth/commit/c57bdc6363da433769c9c2e6cc2796260ba79c7d) feat(scim): set default value for 'active' field in user schema - [`8b03626`](https://github.com/better-auth/better-auth/commit/8b036260ff73bc40b4ce0a7e6d892b2c7e0474dc) feat(scim): update mapping functions to allow updating multiple name sub-attributes - [`3808394`](https://github.com/better-auth/better-auth/commit/38083945cb47a1c3e9b40967b5f571c598ecc9bb) feat(scim): update PATCH /scim/v2/users tests - [`f0c7834`](https://github.com/better-auth/better-auth/commit/f0c7834340b61b6268b3c7b3b7addf4e41b0dc46) feat(scim): make path parameter optional in applyPatchValue - [`df29fec`](https://github.com/better-auth/better-auth/commit/df29feccda99009a94c8ae25cea10dfad6ee7305) docs: add 'active' field to create new user, update new user and attribute mapping sections - [`814e497`](https://github.com/better-auth/better-auth/commit/814e4973d41cc20c1c5da0696a6441848bd7046b) feat(scim): remove 'active' field from user schema and related operations - [`2cc5a2a`](https://github.com/better-auth/better-auth/commit/2cc5a2a42b4cb175d93a14a9e8ced090fe83618b) docs: remove 'active' field - [`9e0b0a6`](https://github.com/better-auth/better-auth/commit/9e0b0a61a08040a29e1507d5ed38d7e4c34bc8cc) Merge branch 'canary' into feat/scim-microsoft-entra-id-support ### 📊 Changes **3 files changed** (+521 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `packages/scim/src/patch-operations.ts` (+83 -15) 📝 `packages/scim/src/routes.ts` (+6 -2) 📝 `packages/scim/src/scim.test.ts` (+432 -3) </details> ### 📄 Description The current SCIM implementation does not fully cover the SCIM protocol requirements for Microsoft Entra ID. This PR addresses those gaps by implementing the necessary changes to achieve full compatibility. The implementation has been validated using Microsoft's official SCIM Validator tool (https://scimvalidator.microsoft.com/) and passes all required tests. ### Changes #### 1. Added `active` Field to User Schema - Added an `active` boolean field to the user table to track user status - This enables soft-delete functionality, which is essential for Microsoft Entra ID user deprovisioning workflows #### 2. Case-Insensitive Operation Handling - Microsoft sends SCIM operations (`Replace`, `Add`, `Remove`) with uppercase first letters - Implemented normalization to convert operations to lowercase before processing #### 3. Empty Media Type Support for DELETE Requests - Microsoft does not send a media type header for DELETE user requests - Added empty string (`""`) as an allowed media type for the delete endpoint #### 4. Path Normalization for Microsoft's Format - Microsoft uses dot notation without leading slashes (e.g., `name.formatted` instead of `/name/formatted`) - Implemented a path normalizer that converts Microsoft's format to the expected internal format #### 5. Added Support for `add` Operation - The previous implementation only handled the `replace` operation - Added full support for the `add` operation, including nested object value handling <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds full Microsoft Entra ID SCIM compatibility across user CRUD and patch operations. Normalizes Microsoft-specific payloads; this implementation passes Microsoft’s SCIM Validator. - **New Features** - Supports add operations, nested values, operations without a path, and dot-notation paths. - Normalizes operation casing and allows empty media type headers on DELETE. - Improves name sub-attribute updates and skips no-op add operations. <sup>Written for commit ac3e689f1874058c5319c5c27f4316228685c863. Summary will update 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 13:10:59 -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#6763