|
@@ -21,7 +21,8 @@ import reactor.core.publisher.Mono;
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest;
|
|
|
-import org.springframework.boot.test.mock.mockito.MockBean;
|
|
|
+import org.springframework.boot.test.context.TestConfiguration;
|
|
|
+import org.springframework.context.annotation.Bean;
|
|
|
import org.springframework.context.annotation.Import;
|
|
|
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
|
|
import org.springframework.security.oauth2.jwt.Jwt;
|
|
@@ -29,6 +30,7 @@ import org.springframework.security.oauth2.jwt.ReactiveJwtDecoder;
|
|
|
import org.springframework.test.web.reactive.server.WebTestClient;
|
|
|
|
|
|
import static org.mockito.ArgumentMatchers.anyString;
|
|
|
+import static org.mockito.Mockito.mock;
|
|
|
import static org.mockito.Mockito.when;
|
|
|
import static org.springframework.security.test.web.reactive.server.SecurityMockServerConfigurers.mockJwt;
|
|
|
|
|
@@ -42,7 +44,7 @@ public class OAuth2ResourceServerControllerTests {
|
|
|
@Autowired
|
|
|
WebTestClient rest;
|
|
|
|
|
|
- @MockBean
|
|
|
+ @Autowired
|
|
|
ReactiveJwtDecoder jwtDecoder;
|
|
|
|
|
|
@Test
|
|
@@ -131,4 +133,16 @@ public class OAuth2ResourceServerControllerTests {
|
|
|
return Jwt.withTokenValue("token").header("alg", "none");
|
|
|
}
|
|
|
|
|
|
+ @TestConfiguration
|
|
|
+ static class JwtDecoderConfig {
|
|
|
+
|
|
|
+ private ReactiveJwtDecoder jwtDecoder = mock(ReactiveJwtDecoder.class);
|
|
|
+
|
|
|
+ @Bean
|
|
|
+ ReactiveJwtDecoder jwtDecoder() {
|
|
|
+ return this.jwtDecoder;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|