Better error handling for missing authentication
This commit is contained in:
parent
63efe9830f
commit
278b442aab
|
@ -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')
|
||||
|
|
Loading…
Reference in New Issue
Block a user