Authentication fixes
This commit is contained in:
parent
2467612e42
commit
8df8de76fc
|
@ -49,7 +49,7 @@ def process_combined(combined):
|
|||
return cal.to_ical()
|
||||
|
||||
def get_token(input_token):
|
||||
token = input_token.lstrip("Basic ")
|
||||
token = input_token.removeprefix("Basic ")
|
||||
token = b64decode(token).decode('utf8', 'ignore')
|
||||
with cherrypy.HTTPError.handle(ValueError, 401):
|
||||
_, token = token.split(":", 2)
|
||||
|
@ -58,6 +58,8 @@ def get_token(input_token):
|
|||
class Root:
|
||||
@cherrypy.expose
|
||||
def todo(self):
|
||||
cherrypy.response.headers['WWW-Authenticate'] = \
|
||||
'Basic realm="ICS access"'
|
||||
authorization = cherrypy.request.headers.get('Authorization', ':')
|
||||
if not authorization:
|
||||
raise cherrypy.HTTPError(401, 'Unauthorized')
|
||||
|
|
Loading…
Reference in New Issue
Block a user