Browse files

Cleaner token verification method

  • Loading branch information...
1 parent 5b126e2 commit 3ff436b71880a930abecf9297b1072d66584582b @nickstenning committed Dec 31, 2010
Showing with 2 additions and 7 deletions.
  1. +2 −7 annotator/auth.py
View
9 annotator/auth.py
@@ -57,7 +57,7 @@ def verify_token(token, key, userId, issueTime):
def verify_request(request):
pre = 'x-annotator-'
- required = ['auth-token', 'auth-token-issue-time', 'consumer-key', 'user-id']
+ required = ['auth-token', 'consumer-key', 'user-id', 'auth-token-issue-time']
headers = [pre + key for key in required]
rh = request.headers
@@ -66,12 +66,7 @@ def verify_request(request):
if not set(headers) <= set([key.lower() for key in rh.keys()]):
return False
- result = verify_token(
- rh[pre + 'auth-token'],
- rh[pre + 'consumer-key'],
- rh[pre + 'user-id'],
- rh[pre + 'auth-token-issue-time']
- )
+ result = verify_token( *[rh[h] for h in headers] )
return result

0 comments on commit 3ff436b

Please sign in to comment.