diff options
author | ianb <devnull@localhost> | 2007-08-09 15:52:56 +0000 |
---|---|---|
committer | ianb <devnull@localhost> | 2007-08-09 15:52:56 +0000 |
commit | d82bca0314d175a859f303ee7e43ce985cf8561b (patch) | |
tree | 4c550281d150abb9a29234a207f179ae16b71e71 /paste/auth | |
parent | 884b0b143f6da8f791117dabe4976a734be83e22 (diff) | |
download | paste-d82bca0314d175a859f303ee7e43ce985cf8561b.tar.gz |
Try to encode values to auth_tkt
Diffstat (limited to 'paste/auth')
-rw-r--r-- | paste/auth/auth_tkt.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/paste/auth/auth_tkt.py b/paste/auth/auth_tkt.py index e3e64dc..c35c379 100644 --- a/paste/auth/auth_tkt.py +++ b/paste/auth/auth_tkt.py @@ -160,6 +160,10 @@ def parse_ticket(secret, ticket, ip): return (timestamp, userid, tokens, user_data) def calculate_digest(ip, timestamp, secret, userid, tokens, user_data): + secret = maybe_encode(secret) + userid = maybe_encode(userid) + tokens = maybe_encode(tokens) + user_data = maybe_encode(user_data) digest0 = md5.new( encode_ip_timestamp(ip, timestamp) + secret + userid + '\0' + tokens + '\0' + user_data).hexdigest() @@ -176,6 +180,10 @@ def encode_ip_timestamp(ip, timestamp): ts_chars = ''.join(map(chr, ts)) return ip_chars + ts_chars +def maybe_encode(s, encoding='utf8'): + if isinstance(s, unicode): + s = s.encode(encoding) + return s class AuthTKTMiddleware(object): |