summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xwsgitools/digest.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/wsgitools/digest.py b/wsgitools/digest.py
index 244eb98..a0eb973 100755
--- a/wsgitools/digest.py
+++ b/wsgitools/digest.py
@@ -129,16 +129,16 @@ class AuthDigestMiddleware:
if not self.is_nonce(credentials): # riases KeyError, ValueError
raise AuthenticationRequired
- if not self.check_nonce(credentials): # raises KeyError, ValueError
- return self.authorization_required(environ, start_response,
- stale=True) # stale nonce!
-
# raises KeyError, ValueError
response = self.auth_response(credentials,
environ["REQUEST_METHOD"])
if response is None or response != credentials["response"]:
raise AuthenticationRequired
+ if not self.check_nonce(credentials): # raises KeyError, ValueError
+ return self.authorization_required(environ, start_response,
+ stale=True) # stale nonce!
+
except (KeyError, ValueError, AuthenticationRequired):
return self.authorization_required(environ, start_response)
else: