diff options
author | Helmut Grohne <helmut@subdivi.de> | 2011-11-30 18:48:33 +0100 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2011-11-30 18:48:33 +0100 |
commit | cc4210dc555678b603e80da198f512bcc15b663b (patch) | |
tree | 716701b594a4e8458cbaf7a6be5b2d1c99ba252f /wsgitools/middlewares.py | |
parent | 18ffdf8301a29f35d3a549d3e96dcb0c7aa23d0b (diff) | |
download | wsgitools-cc4210dc555678b603e80da198f512bcc15b663b.tar.gz |
shrink AuthenticationMiddleware.authenticate interface
The method no longer receives a start_response and is no longer
responsible for calling self.app. Instead it returns a dictionary with
the result of the authentication.
Diffstat (limited to 'wsgitools/middlewares.py')
-rw-r--r-- | wsgitools/middlewares.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/wsgitools/middlewares.py b/wsgitools/middlewares.py index 13ba41c..b385e91 100644 --- a/wsgitools/middlewares.py +++ b/wsgitools/middlewares.py @@ -337,9 +337,9 @@ class BasicAuthMiddleware(AuthenticationMiddleware): self.realm = realm self.app401 = app401 - def authenticate(self, auth, environ, start_response): - """wsgi interface - @type environ: {str: str} + def authenticate(self, auth, environ): + """ + @type environ: {str: object} """ assert isinstance(environ, dict) try: @@ -355,8 +355,7 @@ class BasicAuthMiddleware(AuthenticationMiddleware): except TypeError: # catch old interface result = self.check_function(username, password) if result: - environ["REMOTE_USER"] = username - return self.app(environ, start_response) + return dict(user=username) raise AuthenticationRequired("credentials not valid") def www_authenticate(self, exception): |