Skip to main content

Pythonically build SCIM requests and parse SCIM responses

Project description

scim2-client

A SCIM client Python library built upon scim2-models , that pythonically build requests and parse responses, following the RFC7643 and RFC7644 specifications. You can use whatever request engine you prefer to perform network requests, but scim2-client comes with httpx support.

It aims to be used in SCIM client applications, or in unit tests for SCIM server applications.

What's SCIM anyway?

SCIM stands for System for Cross-domain Identity Management, and it is a provisioning protocol. Provisioning is the action of managing a set of resources across different services, usually users and groups. SCIM is often used between Identity Providers and applications in completion of standards like OAuth2 and OpenID Connect. It allows users and groups creations, modifications and deletions to be synchronized between applications.

Features

  • CRUD Operations: create, query, replace, delete methods for SCIM resources
  • PATCH Support: Partial resource modifications with add, remove and replace operations
  • Server Discovery: Automatic retrieval of ServiceProviderConfig, ResourceTypes and Schemas
  • Search & Filtering: Support for SCIM filters, sorting, pagination and attribute selection
  • Sync & Async: Both synchronous and asynchronous clients available
  • Multiple HTTP Engines: Built-in support for httpx (sync/async) and werkzeug (testing). Adaptable to any network engine.
  • Request & Response Validation: Automatic payload validation against SCIM schemas
  • Error Handling: Structured exceptions for network, request and response errors

Installation

pip install scim2-client[httpx]

Usage

Check the tutorial and the reference for more details.

Here is an example of usage:

import datetime
from httpx import Client
from scim2_client import SCIMResponseErrorObject
from scim2_client.engines.httpx import SyncSCIMClient

client = Client(base_url="https://auth.example/scim/v2", headers={"Authorization": "Bearer foobar"})
scim = SyncSCIMClient(client)
scim.discover()
User = scim.get_resource_model("User")

# Query resources
user = scim.query(User, "2819c223-7f76-453a-919d-413861904646")
assert user.user_name == "bjensen@example.com"
assert user.meta.last_modified == datetime.datetime(
    2024, 4, 13, 12, 0, 0, tzinfo=datetime.timezone.utc
)

# Update resources
user.display_name = "Babs Jensen"
user = scim.replace(user)
assert user.display_name == "Babs Jensen"
assert user.meta.last_modified == datetime.datetime(
    2024, 4, 13, 12, 0, 30, tzinfo=datetime.timezone.utc
)

# Create resources
user = User(user_name="bjensen@example.com")
try:
    scim.create(user)
except SCIMResponseErrorObject as exc:
    error = exc.to_error()
    assert error.detail == "One or more of the attribute values are already in use or are reserved."

scim2-client belongs in a collection of SCIM tools developed by Yaal Coop, with scim2-models, scim2-tester and scim2-cli

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scim2_client-0.7.5.tar.gz (18.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scim2_client-0.7.5-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file scim2_client-0.7.5.tar.gz.

File metadata

  • Download URL: scim2_client-0.7.5.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for scim2_client-0.7.5.tar.gz
Algorithm Hash digest
SHA256 6667f4b39c5cd8fcd4caf59e8bad136bb6f92ba1f30ece04948f36728b291e20
MD5 43b298713139026283c5a915999c33aa
BLAKE2b-256 a0af55a8d97acee4f3488a0628f5a4538a2e7ccb40e33acdbca84a92ed14ab11

See more details on using hashes here.

Provenance

The following attestation bundles were made for scim2_client-0.7.5.tar.gz:

Publisher: release.yml on python-scim/scim2-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scim2_client-0.7.5-py3-none-any.whl.

File metadata

  • Download URL: scim2_client-0.7.5-py3-none-any.whl
  • Upload date:
  • Size: 20.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for scim2_client-0.7.5-py3-none-any.whl
Algorithm Hash digest
SHA256 bb2d3437027e6b13f2d620038a288c6b718284d3a7249f121c1ce43f5cf7fe1e
MD5 2f5279759fa0914da3a3c30704b73a37
BLAKE2b-256 b805ac0ebd3aef5cbc889f0de9c506b92add9f835d9821da4cd324d5f7930f0e

See more details on using hashes here.

Provenance

The following attestation bundles were made for scim2_client-0.7.5-py3-none-any.whl:

Publisher: release.yml on python-scim/scim2-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page