providers/oauth2: fallback to uid if UPN was selected but isn't available

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-10-27 16:11:35 +02:00
parent fa6324ab1d
commit 1b21b50b77
1 changed files with 1 additions and 1 deletions

View File

@ -448,7 +448,7 @@ class RefreshToken(ExpiringModel, BaseGrantModel):
elif self.provider.sub_mode == SubModes.USER_USERNAME: elif self.provider.sub_mode == SubModes.USER_USERNAME:
sub = user.username sub = user.username
elif self.provider.sub_mode == SubModes.USER_UPN: elif self.provider.sub_mode == SubModes.USER_UPN:
sub = user.attributes["upn"] sub = user.attributes.get("upn", user.uid)
else: else:
raise ValueError( raise ValueError(
( (