Django SCIM
This is a partial provider-side implementation of the SCIM 2.0 [1] specification for use in Django. It covers:
Serialization of Django User objects to SCIM documents
REST view for <prefix>/Users/uid
REST view for <prefix>/Users/.search
SCIM filter query parser covering all operators and most fields
Limited pluggability support
Note that currently the only supported database is Postgres.
Installation
$ pip install django_scim
Then add the django_scim app to INSTALLED_APPS in Django’s settings file and the necessary url mappings:
urlpatterns = patterns('',
url(r'^/scim/v2/Users/.search/?$',
SearchView.as_view(), name='scim-search'),
url(r'^/scim/v2/Users/([^/]+)$', UserView.as_view(), name='scim-user'),
)
Extensibility
By default, django_scim uses the email field on the User class. However, if your application maintains multiple identities using custom separate database tables, you can override django_scim.models.SCIMUser and pull that in:
from django_scim.models import SCIMUser as _SCIMUser
from acme.apps.bb.models import Identity
class SCIMUser(_SCIMUser):
def __init__(self, user):
super(SCIMUser, self).__init__(user)
self.identities = (Identity.objects
.filter(profile__user_id=self.user.id))
@property
def emails(self):
return {i.email: i.primary for i in self.identities}
Here we keep multiple email addresses in a table that is linked to UserProfile. Next, tell the views to use this class instead of the default:
url(r'^/scim/v2/Users/([^/]+)$', UserView.as_view(usercls=SCIMUser),
name='scim-user'),
When your email address live in different tables, you’ll also need to extend the filter query parser to make sure they can be queried on:
from django_scim.filter import SCIMFilterTransformer
class AcmeSCIMTransformer(SCIMFilterTransformer):
email = lambda *args: 'i.email'
def join(self):
return """
JOIN bb_userprofile p ON p.user_id = u.id
LEFT OUTER JOIN bb_identity i ON i.profile_id = p.id
"""
And pass it on to the view:
url(r'^/scim/v2/Users/([^/]+)$',
UserView.as_view(usercls=SCIMUser, parser=AcmeSCIMTransformer),
name='scim-user'),
Metadata
Release files for django-scim 0.8.167
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| django_scim-0.8.167.tar.gz | 9.9 kB | Without provenance | Details |
Release files / django_scim-0.8.167.tar.gz
| Download URL | django_scim-0.8.167.tar.gz |
|---|---|
| Size | 9.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5dcd08d2ab850f52c8a6680efe344ab8c5ca9542e92c009e53bfc136ced5a5d9
|
|
BLAKE2b-256 checksum How to use checksums |
fa41704d67cd77b685fe4a2105db21fb66b59d67c4786e806707672889d232f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.20
|
Security for django-scim 0.8.167
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.