Closed agronholm closed 8 years ago
For reference, here is the current (untested, unused) basic authentication code:
class BasicAuthMiddleware(object):
def __init__(self, application):
self.application = application
def __call__(self, environ, start_response):
if 'HTTP_AUTHORIZATION' in environ:
authtype, auth = environ['HTTP_AUTHORIZATION'].split()
if authtype.lower() == 'basic':
try:
un, pw = b64decode(auth).split(':')
except TypeError:
return HTTPUnauthorized()
if not web.auth.authenticate(un, pw):
return HTTPUnauthorized()
try:
return self.application(environ, start_response)
except HTTPException, e:
return e(environ, start_response)
This code has been removed from WebCore 1.1.
There is a rudimentary basic auth middleware, but it's not hooked up to anything. Digest support should be added. Perhaps this could be merged with the WebAuth middleware? Also, how should HTTP authentication be enabled? web.auth = basic,digest? web.auth=http?