Plugin OIDC (OpenID Connect) for Aldryn form fields.
Project description
DjangoCMS OIDC (OpenID Connect) plugins for Aldryn form fields
Plugins for post a data hangovered from OpenID provider, based on plugins DjangoCMS OIDC and Aldryn Forms.
Installation
$ pip install djangocms-oidc-form-fields
Add settings to settings.py
Start by making the following changes to your settings.py file.
# Add 'aldryn_forms' and 'djangocms_oidc_form_fields' to INSTALLED_APPS
INSTALLED_APPS = [
# ...
'multiselectfield',
'django_countries',
'mozilla_django_oidc', # place after auth (django.contrib.auth)
'djangocms_oidc',
'aldryn_forms',
'djangocms_oidc_form_fields',
]
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')),
]
Usage in administration
These plugins are available to the editor in the administration:
OIDC Fields
OIDC Text
OIDC Textarea
OIDC Hidden
OIDC Email
OIDC EmailIntoFromField
OIDC Phone
OIDC Number
OIDC Boolean
How to use provider MojeID
Home › Djangocms_Oidc › Oidc register consumers › oidc register consumer: Add
Name: MojeID TestRegister consumer: https://mojeid.regtest.nic.cz/oidc/registration/
Home › Djangocms_Oidc › Oidc providers › oidc provider: add
Name: MojeID TestCode: mojeidRegister consumer: MojeID TestAuthorization endpoint: https://mojeid.regtest.nic.cz/oidc/authorization/Token endpoint: https://mojeid.regtest.nic.cz/oidc/token/User endpoint: https://mojeid.regtest.nic.cz/oidc/userinfo/Account URL: https://mojeid.regtest.nic.cz/editor/Logout URL: https://mojeid.regtest.nic.cz/logout/
Page structure: Add
OpenID Connect: OIDC Handover dataProvider: MojeID TestClaims: {…} (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
You start the webserver:
$ docker-compose up -d
Open in your browser: https://localhost:8000/. To log in to the administrations use admin:password at http://localhost:8000/admin.
You sto Webserver:
$ docker-compose down
License
This software is licensed under the GNU GPL license. For more info check the LICENSE file.
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
Built Distribution
File details
Details for the file djangocms-oidc-form-fields-2.0.1.tar.gz
.
File metadata
- Download URL: djangocms-oidc-form-fields-2.0.1.tar.gz
- Upload date:
- Size: 28.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9dd153ea62501ffcac35984ae7477a5b7f8d6c5b8056655f89aab545baaf09e9 |
|
MD5 | 8b139090627c5a7487e0fd36ceb8bff5 |
|
BLAKE2b-256 | 643c5497bb6b951ec46a22af7e745fab039b6bdafb9b79b6a4ecad8e46f4e88e |
File details
Details for the file djangocms_oidc_form_fields-2.0.1-py3-none-any.whl
.
File metadata
- Download URL: djangocms_oidc_form_fields-2.0.1-py3-none-any.whl
- Upload date:
- Size: 32.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57ee08ff97af60607bf969f6be0e8e04c36b181d5ae377f467d0782dc81b46b8 |
|
MD5 | 269f5c439b86695708cdcaadbc95ef03 |
|
BLAKE2b-256 | a986068aa81ab5906b5a3d8912c3db4df8cbfa7ecb37eddba1bc51dfc6309063 |