@@ -171,4 +171,36 @@ public function testSetDefaultsUnsetsAuthSourceIfNotValid(): void
171171
172172 $ this ->assertNull ($ sut ->getValues ()['auth_source ' ]);
173173 }
174+
175+ public static function redirectUriProvider (): array
176+ {
177+ return [
178+ ['https ' , false ],
179+ ['https: ' , false ],
180+ ['example ' , false ],
181+ ['example.com ' , false ],
182+ ['example.com/?foo=bar ' , false ],
183+ ['www.example.com/?foo=bar ' , false ],
184+ ['https://example ' , true ],
185+ ['https://example.com ' , true ],
186+ ['https://example.com/ ' , true ],
187+ ['https://example.com/foo ' , true ],
188+ ['https://example.com/foo?bar=1 ' , true ],
189+
190+ // To support OID4VCI
191+ ['openid-credential-offer:// ' , true ],
192+ ['foo:// ' , true ],
193+ ['https:// ' , true ],
194+ ];
195+ }
196+
197+ #[DataProvider('redirectUriProvider ' )]
198+ public function testCanValidateRedirectUri (string $ url , bool $ isValid ): void
199+ {
200+ $ sut = $ this ->sut ();
201+ $ sut ->setValues (['redirect_uri ' => $ url ]);
202+ $ sut ->validateRedirectUri ($ sut );
203+
204+ $ this ->assertEquals (!$ isValid , $ sut ->hasErrors (), $ url );
205+ }
174206}
0 commit comments