summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--wsgitools/middlewares.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/wsgitools/middlewares.py b/wsgitools/middlewares.py
index b725565..201634b 100644
--- a/wsgitools/middlewares.py
+++ b/wsgitools/middlewares.py
@@ -297,7 +297,11 @@ class BasicAuthMiddleware:
if auth_type.lower() != "basic" or ':' not in auth_info:
return self.authorization_required(environ, start_response)
username, password = auth_info.split(':', 1)
- if self.check_function(username, password):
+ try:
+ result = self.check_function(username, password, environ)
+ except TypeError: # catch old interface
+ result = self.check_function(username, password)
+ if result:
environ["REMOTE_USER"] = username
return self.app(environ, start_response)
return self.authorization_required(environ, start_response)