Skip to main content

Build Status Coverage Pypi package status Python versions license

DjangoCMS OIDC (OpenID Connect)

Plugins for user authentication via OpenID, based on Mozilla Django OIDC.

Installation

$ pip install djangocms-oidc

Caution! If you are using project django-python3-ldap, you must use version higher than 0.11.3.

Example in requirements.txt:

django-python3-ldap @ git+https://github.com/etianen/django-python3-ldap.git@759d3483d9e656fef2b6a2e669101bca3021d9d5

Add settings to settings.py

Start by making the following changes to your settings.py file.

# Add 'mozilla_django_oidc' and 'djangocms_oidc' to INSTALLED_APPS
INSTALLED_APPS = [
    # ...
    'multiselectfield',
    'django_countries',
    'mozilla_django_oidc',  # place after auth (django.contrib.auth)
    'djangocms_oidc',
]

AUTHENTICATION_BACKENDS = [
    # ...
    'djangocms_oidc.auth.DjangocmsOIDCAuthenticationBackend',
]

MIDDLEWARE = [
    # ...
    'djangocms_oidc.middleware.OIDCSessionRefresh',
]

# Define OIDC classes
OIDC_AUTHENTICATE_CLASS = "djangocms_oidc.views.DjangocmsOIDCAuthenticationRequestView"
OIDC_CALLBACK_CLASS = "djangocms_oidc.views.DjangocmsOIDCAuthenticationCallbackView"
OIDC_OP_AUTHORIZATION_ENDPOINT = "https://example.com/authorization-endpoint"
OIDC_RP_CLIENT_ID = "myClientId"

Add OIDC urls to urls.py

Modify your project urls.py file.

urlpatterns = [
    # ....
    path('oidc/', include('mozilla_django_oidc.urls')),
    path('djangocms-oidc/', include('djangocms_oidc.urls')),
]

Settings

Most settings are the same as the project Mozilla Django OIDC.

The following values are defined in the plugins. It is therefore not necessary to set them in the project settings. They have no effect.

  • OIDC_RP_CLIENT_ID

  • OIDC_RP_CLIENT_SECRET

  • OIDC_OP_AUTHORIZATION_ENDPOINT

  • OIDC_OP_TOKEN_ENDPOINT

  • OIDC_OP_USER_ENDPOINT

The OIDC_RP_SCOPES parameter behaves differently from the parameter in mozilla-django-oidc due to overloaded function verify_claims. The parameter contains a string of claim names. If at least one of them is present in the response from the provider, the handover of the data is verified. Default value of parameter is 'openid2_id openid email'. One of these data must be handovered, otherwise the response from the provider is dismissed.

Usage in administration

These plugins are available to the editor in the administration:

  • OIDC Handover data

  • OIDC Login

  • OIDC List identifiers

  • OIDC Display dedicated content

  • OIDC Show attribute

  • OIDC Show attribute Country

How to use provider MojeID

Home › Djangocms_Oidc › Oidc register consumers › oidc register consumer: Add

Name: MojeID Test

Home › Djangocms_Oidc › Oidc providers › oidc provider: add

Name: MojeID Test
Code: mojeid
Register consumer: MojeID Test

Page structure: Add

OpenID Connect: OIDC Handover data
Provider: MojeID Test
Claims: {…} (copy from the example below) For mojeid see list “claims_supported” in .well-known openid-configuration.
Verified by names: … (copy from the example below)

How to run an example

Run the example in Docker. Install as follows:

$ git clone https://github.com/CZ-NIC/djangocms-oidc-form-fields.git
$ cd djangocms-oidc-form-fields/example
$ docker-compose build web
$ docker-compose run --user $(id -u):$(id -g) web python manage.py migrate
$ docker-compose run --user $(id -u):$(id -g) web python manage.py loaddata site.json

Start the webserver:

$ docker-compose up -d

Open in your browser: http://localhost:8000/. To log in to the administrations use admin:password at http://localhost:8000/admin.

Stop the webserver:

$ docker-compose down

License

This software is licensed under the GNU GPL license. For more info check the LICENSE file.

Metadata

Release files for djangocms-oidc 5.1.0

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

Source distribution (sdist)

Source distribution for djangocms-oidc 5.1.0
File Size Uploaded Provenance Actions
djangocms_oidc-5.1.0.tar.gz 40.9 kB Without provenance Details for djangocms_oidc-5.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for djangocms-oidc 5.1.0
File Interpreter ABI Platform Actions
djangocms_oidc-5.1.0-py3-none-any.whl Python 3 none any Details for djangocms_oidc-5.1.0-py3-none-any.whl

Total release size: 93.3 kB

Release files / djangocms_oidc-5.1.0.tar.gz

Download URL djangocms_oidc-5.1.0.tar.gz
Size 40.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6661e96ff63066455d46ec979a629f0db0444a8b5406f125a14761501d642ae4
BLAKE2b-256 checksum
How to use checksums
f8284bf73a9e0a3a298cf44f856b28ff2bece084f65eacabcffc31d8906f68a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.3

Release files / djangocms_oidc-5.1.0-py3-none-any.whl

Download URL djangocms_oidc-5.1.0-py3-none-any.whl
Size 52.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a43008b0f3109393cf3eefbe43098424a73ea1c5077d9c8e43c2c458d39de728
BLAKE2b-256 checksum
How to use checksums
11d4432f8e6c3b4d95cb67e032b6a192babb4b3c9960acc9e57add442c6db863
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.3

Security for djangocms-oidc 5.1.0

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