Package: djangocms-oidc
DjangoCMS OIDC (OpenID Connect)Plugins for user authentication via OpenID, based onMozilla Django OIDC.Installation$pipinstalldjangocms-oidcCaution! If you are using projectdjango-python3-ldap, you must use version higher than0.11.3.Example inrequirements.txt:django-python3-ldap@git+https://github.com/etianen/django-python3-ldap.git@759d3483d9e656fef2b6a2e669101bca3021d9d5Add settings to settings.pyStart by making the following changes to yoursettings.pyfile.# Add 'mozilla_django_oidc' and 'djangocms_oidc' to INSTALLED_APPSINSTALLED_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 classesOIDC_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.pyModify your projecturls.pyfile.urlpatterns=[# ....path('oidc/',include('mozilla_django_oidc.urls')),path('djangocms-oidc/',include('djangocms_oidc.urls')),]SettingsMost settings are the same as the projectMozilla 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_IDOIDC_RP_CLIENT_SECRETOIDC_OP_AUTHORIZATION_ENDPOINTOIDC_OP_TOKEN_ENDPOINTOIDC_OP_USER_ENDPOINTTheOIDC_RP_SCOPESparameter behaves differently from the parameter inmozilla-django-oidcdue to overloaded functionverify_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 administrationThese plugins are available to the editor in the administration:OIDC Handover dataOIDC LoginOIDC List identifiersOIDC Display dedicated contentOIDC Show attributeOIDC Show attribute CountryHow to use provider MojeIDHome › Djangocms_Oidc › Oidc register consumers › oidc register consumer: AddName: MojeID TestRegister consumer:https://mojeid.regtest.nic.cz/oidc/registration/Home › Djangocms_Oidc › Oidc providers › oidc provider: addName: 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: AddOpenID Connect: OIDC Handover dataProvider: MojeID TestClaims: {…} (copy from the example below) For mojeid see list “claims_supported” in .well-knownopenid-configuration.Verified by names: … (copy from the example below)How to run an exampleRun the example in Docker. Install as follows:$gitclonehttps://github.com/CZ-NIC/djangocms-oidc-form-fields.git$cddjangocms-oidc-form-fields/example$docker-composebuildweb$docker-composerun--user$(id-u):$(id-g)webpythonmanage.pymigrate$docker-composerun--user$(id-u):$(id-g)webpythonmanage.pyloaddatasite.jsonStart the webserver:$docker-composeup-dOpen in your browser:http://localhost:8000/. To log in to the administrations useadmin:passwordathttp://localhost:8000/admin.Stop the webserver:$docker-composedownLicenseThis software is licensed under the GNU GPL license. For more info check the LICENSE file.