Closed terion-name closed 6 months ago
Weird! We use OIDC in the ANCT server, see our OIDC class here (overridden to be able to control some params):
https://github.com/umap-project/umap-dsfr/blob/main/umap_dsfr/moncomptepro.py
@yohanboniface we've figured out already. To keep things simple and keep everything in one settings file to be supplied to docker container, this will work like this:
import environ, os
from django.utils.module_loading import import_string
env = environ.Env()
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
"HOST": os.environ.get("POSTGRES_HOST", "db"),
"NAME": os.environ.get("POSTGRES_DB", "umap"),
"USER": os.environ.get("POSTGRES_USER", "postgres"),
"PASSWORD": os.environ.get("POSTGRES_PASSWORD", "secret"),
"PORT": 5432,
"DISABLE_SERVER_SIDE_CURSORS": True,
}
}
OPEN_ID_CONNECT_BACKEND = import_string('social_core.backends.open_id_connect.OpenIdConnectAuth')
SOCIAL_AUTH_KEY = env('SOCIAL_AUTH_KEY', default='')
SOCIAL_AUTH_SECRET = env('SOCIAL_AUTH_SECRET', default='')
OPEN_ID_CONNECT_BACKEND.OIDC_ENDPOINT = env('SOCIAL_AUTH_OPEN_ID_CONNECT_ENDPOINT_URL', default='')
OPEN_ID_CONNECT_BACKEND.ID_TOKEN_ISSUER = env('SOCIAL_AUTH_OPEN_ID_CONNECT_ID_TOKEN_ISSUER', default='')
OPEN_ID_CONNECT_BACKEND.ACCESS_TOKEN_URL = env('SOCIAL_AUTH_OPEN_ID_CONNECT_ACCESS_TOKEN_URL', default='')
OPEN_ID_CONNECT_BACKEND.AUTHORIZATION_URL = env('SOCIAL_AUTH_OPEN_ID_CONNECT_AUTHORIZATION_URL', default='')
OPEN_ID_CONNECT_BACKEND.REVOKE_TOKEN_URL = env('SOCIAL_AUTH_OPEN_ID_CONNECT_REVOKE_TOKEN_URL', default='')
OPEN_ID_CONNECT_BACKEND.USERINFO_URL = env('SOCIAL_AUTH_OPEN_ID_CONNECT_USERINFO_URL', default='')
OPEN_ID_CONNECT_BACKEND.JWKS_URI = env('SOCIAL_AUTH_OPEN_ID_CONNECT_JWKS_URI', default='')
SOCIAL_AUTH_AUTHENTICATION_BACKENDS = (
'social_core.backends.open_id_connect.OpenIdConnectAuth',
)
AUTHENTICATION_BACKENDS = (
'social_core.backends.open_id_connect.OpenIdConnectAuth',
'django.contrib.auth.backends.ModelBackend',
)
Thanks for providing the working settings, it may help someone else!
Describe the bug Trying to setup umap with third-party OIDC provider.
Installation:
local_settings.py:
As the result:
... But user is still not logged in. And it is weird, because everything looks fine and no errors in logs. If I enable generic auth — it works ok.
Decrypted session data of oidc-connected user is:
To compare it with generic auth userdata:
Looked for everything — no idea why
To Reproduce Take compose and settings above, add to .env vars for any third-party OIDC (okta, keycloak, authentik, etc), try to log in
Expected behavior User is logged in
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):