scim2-server#
scim2-server serves the SCIM protocol of RFC 7643 and RFC 7644 over a storage that the application chooses. It validates the requests, applies them to the resources, and builds the responses, with scim2-models. The application only reads and writes the resources, in a database or anywhere else.
scim2-server is for projects that need to:
add SCIM to a web application: Integrate a web framework explains how to serve SCIM from its web framework, and Serve an existing data model how to map its tables to SCIM resources;
test a SCIM client against a working server: the scim2-server command serves one from the command line or from a container, and pytest-scim2-server serves one as a pytest fixture.
>>> import os
>>> from scim2_server.handler import ScimHandler
>>> from scim2_server.memory import InMemoryStorage
>>> from scim2_server.requests import ScimRequest
>>> from scim2_server.service import ScimService
>>> from scim2_server.utils import load_default_provider
>>> service = ScimService(load_default_provider(), secret=os.environ["SCIM_SECRET"])
>>> handler = ScimHandler(service, InMemoryStorage())
>>> response = handler.handle(
... ScimRequest(
... "POST",
... "https://scim.example/v2",
... "/Users",
... headers={"Content-Type": "application/scim+json"},
... body=b'{"userName": "bjensen"}',
... )
... )
>>> response.status, response.headers["Location"]
(<HTTPStatus.CREATED: 201>, 'https://scim.example/v2/Users/...')
scim2-server covers four themes. An application uses the ones it needs, and the guides, the explanations and the reference follow the same themes:
HTTP: a handler,
ScimHandlerorAsyncScimHandler, turns aScimRequestinto aScimResponse. An integration turns the requests of a web framework intoScimRequest.WSGIApplicationandASGIApplicationserve SCIM without a framework, for tests and demos.Service:
ScimServiceapplies the rules of SCIM, independently of any web framework.Storage: a
ScimStoragereads and writes the resources.InMemoryStoragekeeps them in memory, for tests, debugging and demos.Test server: the scim2-server command serves a SCIM server from the command line, for the tests of a SCIM client in any language.
pip install scim2-server
Choose a path#
Overview introduces the parts of a SCIM server, from the description of the service to the test server.
How-to guides show how to complete a specific task, such as connecting a database or integrating a web framework.
Explanation gives the reasons behind the design: the split between the service and the storage, the handling of concurrent writes, and the bulk requests.
Reference lists the public API.