SCIM2 Server Prototype

0.1.9 · active · verified Fri Apr 17

scim2-server is a lightweight prototype implementation of a SCIM2 (System for Cross-domain Identity Management) server using FastAPI. It provides basic in-memory reference implementations for SCIM2 user and group management, primarily intended as a starting point or demonstration rather than a production-ready server. The current version is 0.1.9, with an irregular release cadence as a 'prototype'.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart sets up a basic FastAPI application embedding the `scim2-server` router. It initializes an in-memory SCIM2 server, adds a sample user and group, and then runs the FastAPI app using Uvicorn. Access SCIM endpoints at `/scim/v2`.

import uvicorn
from fastapi import FastAPI
from scim2_server import SCIM2Server, SCIM2User, SCIM2Group

# Initialize SCIM2 server with in-memory storage
scim_server = SCIM2Server()

# Optional: Add some initial data
scim_server.users.create(SCIM2User(id='user1', userName='john.doe', emails=[{'value': 'john.doe@example.com', 'primary': True}]))
scim_server.groups.create(SCIM2Group(id='group1', displayName='Developers'))

# Create a FastAPI app and include the SCIM2 router
app = FastAPI(title="SCIM2 Prototype API")
app.include_router(scim_server.router, prefix="/scim/v2")

@app.get("/")
async def root():
    return {"message": "SCIM2 server is running! Access /scim/v2"}

# To run this: save as main.py and execute 'uvicorn main:app --reload'
# The example below demonstrates running programmatically for convenience,
# but 'uvicorn main:app' is the typical way.
if __name__ == '__main__':
    # Note: For production, typically run with `uvicorn main:app` from terminal.
    # This programmatic run is for quick demonstration.
    print("\n--- Running SCIM2 Server Prototype ---")
    print("Access SCIM endpoints at: http://127.0.0.1:8000/scim/v2")
    print("Try: http://127.0.0.1:8000/scim/v2/Users")
    uvicorn.run(app, host="127.0.0.1", port=8000)

view raw JSON →