Skip to main content
Automate user provisioning and deprovisioning from external identity management systems using SCIM 2.0. See ADR-0038 for implementation details.

Overview

SCIM (System for Cross-domain Identity Management) enables:
  • Automated User Provisioning: Create users from Azure AD, Okta, Google Workspace
  • Attribute Synchronization: Keep user profiles in sync
  • Deprovisioning: Automatically disable users when removed from source
  • Group Management: Sync group memberships
  • Bulk Operations: Provision hundreds of users at once

SCIM Provisioning Lifecycle Flow

Supported Endpoints

Users

  • POST /scim/v2/Users - Create user
  • GET /scim/v2/Users/{id} - Get user
  • PUT /scim/v2/Users/{id} - Replace user
  • PATCH /scim/v2/Users/{id} - Update user (partial)
  • DELETE /scim/v2/Users/{id} - Deactivate user
  • GET /scim/v2/Users?filter=... - Search users

Groups

  • POST /scim/v2/Groups - Create group
  • GET /scim/v2/Groups/{id} - Get group
  • PATCH /scim/v2/Groups/{id} - Update group membership

Quick Start

1. Enable SCIM

2. Create Service Principal for SCIM

3. Configure External System

Configure your identity provider to use SCIM: Azure AD:
  1. Enterprise Applications → Your App → Provisioning
  2. Set Tenant URL: https://api.example.com/scim/v2
  3. Set Secret Token: Bearer <JWT_TOKEN>
  4. Test connection
  5. Enable provisioning
Okta:
  1. Applications → Your App → Provisioning → Integration
  2. Set SCIM Base URL: https://api.example.com/scim/v2
  3. Set Authentication: OAuth2 Client Credentials
  4. Set Client ID/Secret from service principal

SCIM Examples

Create User

Response:

Update User (PATCH)

Deactivate User (DELETE)

Search Users

Create Group

Enterprise User Extension

SCIM supports enterprise-specific attributes:
These map to Keycloak user attributes:
  • employeeNumberemployeeNumber
  • departmentdepartment
  • organizationorganization

OpenFGA Synchronization

When users are provisioned via SCIM, roles are automatically synced to OpenFGA:
Default roles assigned: ["user"] Configure in .env:

Monitoring

Prometheus Metrics

Audit Logs

All SCIM operations are logged:

Troubleshooting

401 Unauthorized

Issue: SCIM client cannot authenticate Solutions:
  • Verify JWT token is valid
  • Check service principal credentials
  • Ensure token not expired (refresh if needed)

409 Conflict (User Exists)

Issue: User already exists in Keycloak Solutions:
  • Use PATCH to update instead of POST
  • Check userName field (must be unique)
  • Query before creating: GET /scim/v2/Users?filter=userName eq "alice@example.com"

Attribute Not Mapped

Issue: Enterprise attributes not appearing in Keycloak Solutions:
  • Check schema includes enterprise extension
  • Verify attribute mapping in user_to_keycloak()
  • Check Keycloak user attributes in Admin Console

References

Architecture & API Docs