Skip to content

Commit 4fd0375

Browse files
committed
Adapt tests to addition of new JWT validator in Spring Security
See gh-40230
1 parent b1d8a61 commit 4fd0375

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/reactive/ReactiveOAuth2ResourceServerAutoConfigurationTests.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
import org.springframework.security.oauth2.jwt.Jwt;
6969
import org.springframework.security.oauth2.jwt.JwtClaimValidator;
7070
import org.springframework.security.oauth2.jwt.JwtIssuerValidator;
71-
import org.springframework.security.oauth2.jwt.JwtTimestampValidator;
7271
import org.springframework.security.oauth2.jwt.NimbusReactiveJwtDecoder;
7372
import org.springframework.security.oauth2.jwt.ReactiveJwtDecoder;
7473
import org.springframework.security.oauth2.jwt.SupplierReactiveJwtDecoder;
@@ -483,8 +482,8 @@ void autoConfigurationShouldNotConfigureIssuerUriAndAudienceJwtValidatorIfProper
483482
.run((context) -> {
484483
assertThat(context).hasSingleBean(ReactiveJwtDecoder.class);
485484
ReactiveJwtDecoder reactiveJwtDecoder = context.getBean(ReactiveJwtDecoder.class);
486-
validate(jwt(), reactiveJwtDecoder, (validators) -> assertThat(validators).singleElement()
487-
.isInstanceOf(JwtTimestampValidator.class));
485+
validate(jwt(), reactiveJwtDecoder,
486+
(validators) -> assertThat(validators).hasSize(2).noneSatisfy(audClaimValidator()));
488487
});
489488
}
490489

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/OAuth2ResourceServerAutoConfigurationTests.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
import org.springframework.security.oauth2.jwt.JwtClaimValidator;
6666
import org.springframework.security.oauth2.jwt.JwtDecoder;
6767
import org.springframework.security.oauth2.jwt.JwtIssuerValidator;
68-
import org.springframework.security.oauth2.jwt.JwtTimestampValidator;
6968
import org.springframework.security.oauth2.jwt.NimbusJwtDecoder;
7069
import org.springframework.security.oauth2.jwt.SupplierJwtDecoder;
7170
import org.springframework.security.oauth2.server.resource.authentication.BearerTokenAuthenticationToken;
@@ -501,8 +500,8 @@ void autoConfigurationShouldNotConfigureIssuerUriAndAudienceJwtValidatorIfProper
501500
.run((context) -> {
502501
assertThat(context).hasSingleBean(JwtDecoder.class);
503502
JwtDecoder jwtDecoder = context.getBean(JwtDecoder.class);
504-
validate(jwt(), jwtDecoder, (validators) -> assertThat(validators).singleElement()
505-
.isInstanceOf(JwtTimestampValidator.class));
503+
validate(jwt(), jwtDecoder,
504+
(validators) -> assertThat(validators).hasSize(2).noneSatisfy(audClaimValidator()));
506505
});
507506
}
508507

0 commit comments

Comments
 (0)