@@ -210,6 +210,41 @@ public void loadContextWhenIssuerNotValidUriThenThrowException() {
210
210
);
211
211
}
212
212
213
+ @ Test
214
+ public void loadContextWhenIssuerWithQueryThenThrowException () {
215
+ assertThatThrownBy (
216
+ () -> this .spring .register (AuthorizationServerConfigurationWithInvalidQueryIssuerUrl .class ).autowire ()
217
+ );
218
+ }
219
+
220
+ @ Test
221
+ public void loadContextWhenIssuerWithFragmentThenThrowException () {
222
+ assertThatThrownBy (
223
+ () -> this .spring .register (AuthorizationServerConfigurationWithInvalidFragmentIssuerUrl .class ).autowire ()
224
+ );
225
+ }
226
+
227
+ @ Test
228
+ public void loadContextWhenIssuerWithQueryAndFragmentThenThrowException () {
229
+ assertThatThrownBy (
230
+ () -> this .spring .register (AuthorizationServerConfigurationWithInvalidQueryAndFragmentIssuerUrl .class ).autowire ()
231
+ );
232
+ }
233
+
234
+ @ Test
235
+ public void loadContextWhenIssuerEndWithQuestionMarkCharacterThenThrowException () {
236
+ assertThatThrownBy (
237
+ () -> this .spring .register (AuthorizationServerConfigurationWithInvalidIssuerUrlEndWithQuestionMarkCharacter .class ).autowire ()
238
+ );
239
+ }
240
+
241
+ @ Test
242
+ public void loadContextWhenIssuerEndWithNumberSignCharacterThenThrowException () {
243
+ assertThatThrownBy (
244
+ () -> this .spring .register (AuthorizationServerConfigurationWithInvalidIssuerUrlEndWithNumberSignCharacter .class ).autowire ()
245
+ );
246
+ }
247
+
213
248
@ Test
214
249
public void requestWhenAuthenticationRequestThenTokenResponseIncludesIdToken () throws Exception {
215
250
this .spring .register (AuthorizationServerConfiguration .class ).autowire ();
@@ -459,4 +494,54 @@ ProviderSettings providerSettings() {
459
494
}
460
495
}
461
496
497
+ @ EnableWebSecurity
498
+ @ Import (OAuth2AuthorizationServerConfiguration .class )
499
+ static class AuthorizationServerConfigurationWithInvalidQueryIssuerUrl extends AuthorizationServerConfiguration {
500
+
501
+ @ Bean
502
+ ProviderSettings providerSettings () {
503
+ return ProviderSettings .builder ().issuer ("https://localhost:9000?something=any" ).build ();
504
+ }
505
+ }
506
+
507
+ @ EnableWebSecurity
508
+ @ Import (OAuth2AuthorizationServerConfiguration .class )
509
+ static class AuthorizationServerConfigurationWithInvalidFragmentIssuerUrl extends AuthorizationServerConfiguration {
510
+
511
+ @ Bean
512
+ ProviderSettings providerSettings () {
513
+ return ProviderSettings .builder ().issuer ("https://localhost:9000#fragment" ).build ();
514
+ }
515
+ }
516
+
517
+ @ EnableWebSecurity
518
+ @ Import (OAuth2AuthorizationServerConfiguration .class )
519
+ static class AuthorizationServerConfigurationWithInvalidQueryAndFragmentIssuerUrl extends AuthorizationServerConfiguration {
520
+
521
+ @ Bean
522
+ ProviderSettings providerSettings () {
523
+ return ProviderSettings .builder ().issuer ("https://localhost:9000?something=any#fragment" ).build ();
524
+ }
525
+ }
526
+
527
+ @ EnableWebSecurity
528
+ @ Import (OAuth2AuthorizationServerConfiguration .class )
529
+ static class AuthorizationServerConfigurationWithInvalidIssuerUrlEndWithQuestionMarkCharacter extends AuthorizationServerConfiguration {
530
+
531
+ @ Bean
532
+ ProviderSettings providerSettings () {
533
+ return ProviderSettings .builder ().issuer ("https://localhost:9000?" ).build ();
534
+ }
535
+ }
536
+
537
+ @ EnableWebSecurity
538
+ @ Import (OAuth2AuthorizationServerConfiguration .class )
539
+ static class AuthorizationServerConfigurationWithInvalidIssuerUrlEndWithNumberSignCharacter extends AuthorizationServerConfiguration {
540
+
541
+ @ Bean
542
+ ProviderSettings providerSettings () {
543
+ return ProviderSettings .builder ().issuer ("https://localhost:9000/#" ).build ();
544
+ }
545
+ }
546
+
462
547
}
0 commit comments