From a8839fd03b111157daa7dc79ea0bab713118e942 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Tue, 6 Apr 2021 23:43:51 +0200 Subject: [PATCH 1/1] Use canonical organization e-mail in OIDC data. --- src/cas/settings.py | 4 ++++ src/emails/oidc.py | 7 +++++++ 2 files changed, 11 insertions(+) create mode 100644 src/emails/oidc.py diff --git a/src/cas/settings.py b/src/cas/settings.py index 47afd45..ab10159 100644 --- a/src/cas/settings.py +++ b/src/cas/settings.py @@ -125,6 +125,10 @@ GRAVATAR_URL_PREFIX = 'https://www.gravatar.com/' SITE_TITLE = 'Fundacja Nowoczesna Polska' + +OIDC_USERINFO = 'emails.oidc.userinfo' + + # Import localsettings file, which may override settings defined here try: from .localsettings import * diff --git a/src/emails/oidc.py b/src/emails/oidc.py new file mode 100644 index 0000000..e8c1196 --- /dev/null +++ b/src/emails/oidc.py @@ -0,0 +1,7 @@ +from . import BASE_DOMAINS + + +def userinfo(claims, user): + return { + "email": f"{user.username}@{BASE_DOMAINS[0]}" + } -- 2.20.1