From 779d773d9a35330df7af770c4da1bbc8a99e2c52 Mon Sep 17 00:00:00 2001
From: Sivert Kronen Hatteberg <skh@uio.no>
Date: Mon, 15 Nov 2021 12:04:06 +0100
Subject: [PATCH] Add NIN when loggin in with feide

---
 gregui/authentication/auth_backends.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gregui/authentication/auth_backends.py b/gregui/authentication/auth_backends.py
index 4c2dfe99..5240629d 100644
--- a/gregui/authentication/auth_backends.py
+++ b/gregui/authentication/auth_backends.py
@@ -240,8 +240,8 @@ class GregOIDCBackend(ValidatingOIDCBackend):
 
             if userinfo["auth_type"] == "feide":
                 extended_userinfo = self.get_extended_userinfo(access_token)
-
-                logger.info(extended_userinfo)
+                if "norEduPersonNIN" in extended_userinfo:
+                    userinfo["userid_nin"] = extended_userinfo["norEduPersonNIN"]
 
             self._get_or_create_greg_user_profile(userinfo, user)
         return user
-- 
GitLab