Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Cleaner token verification method

  • Loading branch information...
commit 3ff436b71880a930abecf9297b1072d66584582b 1 parent 5b126e2
@nickstenning authored
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
Please sign in to comment.
Something went wrong with that request. Please try again.