@@ -526,3 +526,41 @@ describe("when a request_decorator has been specified when calling the token end
526
526
end )
527
527
end )
528
528
529
+ describe (" when introspection endpoint hasn't been specified" , function ()
530
+ test_support .start_server ({
531
+ remove_introspection_config_keys = { ' introspection_endpoint' }
532
+ })
533
+ teardown (test_support .stop_server )
534
+ local jwt = test_support .trim (http .request (" http://127.0.0.1/jwt" ))
535
+ local _ , status = http .request ({
536
+ url = " http://127.0.0.1/introspect" ,
537
+ headers = { authorization = " Bearer " .. jwt }
538
+ })
539
+ it (" the response is invalid" , function ()
540
+ assert .are .equals (401 , status )
541
+ end )
542
+ it (" an error has been logged" , function ()
543
+ assert .error_log_contains (" Introspection error: no endpoint URI for introspection" )
544
+ end )
545
+ end )
546
+
547
+ describe (" when introspection endpoint hasn't been specified but discovery doc provides introspection_endpoint claim" , function ()
548
+ test_support .start_server ({
549
+ remove_introspection_config_keys = { ' introspection_endpoint' },
550
+ introspection_opts = {
551
+ discovery = {
552
+ introspection_endpoint = " http://127.0.0.1/introspection"
553
+ }
554
+ },
555
+ })
556
+ teardown (test_support .stop_server )
557
+ local jwt = test_support .trim (http .request (" http://127.0.0.1/jwt" ))
558
+ local _ , status = http .request ({
559
+ url = " http://127.0.0.1/introspect" ,
560
+ headers = { authorization = " Bearer " .. jwt }
561
+ })
562
+ it (" the response is valid" , function ()
563
+ assert .are .equals (200 , status )
564
+ end )
565
+ end )
566
+
0 commit comments