diff options
author | Devaev Maxim <[email protected]> | 2020-08-30 20:09:11 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2020-08-30 20:09:11 +0300 |
commit | a7de2184a7acd814c60452c136d5607941c8dad1 (patch) | |
tree | 2f89ecbd99b478b8a74c22ae31efa2073dcba7cc /kvmd | |
parent | c10b614b084a8daf516a0148736a736c1dc67173 (diff) |
refactoring
Diffstat (limited to 'kvmd')
-rw-r--r-- | kvmd/apps/kvmd/api/auth.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/kvmd/apps/kvmd/api/auth.py b/kvmd/apps/kvmd/api/auth.py index 80996e7e..7eafefd4 100644 --- a/kvmd/apps/kvmd/api/auth.py +++ b/kvmd/apps/kvmd/api/auth.py @@ -52,6 +52,7 @@ async def check_request_auth(auth_manager: AuthManager, exposed: HttpExposed, re set_request_auth_info(request, f"{user} (xhdr)") if not (await auth_manager.authorize(user, valid_passwd(passwd))): raise ForbiddenError() + return elif token: user = auth_manager.check(valid_auth_token(token)) @@ -59,9 +60,9 @@ async def check_request_auth(auth_manager: AuthManager, exposed: HttpExposed, re set_request_auth_info(request, "- (token)") raise ForbiddenError() set_request_auth_info(request, f"{user} (token)") + return - else: - raise UnauthorizedError() + raise UnauthorizedError() class AuthApi: |