File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -546,4 +546,34 @@ public function testAdditionalHeaderOverrides()
546
546
$ this ->assertEquals ('my_key_id ' , $ headers ->kid , 'key param not overridden ' );
547
547
$ this ->assertEquals ('HS256 ' , $ headers ->alg , 'alg param not overridden ' );
548
548
}
549
+
550
+ public function testDecodeExpectsIntegerIat ()
551
+ {
552
+ $ this ->expectException (UnexpectedValueException::class);
553
+ $ this ->expectExceptionMessage ('Payload iat must be a number ' );
554
+ JWT ::decode (
555
+ 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMzM3IiwibmFtZSI6IkpvaG4gU25vdyIsImlhdCI6InRlc3QifQ.B8cbURVQAPay3-Ep0DAm1Ji2rhij-hxfNA5PIDarf5o ' ,
556
+ new Key ('secret ' , 'HS256 ' )
557
+ );
558
+ }
559
+
560
+ public function testDecodeExpectsIntegerNbf ()
561
+ {
562
+ $ this ->expectException (UnexpectedValueException::class);
563
+ $ this ->expectExceptionMessage ('Payload nbf must be a number ' );
564
+ JWT ::decode (
565
+ 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMzM3IiwibmFtZSI6IkpvaG4gU25vdyIsIm5iZiI6InRlc3QifQ.9KdFz3ktQoPO5QFG3E7J86PEuw5Vmx0VPrUKszP7DDs ' ,
566
+ new Key ('secret ' , 'HS256 ' )
567
+ );
568
+ }
569
+
570
+ public function testDecodeExpectsIntegerExp ()
571
+ {
572
+ $ this ->expectException (UnexpectedValueException::class);
573
+ $ this ->expectExceptionMessage ('Payload exp must be a number ' );
574
+ JWT ::decode (
575
+ 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMzM3IiwibmFtZSI6IkpvaG4gU25vdyIsImV4cCI6InRlc3QifQ.LXevvGvchI3PTBZo9jZ5-4d0OvONVU-_8Tbg_22-PTo ' ,
576
+ new Key ('secret ' , 'HS256 ' )
577
+ );
578
+ }
549
579
}
You can’t perform that action at this time.
0 commit comments