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:
serve a standalone SCIM server: the Overview builds one, and Deploy the server puts it in production;
add SCIM to an existing application, with SCIM models that describe its data: Serve an existing data model maps its tables to SCIM resources, and Integrate a web framework serves them from its web framework;
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.
>>> 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
>>> handler = ScimHandler(ScimService(load_default_provider()), 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/...')
The library has four layers. An application uses as many as it needs:
a service,
ScimService, which applies the rules of SCIM, independently of any web framework;a handler,
ScimHandler, orAsyncScimHandlerfor an asynchronous application, which turns aScimRequestinto aScimResponse;a storage,
ScimStorage, which reads and writes the resources, withInMemoryStoragefor tests, debugging and demos;an integration, such as
WSGIApplicationorASGIApplication, which need no other dependency.
The scim2-server command serves a test server.
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.
Test server runs a SCIM server from the command line, for the tests of a SCIM client in any language.