@@ -55,6 +55,7 @@ def test_default_configs(app):
5555 assert config .access_expires == timedelta (minutes = 15 )
5656 assert config .refresh_expires == timedelta (days = 30 )
5757 assert config .algorithm == 'HS256'
58+ assert config .decode_algorithms == ['HS256' ]
5859 assert config .is_asymmetric is False
5960 assert config .blacklist_enabled is False
6061 assert config .blacklist_checks == ('access' , 'refresh' )
@@ -105,6 +106,7 @@ def test_override_configs(app, delta_func):
105106 app .config ['JWT_ACCESS_TOKEN_EXPIRES' ] = delta_func (minutes = 5 )
106107 app .config ['JWT_REFRESH_TOKEN_EXPIRES' ] = delta_func (days = 5 )
107108 app .config ['JWT_ALGORITHM' ] = 'HS512'
109+ app .config ['JWT_DECODE_ALGORITHMS' ] = ['HS512' , 'HS256' ]
108110
109111 app .config ['JWT_BLACKLIST_ENABLED' ] = True
110112 app .config ['JWT_BLACKLIST_TOKEN_CHECKS' ] = ('refresh' ,)
@@ -156,6 +158,7 @@ class CustomJSONEncoder(JSONEncoder):
156158 assert config .access_expires == delta_func (minutes = 5 )
157159 assert config .refresh_expires == delta_func (days = 5 )
158160 assert config .algorithm == 'HS512'
161+ assert config .decode_algorithms == ['HS512' , 'HS256' ]
159162
160163 assert config .blacklist_enabled is True
161164 assert config .blacklist_checks == ('refresh' ,)
@@ -396,3 +399,11 @@ def test_depreciated_options(app):
396399 assert len (w ) == 2
397400 assert w [0 ].category == DeprecationWarning
398401 assert w [1 ].category == DeprecationWarning
402+
403+
404+ def test_missing_algorithm_in_decode_algorithms (app ):
405+ app .config ['JWT_ALGORITHM' ] = 'RS256'
406+ app .config ['JWT_DECODE_ALGORITHMS' ] = ['HS512' ]
407+
408+ with app .test_request_context ():
409+ assert config .decode_algorithms == ['HS512' , 'RS256' ]
0 commit comments