Improve authentication error handling
This commit is contained in:
parent
278b442aab
commit
7f2ac0ff6b
|
@ -51,7 +51,10 @@ def process_combined(combined):
|
|||
def get_token(input_token):
|
||||
token = input_token.lstrip("Basic ")
|
||||
token = b64decode(token).decode('utf8', 'ignore')
|
||||
_, token = token.split(":", 2)
|
||||
try:
|
||||
_, token = token.split(":", 2)
|
||||
except ValueError:
|
||||
raise cherrypy.HTTPError(401, 'Unauthorized')
|
||||
return token
|
||||
|
||||
class Root:
|
||||
|
|
Loading…
Reference in New Issue
Block a user