8
8
9
9
from jwt import (
10
10
ExpiredSignatureError , InvalidSignatureError , InvalidAudienceError ,
11
- ImmatureSignatureError
11
+ ImmatureSignatureError , InvalidIssuerError
12
12
)
13
13
14
14
from flask_jwt_extended import (
@@ -246,9 +246,9 @@ def test_valid_aud(app, default_access_token, token_aud):
246
246
app .config ['JWT_DECODE_AUDIENCE' ] = ['foo' , 'bar' ]
247
247
248
248
default_access_token ['aud' ] = token_aud
249
- invalid_token = encode_token (app , default_access_token )
249
+ valid_token = encode_token (app , default_access_token )
250
250
with app .test_request_context ():
251
- decoded = decode_token (invalid_token )
251
+ decoded = decode_token (valid_token )
252
252
assert decoded ['aud' ] == token_aud
253
253
254
254
@@ -261,3 +261,21 @@ def test_invalid_aud(app, default_access_token, token_aud):
261
261
with pytest .raises (InvalidAudienceError ):
262
262
with app .test_request_context ():
263
263
decode_token (invalid_token )
264
+
265
+ def test_valid_iss (app , default_access_token ):
266
+ app .config ['JWT_DECODE_ISSUER' ] = 'foobar'
267
+
268
+ default_access_token ['iss' ] = 'foobar'
269
+ valid_token = encode_token (app , default_access_token )
270
+ with app .test_request_context ():
271
+ decoded = decode_token (valid_token )
272
+ assert decoded ['iss' ] == 'foobar'
273
+
274
+ def test_invalid_iss (app , default_access_token ):
275
+ app .config ['JWT_DECODE_ISSUER' ] = 'baz'
276
+
277
+ default_access_token ['iss' ] = 'foobar'
278
+ invalid_token = encode_token (app , default_access_token )
279
+ with pytest .raises (InvalidIssuerError ):
280
+ with app .test_request_context ():
281
+ decode_token (invalid_token )
0 commit comments