Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Side by Side Diff: appengine/components/components/auth/tokens.py

Issue 2013943002: Changing license header, again! (Closed) Base URL: git@github.com:luci/luci-py.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2014 The LUCI Authors. All rights reserved. 1 # Copyright 2014 The LUCI Authors. All rights reserved.
2 # Use of this source code is governed by the Apache v2.0 license that can be 2 # Use of this source code is governed under the Apache License, Version 2.0
3 # found in the LICENSE file. 3 # that can be found in the LICENSE file.
4 4
5 """Functions to generate and validate tokens signed with MAC tags.""" 5 """Functions to generate and validate tokens signed with MAC tags."""
6 6
7 import base64 7 import base64
8 import hashlib 8 import hashlib
9 import hmac 9 import hmac
10 import json 10 import json
11 import time 11 import time
12 12
13 from components import utils 13 from components import utils
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 try: 364 try:
365 public = { 365 public = {
366 k.encode('ascii', 'replace'): v.encode('ascii', 'replace') 366 k.encode('ascii', 'replace'): v.encode('ascii', 'replace')
367 for k, v in json.loads(public).iteritems() 367 for k, v in json.loads(public).iteritems()
368 } 368 }
369 except (AttributeError, ValueError): 369 except (AttributeError, ValueError):
370 pass 370 pass
371 # At least one secret key should match. 371 # At least one secret key should match.
372 raise InvalidTokenError( 372 raise InvalidTokenError(
373 'Bad token MAC; now=%d; data=%s' % (time.time(), public)) 373 'Bad token MAC; now=%d; data=%s' % (time.time(), public))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698