Skip to main content

django-oidc-op

CI build pypi License Python version

A Django implementation of an OIDC Provider/OAuth2 AS on top of jwtconnect.io. This project is based on IdentityPython oidc-op. Please consult the official oidc-op documentation for any further information about its features and capabilities.

To configure a standard OIDC Provider you have to edit the oidcop configuration file. See django-oidc-op/oidc_provider/tests/example/example/settings.py and django-oidc-op/oidc_provider/tests/example/example/oidc_provider_settings.py to get in.

Run the example demo

git clone https://github.com/peppelinux/django-oidc-op.git
cd django-oidc-op

pip install -r requirements.txt
cd example

./manage.py createsuperuser

bash run.sh

Example Relying-Party

You can use JWTConnect-Python-OidcRP as follow:

cd JWTConnect-Python-OidcRP/example
RP_LOGFILE_NAME="./flrp.django.log" python3 -m flask_rp.wsgi ../django-oidc-op/example/data/oidc_rp/conf.django.yaml

You can also use a scripted RP handler on top of oidc-rp

python3 snippets/rp_handler.py -c oidc_provider/tests/oidc_rp/conf.json -u test -p testami18 -iss django_provider

Configuration

This project relyies interely on behaviour and features provided by oidcop, to get an exaustive integration in Django it adopts the following customizations.

oidc_provider_settings.py

In the example project it handles all the oidcop configurations. I think it's more cleaner but feel free to adapt in your preferred schema.

Settings

  • OIDCOP_CONFIG is a python dictionary that contains the oidcop configuration.
  • OIDC_URL_PREFIX, eg: oidcop/ if present will be used as url path in all the oidcop endpoints, except for .well-known/openid-configuration. In the example project I put this parameter in oidc_provider_settings, default is ''.

UserInfo endpoint

Claims to be released are configured in op.server_info.user_info (in oidc_provider_settings.py). The attributes release and user authentication mechanism rely on classes implemented in oidc_op/users.py.

Configuration Example:

      "userinfo": {
        "class": "oidc_provider.users.UserInfo",
        "kwargs": {
            # map claims to django user attributes here:
            "claims_map": {
                "phone_number": "telephone",
                "family_name": "last_name",
                "given_name": "first_name",
                "email": "email",
                "verified_email": "email",
                "gender": "gender",
                "birthdate": "get_oidc_birthdate",
                "updated_at": "get_oidc_lastlogin"
            }
        }
      }

Developers'

Running tests

running tests

./manage.py test oidc_provider

coverage

coverage erase
coverage run manage.py test oidc_provider
coverage report -m

Author

  • Giuseppe De Marco

Relying-Party

Alt text Alt text

Session management and token preview

Alt text Alt text Alt text

Metadata

Release files for oidc-provider 2.3.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oidc-provider 2.3.4
File Size Uploaded Provenance Actions
oidc_provider-2.3.4.tar.gz 2.5 MB Without provenance Details for oidc_provider-2.3.4.tar.gz

Release files / oidc_provider-2.3.4.tar.gz

Download URL oidc_provider-2.3.4.tar.gz
Size 2.5 MB
Tags Source
SHA-256 checksum
How to use checksums
ceb3fa3a7448faf1ce813122558e154aca9b6b6372e2983c3595c70d4fcc42ae
BLAKE2b-256 checksum
How to use checksums
3e513b4d5f894f9895ebddc166ddeb466cc77ab71f016bfc3d645d365875acf4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.26.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.10

Security for oidc-provider 2.3.4

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page