sources/oauth: use UPN for username with azure AD source

closes #3468
breaking

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-08-23 20:55:25 +02:00
parent e994a01e80
commit 13a302cdad
2 changed files with 2 additions and 2 deletions

View File

@ -41,6 +41,6 @@ class TestTypeAzureAD(TestCase):
def test_enroll_context(self):
"""Test azure_ad Enrollment context"""
ak_context = AzureADOAuthCallback().get_user_enroll_context(AAD_USER)
self.assertEqual(ak_context["username"], AAD_USER["displayName"])
self.assertEqual(ak_context["username"], AAD_USER["userPrincipalName"])
self.assertEqual(ak_context["email"], AAD_USER["mail"])
self.assertEqual(ak_context["name"], AAD_USER["displayName"])

View File

@ -31,7 +31,7 @@ class AzureADOAuthCallback(OAuthCallback):
) -> dict[str, Any]:
mail = info.get("mail", None) or info.get("otherMails", [None])[0]
return {
"username": info.get("displayName"),
"username": info.get("userPrincipalName"),
"email": mail,
"name": info.get("displayName"),
}