mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-09 14:42:59 +03:00
[PR #1002] feat: Add SCIM 2.0 provisioning support for user and group synchronization #528
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/pocket-id/pocket-id/pull/1002
State: closed
Merged: No
Overview
This PR implements SCIM 2.0 (System for Cross-domain Identity Management) provisioning support, enabling automated user and group synchronization with external identity providers like Cloudflare Zero Trust, Okta, Azure AD, and other SCIM-compliant systems.
Motivation
As requested in the original issue, this feature enables integration with Cloudflare Zero Trust's Generic OIDC provider, which supports SCIM v2 for synchronizing user and group changes. This allows users to manage Pocket ID accounts centrally through their identity provider.
Implementation
Core Features
The implementation provides a complete SCIM 2.0 server with the following capabilities:
User Management:
GET /api/scim/v2/Users)GET /api/scim/v2/Users/{id})POST /api/scim/v2/Users)PUT /api/scim/v2/Users/{id})PATCH /api/scim/v2/Users/{id})DELETE /api/scim/v2/Users/{id})Group Management:
GET /api/scim/v2/Groups)GET /api/scim/v2/Groups/{id})POST /api/scim/v2/Groups)PUT /api/scim/v2/Groups/{id})PATCH /api/scim/v2/Groups/{id})DELETE /api/scim/v2/Groups/{id})Discovery Endpoints:
GET /api/scim/v2/ServiceProviderConfig)GET /api/scim/v2/ResourceTypes)GET /api/scim/v2/Schemas)Technical Details
Architecture:
backend/internal/dto/scim_dto.go- SCIM DTOs following RFC 7643 schemasbackend/internal/service/scim_service.go- Business logic for provisioning operationsbackend/internal/controller/scim_controller.go- REST endpoints and request handlingAuthentication:
Uses Pocket ID's existing API key infrastructure. Users create an API key and provide it as a Bearer token:
Design Decisions:
disabledflag rather than removing records, preserving audit historyUsage Example
Integration with Cloudflare Zero Trust
https://your-pocket-id.com/api/scim/v2Cloudflare will now automatically sync users and groups from Pocket ID.
Documentation
Added comprehensive
SCIM.mddocumentation including:Standards Compliance
This implementation follows:
Testing
Limitations
To maintain Pocket ID's focus on simplicity, the following SCIM features are intentionally not implemented:
These can be added in future iterations if needed.
Files Changed
backend/internal/dto/scim_dto.go(177 lines)backend/internal/service/scim_service.go(748 lines)backend/internal/controller/scim_controller.go(437 lines)SCIM.md(199 lines)backend/internal/bootstrap/services_bootstrap.go(service registration)backend/internal/bootstrap/router_bootstrap.go(route registration)Total: 1,565 lines added
Closes #[issue-number]
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.