X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/chopwood/blobdiff_plain/60b6f5b35c3602f4bea942ceaaaee7528b74356c..eaac44f3ca7ffee0dd428830aa40e0917df122fc:/httpauth.py?ds=inline diff --git a/httpauth.py b/httpauth.py index 4a41e4f..13ba0d1 100644 --- a/httpauth.py +++ b/httpauth.py @@ -175,6 +175,7 @@ LOGIN_REASONS = { 'EXPIRED': 'session timed out', 'BADTAG': 'incorrect tag', 'NOUSER': 'unknown user name', + 'LOGOUT': 'explicitly logged out', None: None } @@ -201,6 +202,9 @@ def check_auth(token, nonce = None): global NONCE + ## If the token has been explicitly clobbered, then we're logged out. + if token == 'logged-out': raise AuthenticationFailed, 'LOGOUT' + ## Parse the token. bits = token.split('.', 3) if len(bits) != 4: raise AuthenticationFailed, 'BADTOKEN'