typing: Add assertions for authentication.

Signed-off-by: Zixuan James Li <359101898@qq.com>
This commit is contained in:
Zixuan James Li
2022-05-30 21:17:38 -04:00
committed by Tim Abbott
parent c572d9be5a
commit 4c6f2ae7be
6 changed files with 23 additions and 11 deletions

View File

@@ -1335,9 +1335,10 @@ class ExternalAuthResult:
# more customized error messages for those unlikely races, but
# it's likely not worth implementing.
realm = get_realm(data["subdomain"])
self.user_profile = authenticate(
username=data["email"], realm=realm, use_dummy_backend=True
)
auth_result = authenticate(username=data["email"], realm=realm, use_dummy_backend=True)
if auth_result is not None:
assert isinstance(auth_result, UserProfile)
self.user_profile = auth_result
class InvalidTokenError(Exception):
pass