File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
RSpec . describe ::JWT ::Verify do
4
4
let ( :base_payload ) { { 'user_id' => 'some@user.tld' } }
5
+ let ( :string_payload ) { 'beautyexperts_nbf_iat' }
5
6
let ( :options ) { { leeway : 0 } }
6
7
7
8
context '.verify_aud(payload, options)' do
64
65
end . to raise_error JWT ::ExpiredSignature
65
66
end
66
67
68
+ it 'must not consider string containing exp as expired' do
69
+ expect ( described_class . verify_expiration ( string_payload , options ) ) . to eq ( nil )
70
+ end
71
+
67
72
context 'when leeway is not specified' do
68
73
let ( :options ) { { } }
69
74
103
108
described_class . verify_iat ( payload . merge ( 'iat' => ( iat + 120 ) ) , options )
104
109
end . to raise_error JWT ::InvalidIatError
105
110
end
111
+
112
+ it 'must not validate if the payload is a string containing iat' do
113
+ expect ( described_class . verify_iat ( string_payload , options ) ) . to eq ( nil )
114
+ end
106
115
end
107
116
108
117
context '.verify_iss(payload, options)' do
@@ -265,6 +274,10 @@ def issuer_start_with_ruby?(issuer)
265
274
it 'must allow some leeway in the token age when nbf_leeway is configured' do
266
275
described_class . verify_not_before ( payload , options . merge ( nbf_leeway : 10 ) )
267
276
end
277
+
278
+ it 'must not validate if the payload is a string containing iat' do
279
+ expect ( described_class . verify_not_before ( string_payload , options ) ) . to eq ( nil )
280
+ end
268
281
end
269
282
270
283
context '.verify_sub(payload, options)' do
You can’t perform that action at this time.
0 commit comments