From: Radek Czajka Date: Tue, 6 Apr 2021 21:43:51 +0000 (+0200) Subject: Use canonical organization e-mail in OIDC data. X-Git-Url: https://git.mdrn.pl/cas.git/commitdiff_plain/a8839fd03b111157daa7dc79ea0bab713118e942?ds=sidebyside Use canonical organization e-mail in OIDC data. --- 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]}" + }