Use canonical organization e-mail in OIDC data.
authorRadek Czajka <rczajka@rczajka.pl>
Tue, 6 Apr 2021 21:43:51 +0000 (23:43 +0200)
committerRadek Czajka <rczajka@rczajka.pl>
Tue, 6 Apr 2021 21:43:51 +0000 (23:43 +0200)
src/cas/settings.py
src/emails/oidc.py [new file with mode: 0644]

index 47afd45..ab10159 100644 (file)
@@ -125,6 +125,10 @@ GRAVATAR_URL_PREFIX = 'https://www.gravatar.com/'
 
 SITE_TITLE = 'Fundacja Nowoczesna Polska'
 
 
 SITE_TITLE = 'Fundacja Nowoczesna Polska'
 
+
+OIDC_USERINFO = 'emails.oidc.userinfo'
+
+
 # Import localsettings file, which may override settings defined here
 try:
     from .localsettings import *
 # 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 (file)
index 0000000..e8c1196
--- /dev/null
@@ -0,0 +1,7 @@
+from . import BASE_DOMAINS
+
+
+def userinfo(claims, user):
+    return {
+        "email": f"{user.username}@{BASE_DOMAINS[0]}"
+    }