Pythonically build SCIM requests and parse SCIM responses
Project description
scim2-client
A SCIM client Python library built upon scim2-models and httpx, that pythonically build requests and parse responses, following the RFC7643 and RFC7644 specifications.
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.
Installation
pip install scim2-client
Usage
Check the tutorial and the reference for more details.
Here is an example of usage:
import datetime
from httpx import Client
from scim2_models import User, EnterpriseUser, Group, Error
from scim2_client import SCIMClient
client = Client(base_url=f"https://auth.example/scim/v2", headers={"Authorization": "Bearer foobar"})
scim = SCIMClient(client, resource_types=(User[EnterpriseUser], Group))
# Query resources
user = scim.query(User[EnterpriseUser], "2819c223-7f76-453a-919d-413861904646")
assert user.user_name == "bjensen@example.com"
assert user.meta.last_updated == 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_updated == datetime.datetime(
2024, 4, 13, 12, 0, 30, tzinfo=datetime.timezone.utc
)
# Create resources
payload = User(user_name="bjensen@example.com")
response = scim.create(user)
assert isinstance(response, Error)
assert response.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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file scim2_client-0.1.11.tar.gz
.
File metadata
- Download URL: scim2_client-0.1.11.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.5 Linux/6.10.6-arch1-1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8377c955bc009c98fa8b0b94df5d73e0db5c0f8cb3e318206e6ae70749a92eec |
|
MD5 | aa5225774efc5ae8b6f328ac3bf06f6d |
|
BLAKE2b-256 | 014a3d3f06d45ef35953c2ffbcc33c0192d1721af57f0710f942fca919024738 |
File details
Details for the file scim2_client-0.1.11-py3-none-any.whl
.
File metadata
- Download URL: scim2_client-0.1.11-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.5 Linux/6.10.6-arch1-1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c43e785f03103f9f6d22d5ab7308434ba991295bbf07c62a6dc49bf7cd7410b |
|
MD5 | c9a5178990f2566eb516a565e88d2779 |
|
BLAKE2b-256 | 9871c41708c5ebc886e4d26f39e09944cf5875cd080352c0dc39b4cace63a3c9 |