|
| 1 | +from __future__ import annotations |
| 2 | + |
1 | 3 | import json
|
2 | 4 | import warnings
|
3 | 5 | from calendar import timegm
|
@@ -76,7 +78,7 @@ def decode_complete(
|
76 | 78 | detached_payload: Optional[bytes] = None,
|
77 | 79 | # passthrough arguments to _validate_claims
|
78 | 80 | # consider putting in options
|
79 |
| - audience: Optional[str] = None, |
| 81 | + audience: Optional[Union[str, Iterable[str]]] = None, |
80 | 82 | issuer: Optional[str] = None,
|
81 | 83 | leeway: Union[int, float, timedelta] = 0,
|
82 | 84 | # kwargs
|
@@ -150,7 +152,7 @@ def decode(
|
150 | 152 | detached_payload: Optional[bytes] = None,
|
151 | 153 | # passthrough arguments to _validate_claims
|
152 | 154 | # consider putting in options
|
153 |
| - audience: Optional[str] = None, |
| 155 | + audience: Optional[Union[str, Iterable[str]]] = None, |
154 | 156 | issuer: Optional[str] = None,
|
155 | 157 | leeway: Union[int, float, timedelta] = 0,
|
156 | 158 | # kwargs
|
@@ -180,8 +182,8 @@ def _validate_claims(self, payload, options, audience=None, issuer=None, leeway=
|
180 | 182 | if isinstance(leeway, timedelta):
|
181 | 183 | leeway = leeway.total_seconds()
|
182 | 184 |
|
183 |
| - if not isinstance(audience, (bytes, str, type(None), Iterable)): |
184 |
| - raise TypeError("audience must be a string, iterable, or None") |
| 185 | + if audience is not None and not isinstance(audience, (str, Iterable)): |
| 186 | + raise TypeError("audience must be a string, iterable or None") |
185 | 187 |
|
186 | 188 | self._validate_required_claims(payload, options)
|
187 | 189 |
|
|
0 commit comments