From 00a2a3e08522f70126ce56296b7a8d6530e81769 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Wed, 5 Apr 2023 23:28:17 +0800 Subject: [PATCH] bugfix --- ahserver/auth_api.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ahserver/auth_api.py b/ahserver/auth_api.py index 102e4a7..1be4901 100644 --- a/ahserver/auth_api.py +++ b/ahserver/auth_api.py @@ -2,6 +2,7 @@ from aiohttp_auth import auth from os import urandom from aiohttp import web import aiohttp_session +import base64 from aiohttp_session import get_session, session_middleware from aiohttp_session.cookie_storage import EncryptedCookieStorage @@ -50,6 +51,10 @@ class AuthAPI(AppLogger): if authinfo is None: self.debug('header not include "authorization" info %s' % request.headers) raise web.HTTPUnauthorized() + if isinstance(authinfo, str): + authinfo = authinfo.encode('ascii') + authinfo = base64.b64decode(authinfo) + authinfo = authinfo.decode('ascii') authdata = self.rsaDecode(authinfo) # print('authdata=',authdata)