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:
parent
fa6324ab1d
commit
1b21b50b77
|
@ -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(
|
||||||
(
|
(
|
||||||
|
|
Reference in New Issue