diff options
Diffstat (limited to 'wsgitools/digest.py')
-rw-r--r-- | wsgitools/digest.py | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/wsgitools/digest.py b/wsgitools/digest.py index 628eac5..fc8e310 100644 --- a/wsgitools/digest.py +++ b/wsgitools/digest.py @@ -657,9 +657,7 @@ class AuthDigestMiddleware(AuthenticationMiddleware): assert hasattr(store, "checknonce") self.noncestore = store - def authenticate(self, auth, environ, start_response): - """wsgi interface""" - + def authenticate(self, auth, environ): try: credentials = parse_digest_response(auth) except ValueError: @@ -702,17 +700,14 @@ class AuthDigestMiddleware(AuthenticationMiddleware): if response is None or response != credresponse: raise AuthenticationRequired("wrong response") - environ["REMOTE_USER"] = credentials["username"] digest = dict(nextnonce=self.noncestore.newnonce()) if "qop" in credentials: digest["qop"] = "auth" digest["cnonce"] = credentials["cnonce"] # no KeyError digest["rspauth"] = self.auth_response(credentials, "") challenge = ", ".join(map('%s="%s"'.__mod__, digest.items())) - def modified_start_response(status, headers, exc_info=None): - headers.append(("Authentication-Info", challenge)) - return start_response(status, headers, exc_info) - return self.app(environ, modified_start_response) + return dict(user=credentials["username"], + outheaders=[("Authentication-Info", challenge)]) def auth_response(self, credentials, reqmethod): """internal method generating authentication tokens |