Better error handling for missing authentication
buildbot/multibuild_parent Build done. Details
buildbot/travis_bionic Build done. Details

This commit is contained in:
Peter Šurda 2023-12-04 16:06:22 +08:00
parent 63efe9830f
commit 278b442aab
Signed by: PeterSurda
GPG Key ID: 3E47497CF67ABB95
1 changed files with 4 additions and 0 deletions

View File

@ -58,7 +58,11 @@ class Root:
@cherrypy.expose
def todo(self):
authorization = cherrypy.request.headers.get('Authorization', ':')
if not authorization:
raise cherrypy.HTTPError(401, 'Unauthorized')
token = get_token(authorization)
if not token:
raise cherrypy.HTTPError(401, 'Unauthorized')
combined = get_combined(token)
if not combined:
raise cherrypy.HTTPError(401, 'Unauthorized')