diff --git a/pom.xml b/pom.xml index a9e30b625..bfa75560b 100644 --- a/pom.xml +++ b/pom.xml @@ -290,7 +290,7 @@ 6.46.1 - org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_4 + org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_5 @@ -354,7 +354,7 @@ org.springframework.boot spring-boot-starter-parent - 3.4.13 + 3.5.16 diff --git a/src/main/java/org/wise/portal/spring/impl/RedisConfig.java b/src/main/java/org/wise/portal/spring/impl/RedisConfig.java index a4e89e727..bc4d245b5 100644 --- a/src/main/java/org/wise/portal/spring/impl/RedisConfig.java +++ b/src/main/java/org/wise/portal/spring/impl/RedisConfig.java @@ -23,13 +23,13 @@ @EnableRedisIndexedHttpSession public class RedisConfig { - @Value("${spring.redis.host}") + @Value("${spring.data.redis.host}") private String redisHostName; - @Value("${spring.redis.port}") + @Value("${spring.data.redis.port}") private int redisPort; - @Value("${spring.redis.password:#{null}}") + @Value("${spring.data.redis.password:#{null}}") private String redisPassword; @Value("${spring.redis.pool.max.total}") diff --git a/src/main/java/org/wise/portal/spring/impl/WebSecurityConfig.java b/src/main/java/org/wise/portal/spring/impl/WebSecurityConfig.java index e234e283e..b7e018a0b 100644 --- a/src/main/java/org/wise/portal/spring/impl/WebSecurityConfig.java +++ b/src/main/java/org/wise/portal/spring/impl/WebSecurityConfig.java @@ -55,7 +55,7 @@ import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler; import org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter; import org.springframework.security.web.session.HttpSessionEventPublisher; -import org.springframework.security.web.util.matcher.AntPathRequestMatcher; +import org.springframework.security.web.servlet.util.matcher.PathPatternRequestMatcher; import org.springframework.session.Session; import org.wise.portal.presentation.web.filters.LoginRedirectUrlParameterFilter; import org.wise.portal.presentation.web.filters.MicrosoftAuthenticationFailureHandler; @@ -182,7 +182,7 @@ public SecurityFilterChain filterChain(HttpSecurity http, .successHandler(oauth2AuthenticationSuccessHandler()) .failureHandler(oauth2AuthenticationFailureHandler())) .logout(logout -> logout.addLogoutHandler(wiseLogoutHandler()) - .logoutRequestMatcher(new AntPathRequestMatcher("/api/logout")) + .logoutRequestMatcher(PathPatternRequestMatcher.withDefaults().matcher("/api/logout")) .logoutSuccessHandler((request, response, authentication) -> response .setStatus(HttpServletResponse.SC_OK))) .headers(headers -> headers.frameOptions(frame -> frame.sameOrigin())); diff --git a/src/main/resources/application-dockerdev-sample.properties b/src/main/resources/application-dockerdev-sample.properties index 61b18cc74..44eec952f 100644 --- a/src/main/resources/application-dockerdev-sample.properties +++ b/src/main/resources/application-dockerdev-sample.properties @@ -92,7 +92,7 @@ spring.jpa.properties.hibernate.bytecode.use_reflection_optimizer=true spring.session.store-type=redis spring.data.redis.host=wise-redis -#spring.redis.password= # Login password of the redis server. +#spring.data.redis.password= # Login password of the redis server. spring.data.redis.port=6379 spring.redis.pool.max.total=128 #spring.session.redis.flush-mode=on-save # Sessions flush mode. diff --git a/src/main/resources/application_sample.properties b/src/main/resources/application_sample.properties index 82ba99567..c61f25dbd 100644 --- a/src/main/resources/application_sample.properties +++ b/src/main/resources/application_sample.properties @@ -90,7 +90,7 @@ spring.jpa.properties.hibernate.bytecode.use_reflection_optimizer=true spring.session.store-type=redis spring.data.redis.host=localhost -#spring.redis.password= # Login password of the redis server. +#spring.data.redis.password= # Login password of the redis server. spring.data.redis.port=6379 spring.redis.pool.max.total=128 #spring.session.redis.flush-mode=on-save # Sessions flush mode. diff --git a/src/test/java/org/wise/portal/junit/AbstractTransactionalDbTests.java b/src/test/java/org/wise/portal/junit/AbstractTransactionalDbTests.java index 327b439c4..dc3da6d28 100644 --- a/src/test/java/org/wise/portal/junit/AbstractTransactionalDbTests.java +++ b/src/test/java/org/wise/portal/junit/AbstractTransactionalDbTests.java @@ -111,8 +111,8 @@ public abstract class AbstractTransactionalDbTests static void redisProperties(DynamicPropertyRegistry registry) { String redisHost = redisContainer.getHost(); Integer redisPort = redisContainer.getFirstMappedPort(); - registry.add("spring.redis.host", () -> redisHost); - registry.add("spring.redis.port", () -> redisPort); + registry.add("spring.data.redis.host", () -> redisHost); + registry.add("spring.data.redis.port", () -> redisPort); } public void setUp() throws Exception { diff --git a/src/test/java/org/wise/portal/presentation/web/controllers/survey/SurveyAPIControllerTest.java b/src/test/java/org/wise/portal/presentation/web/controllers/survey/SurveyAPIControllerTest.java index 705962b5e..a19a6924b 100644 --- a/src/test/java/org/wise/portal/presentation/web/controllers/survey/SurveyAPIControllerTest.java +++ b/src/test/java/org/wise/portal/presentation/web/controllers/survey/SurveyAPIControllerTest.java @@ -7,7 +7,6 @@ import static org.easymock.EasyMock.newCapture; import static org.easymock.EasyMock.replay; import static org.easymock.EasyMock.verify; -import static org.junit.jupiter.api.Assertions.assertNull; import java.util.ArrayList; import java.util.Date; @@ -24,6 +23,7 @@ import org.easymock.EasyMockExtension; import org.easymock.Mock; import org.easymock.TestSubject; +import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -216,4 +216,9 @@ public void launchSurveyRun_NoIssues_RedirectUnit() throws Exception { surveyAPIController.launchSurveyRun("dog1234-1", httpServletResponse, httpServletRequest); verify(httpServletResponse, runService, userService, workgroupService, studentService); } + + @AfterEach + public void tearDown() { + SecurityContextHolder.clearContext(); + } } diff --git a/src/test/java/org/wise/portal/service/impl/AclServiceImplTest.java b/src/test/java/org/wise/portal/service/impl/AclServiceImplTest.java index 565e11ac2..77b6d9344 100644 --- a/src/test/java/org/wise/portal/service/impl/AclServiceImplTest.java +++ b/src/test/java/org/wise/portal/service/impl/AclServiceImplTest.java @@ -88,6 +88,7 @@ public void setUp() { @AfterEach public void tearDown() { + SecurityContextHolder.clearContext(); groupAclService = null; mutableAclService = null; authority = null; diff --git a/src/test/java/org/wise/portal/spring/impl/WebSecurityConfigAuthorizationTest.java b/src/test/java/org/wise/portal/spring/impl/WebSecurityConfigAuthorizationTest.java index a73c5391a..b915bbf20 100644 --- a/src/test/java/org/wise/portal/spring/impl/WebSecurityConfigAuthorizationTest.java +++ b/src/test/java/org/wise/portal/spring/impl/WebSecurityConfigAuthorizationTest.java @@ -80,8 +80,8 @@ public class WebSecurityConfigAuthorizationTest { @DynamicPropertySource static void redisProperties(DynamicPropertyRegistry registry) { - registry.add("spring.redis.host", redisContainer::getHost); - registry.add("spring.redis.port", redisContainer::getFirstMappedPort); + registry.add("spring.data.redis.host", redisContainer::getHost); + registry.add("spring.data.redis.port", redisContainer::getFirstMappedPort); } @Autowired diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties index 312235e7f..1db2eaef0 100644 --- a/src/test/resources/application.properties +++ b/src/test/resources/application.properties @@ -89,7 +89,7 @@ spring.jpa.hibernate.ddl-auto=create-drop spring.session.store-type=redis spring.data.redis.host=localhost -#spring.redis.password= # Login password of the redis server. +#spring.data.redis.password= # Login password of the redis server. spring.data.redis.port=6379 spring.redis.pool.max.total=128 #spring.session.redis.flush-mode=on-save # Sessions flush mode.