From 40c6d2b1f345b04ba793a4a095870ae7ba4886d7 Mon Sep 17 00:00:00 2001 From: anhefti Date: Thu, 24 Aug 2023 13:01:46 +0200 Subject: [PATCH] SEBSERV-405 boot 2.6.15 mybatis 3.5.6 (old) --- pom.xml | 11 ++++------- .../java/ch/ethz/seb/sebserver/WebSecurityConfig.java | 4 ---- .../seb/sebserver/webservice/WebserviceConfig.java | 9 +++++++++ .../webservice/weblayer/WebServiceSecurityConfig.java | 9 --------- 4 files changed, 13 insertions(+), 20 deletions(-) diff --git a/pom.xml b/pom.xml index 8f39405b..88b02d79 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ org.springframework.boot spring-boot-starter-parent - 2.3.7.RELEASE + 2.6.15 jar @@ -23,9 +23,6 @@ ${sebserver-version} UTF-8 UTF-8 - - - 2.17.0 @@ -34,12 +31,12 @@ to support the Jenkins build on CI-Server that still no Java 11 installed --> - Java 11 + Java 17 true - 11 + 17 ${project.artifactId}-${build-version} @@ -248,7 +245,7 @@ com.github.pagehelper pagehelper-spring-boot-starter - 1.2.10 + 1.4.6 diff --git a/src/main/java/ch/ethz/seb/sebserver/WebSecurityConfig.java b/src/main/java/ch/ethz/seb/sebserver/WebSecurityConfig.java index c2b5d8f4..d627365a 100644 --- a/src/main/java/ch/ethz/seb/sebserver/WebSecurityConfig.java +++ b/src/main/java/ch/ethz/seb/sebserver/WebSecurityConfig.java @@ -100,8 +100,4 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter implements E response.flushBuffer(); } - @Override - public String getErrorPath() { - return ERROR_PATH; - } } diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/WebserviceConfig.java b/src/main/java/ch/ethz/seb/sebserver/webservice/WebserviceConfig.java index 7055077c..6a17b4ef 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/WebserviceConfig.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/WebserviceConfig.java @@ -8,14 +8,18 @@ package ch.ethz.seb.sebserver.webservice; +import javax.sql.DataSource; + import org.cryptonode.jncryptor.AES256JNCryptor; import org.cryptonode.jncryptor.JNCryptor; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Lazy; +import org.springframework.security.oauth2.provider.token.TokenStore; import ch.ethz.seb.sebserver.gbl.Constants; import ch.ethz.seb.sebserver.gbl.profile.WebServiceProfile; +import ch.ethz.seb.sebserver.webservice.weblayer.oauth.CachableJdbcTokenStore; @Configuration @WebServiceProfile @@ -29,6 +33,11 @@ public class WebserviceConfig { return aes256jnCryptor; } + @Bean + public TokenStore tokenStore(final DataSource dataSource) { + return new CachableJdbcTokenStore(dataSource); + } + // @Bean // public WebServerFactoryCustomizer tomcatCustomizer() { // return (tomcat) -> tomcat.addConnectorCustomizers((connector) -> { diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/WebServiceSecurityConfig.java b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/WebServiceSecurityConfig.java index 4048e476..826cbfa7 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/WebServiceSecurityConfig.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/WebServiceSecurityConfig.java @@ -12,7 +12,6 @@ import java.io.IOException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import javax.sql.DataSource; import org.apache.catalina.filters.RemoteIpFilter; import org.slf4j.Logger; @@ -24,7 +23,6 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; -import org.springframework.context.annotation.Lazy; import org.springframework.core.annotation.Order; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; @@ -47,7 +45,6 @@ import org.springframework.security.web.AuthenticationEntryPoint; import ch.ethz.seb.sebserver.WebSecurityConfig; import ch.ethz.seb.sebserver.gbl.model.user.UserRole; import ch.ethz.seb.sebserver.gbl.profile.WebServiceProfile; -import ch.ethz.seb.sebserver.webservice.weblayer.oauth.CachableJdbcTokenStore; import ch.ethz.seb.sebserver.webservice.weblayer.oauth.PreAuthProvider; import ch.ethz.seb.sebserver.webservice.weblayer.oauth.WebClientDetailsService; import ch.ethz.seb.sebserver.webservice.weblayer.oauth.WebserviceResourceConfiguration; @@ -107,12 +104,6 @@ public class WebServiceSecurityConfig extends WebSecurityConfigurerAdapter { @Value("${sebserver.webservice.api.exam.accessTokenValiditySeconds:43200}") private Integer examAccessTokenValSec; - @Lazy - @Bean - public TokenStore tokenStore(final DataSource dataSource) { - return new CachableJdbcTokenStore(dataSource); - } - /** Used to get real remote IP address by using "X-Forwarded-For" and "X-Forwarded-Proto" header. * https://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/filters/RemoteIpFilter.html *