Просмотр исходного кода

Update :reactive:webflux:java:oauth2:resource-server to 7

Josh Cummings 1 месяц назад
Родитель
Сommit
c8ef6135f2

+ 1 - 1
.idea/kotlinc.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
   <component name="KotlinJpsPluginSettings">
-    <option name="version" value="1.6.0" />
+    <option name="version" value="2.0.0" />
   </component>
 </project>

+ 1 - 1
reactive/webflux/java/oauth2/resource-server/gradle.properties

@@ -1,4 +1,4 @@
 version=6.1.1
-spring-security.version=6.5.0-SNAPSHOT
+spring-security.version=7.0.0-SNAPSHOT
 org.gradle.jvmargs=-Xmx6g -XX:+HeapDumpOnOutOfMemoryError
 org.gradle.caching=true

+ 16 - 2
reactive/webflux/java/oauth2/resource-server/src/test/java/example/OAuth2ResourceServerControllerTests.java

@@ -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;
+		}
+
+	}
+
 }