(backend) handle empty subscription string

Handle case where sub value is an empty string instead of None.
Previously this edge case would cause unexpected behavior.

Related to previous commit that added the test coverage.
This commit is contained in:
lebaudantoine
2024-11-04 09:31:48 +01:00
committed by aleb_the_flash
parent ccbeeba68f
commit 11cd85d4eb

View File

@@ -66,7 +66,7 @@ class OIDCAuthenticationBackend(MozillaOIDCAuthenticationBackend):
user_info = self.get_userinfo(access_token, id_token, payload)
sub = user_info.get("sub")
if sub is None:
if not sub:
raise SuspiciousOperation(
_("User info contained no recognizable user identification")
)