File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ class BYUJWT
3030{
3131 protected $ client ;
3232 protected $ cache = [];
33+ protected $ wellKnownUrl ;
3334
3435 public $ lastException ;
3536
@@ -52,6 +53,11 @@ public function __construct($settings = [])
5253 } else {
5354 $ this ->client = $ settings ['client ' ];
5455 }
56+
57+ $ this ->wellKnownUrl = 'https://api.byu.edu/.well-known/openid-configuration ' ;
58+ if (!empty ($ settings ['wellKnownUrl ' ])) {
59+ $ this ->wellKnownUrl = $ settings ['wellKnownUrl ' ];
60+ }
5561 }
5662
5763 /**
@@ -67,8 +73,7 @@ public function getWellKnown()
6773 }
6874
6975 try {
70- $ wellKnownUrl = 'https://api.byu.edu/.well-known/openid-configuration ' ;
71- $ response = $ this ->client ->get ($ wellKnownUrl );
76+ $ response = $ this ->client ->get ($ this ->wellKnownUrl );
7277 } catch (RequestException $ e ) {
7378 $ this ->lastException = $ e ;
7479 return null ;
Original file line number Diff line number Diff line change @@ -105,6 +105,17 @@ public function testBadWellKnown()
105105 $ this ->assertEmpty ($ BYUJWT ->getWellKnown ());
106106 }
107107
108+ public function testBadWellKnownUrl ()
109+ {
110+ $ BYUJWT = new BYUJWT (['wellKnownUrl ' => 'badprotocol://fakeurl ' ]);
111+
112+ $ this ->assertEmpty ($ BYUJWT ->getWellKnown ());
113+ $ this ->assertInstanceOf (
114+ 'GuzzleHttp\Exception\RequestException ' ,
115+ $ BYUJWT ->lastException
116+ );
117+ }
118+
108119 public function testMissingJwks ()
109120 {
110121 $ client = $ this ->mockClient ([static ::$ openid ]);
You can’t perform that action at this time.
0 commit comments