Update middlewares.
All checks were successful
Build Base Application / Build (push) Successful in 1m40s
All checks were successful
Build Base Application / Build (push) Successful in 1m40s
This commit is contained in:
parent
84b5d45f1c
commit
092de8827d
@ -41,12 +41,12 @@ class BaseApplication(web.Application):
|
|||||||
web.run_app(self, *args, **kwargs)
|
web.run_app(self, *args, **kwargs)
|
||||||
|
|
||||||
async def authenticate(self, username, password):
|
async def authenticate(self, username, password):
|
||||||
return self.username == username and self.password == password
|
return self.basic_username == username and self.basic_password == password
|
||||||
|
|
||||||
@web.middleware
|
@web.middleware
|
||||||
async def base64_auth_middleware(self, request, handler):
|
async def base64_auth_middleware(self, request, handler):
|
||||||
auth_header = request.headers.get("Authorization")
|
auth_header = request.headers.get("Authorization")
|
||||||
if not self.username:
|
if not self.basic_username:
|
||||||
return await handler(request)
|
return await handler(request)
|
||||||
if not auth_header or not auth_header.startswith("Basic "):
|
if not auth_header or not auth_header.startswith("Basic "):
|
||||||
return web.Response(
|
return web.Response(
|
||||||
|
Loading…
Reference in New Issue
Block a user