Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #8 from mozilla/rfk/remove-parse-cls

Remove ability to use a custom JWT subclass for parsing.
  • Loading branch information...
commit fb08ffe438d18c9a7637a9385792a02f2c145dc0 2 parents ed4e7fc + 3126a37
Alexis Metaireau ametaireau authored
3  CHANGES.txt
... ... @@ -1,7 +1,8 @@
1 1 0.6.0 - XXXX-XX-XX
2 2 ==================
3 3
4   - * Nothing yet...
  4 + * Remove ability to use a custom JWT parser class, it's not used and
  5 + adds needless complexity.
5 6
6 7 0.5.0 - 2012-04-18
7 8 ==================
6 browserid/jwt.py
@@ -18,10 +18,8 @@
18 18 from browserid.utils import decode_json_bytes, encode_json_bytes
19 19
20 20
21   -def parse(jwt, cls=None):
  21 +def parse(jwt):
22 22 """Parse a JWT from a string."""
23   - if cls is None:
24   - cls = JWT
25 23 algorithm, payload, signature = jwt.split(".")
26 24 signed_data = algorithm + "." + payload
27 25 try:
@@ -30,7 +28,7 @@ def parse(jwt, cls=None):
30 28 raise ValueError("badly formed JWT")
31 29 payload = decode_json_bytes(payload)
32 30 signature = decode_bytes(signature)
33   - return cls(algorithm, payload, signature, signed_data)
  31 + return JWT(algorithm, payload, signature, signed_data)
34 32
35 33
36 34 def generate(payload, key):
5 browserid/verifiers/local.py
@@ -26,7 +26,7 @@ class LocalVerifier(Verifier):
26 26 """
27 27
28 28 def __init__(self, audiences=None, trusted_secondaries=None, certs=None,
29   - parser_cls=None, warning=True):
  29 + warning=True):
30 30 if trusted_secondaries is None:
31 31 trusted_secondaries = DEFAULT_TRUSTED_SECONDARIES
32 32
@@ -36,13 +36,12 @@ def __init__(self, audiences=None, trusted_secondaries=None, certs=None,
36 36 super(LocalVerifier, self).__init__(audiences)
37 37 self.trusted_secondaries = trusted_secondaries
38 38 self.certs = certs
39   - self.parser_cls = parser_cls
40 39
41 40 if warning:
42 41 _emit_warning()
43 42
44 43 def parse_jwt(self, data):
45   - return jwt.parse(data, self.parser_cls)
  44 + return jwt.parse(data)
46 45
47 46 def verify(self, assertion, audience=None, now=None):
48 47 """Verify the given BrowserID assertion.
4 setup.py
@@ -12,6 +12,8 @@
12 12
13 13 requires = ['M2Crypto', 'requests']
14 14
  15 +tests_require = requires + ['mock']
  16 +
15 17 setup(name='PyBrowserID',
16 18 version='0.5.0',
17 19 description='Python library for the BrowserID Protocol',
@@ -29,5 +31,5 @@
29 31 include_package_data=True,
30 32 zip_safe=False,
31 33 install_requires=requires,
32   - tests_require=requires,
  34 + tests_require=tests_require,
33 35 test_suite="browserid")

0 comments on commit fb08ffe

Please sign in to comment.
Something went wrong with that request. Please try again.