File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -233,4 +233,31 @@ public function testGetEmail() {
233233 );
234234 self ::assertEquals ($ expectedEmail , $ sut ->getEmail ());
235235 }
236+
237+ // When the remote provider redirects back to the client application, a query
238+ // string parameter "authwave" is provided, with encrypted user and config data.
239+ // In this example, we make our own query string parameter, which will NOT
240+ // decrypt properly, and should throw an exception to prevent unauthorised
241+ // access.
242+ public function testAuthInProgressMalformedUri () {
243+ $ currentUri = "/?authwave=0123456789abcdef " ;
244+ $ expectedRedirectUri = "http://localhost:8080/my-configured-redirect-uri " ;
245+
246+ $ redirectHandler = self ::createMock (RedirectHandler::class);
247+ $ redirectHandler ->expects (self ::once ())
248+ ->method ("redirect " )
249+ ->with (self ::callback (fn (UriInterface $ uri ) =>
250+ (string )$ uri === $ expectedRedirectUri
251+ ));
252+
253+ self ::expectException (MalformedReponseDataException::class);
254+ new Authenticator (
255+ "test-key " ,
256+ "test-secret " ,
257+ $ currentUri ,
258+ AuthUri::DEFAULT_BASE_URI ,
259+ null ,
260+ $ redirectHandler
261+ );
262+ }
236263}
You can’t perform that action at this time.
0 commit comments