fixes
This commit is contained in:
parent
565e048df9
commit
ddf18579a9
3 changed files with 16 additions and 10 deletions
|
@ -11,8 +11,6 @@ package ch.ethz.seb.sebserver.webservice;
|
|||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.cryptonode.jncryptor.AES256JNCryptor;
|
||||
import org.cryptonode.jncryptor.JNCryptor;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -26,11 +24,9 @@ import org.springframework.context.annotation.Configuration;
|
|||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.core.env.Environment;
|
||||
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;
|
||||
|
||||
// TODO check if DataSourceAutoConfiguration and TokenStore bean definition is really needed here
|
||||
// or if it is possible to move them to the WebServiceSecurityConfig.
|
||||
|
@ -70,12 +66,6 @@ public class WebServiceInit implements ApplicationListener<ApplicationReadyEvent
|
|||
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Bean
|
||||
public TokenStore tokenStore(final DataSource dataSource) {
|
||||
return new CachableJdbcTokenStore(dataSource);
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@Bean
|
||||
public JNCryptor jnCryptor() {
|
||||
|
|
|
@ -22,6 +22,8 @@ import org.joda.time.DateTime;
|
|||
import org.joda.time.DateTimeZone;
|
||||
import org.mybatis.dynamic.sql.SqlBuilder;
|
||||
import org.mybatis.spring.SqlSessionTemplate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -60,6 +62,8 @@ import ch.ethz.seb.sebserver.webservice.servicelayer.dao.ResourceNotFoundExcepti
|
|||
* intensive write operation on Configuration domain. */
|
||||
class ConfigurationDAOBatchService {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ConfigurationDAOBatchService.class);
|
||||
|
||||
private final ConfigurationNodeRecordMapper batchConfigurationNodeRecordMapper;
|
||||
private final ConfigurationValueRecordMapper batchConfigurationValueRecordMapper;
|
||||
private final ConfigurationAttributeRecordMapper batchConfigurationAttributeRecordMapper;
|
||||
|
@ -70,6 +74,9 @@ class ConfigurationDAOBatchService {
|
|||
protected ConfigurationDAOBatchService(
|
||||
@Qualifier(BatisConfig.SQL_BATCH_SESSION_TEMPLATE) final SqlSessionTemplate batchSqlSessionTemplate) {
|
||||
|
||||
log.info("Registered MyBatis Mappers: {}",
|
||||
batchSqlSessionTemplate.getConfiguration().getMapperRegistry().getMappers());
|
||||
|
||||
this.batchConfigurationNodeRecordMapper =
|
||||
batchSqlSessionTemplate.getMapper(ConfigurationNodeRecordMapper.class);
|
||||
this.batchConfigurationValueRecordMapper =
|
||||
|
|
|
@ -13,6 +13,7 @@ import java.io.IOException;
|
|||
import javax.servlet.ServletException;
|
||||
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,6 +25,7 @@ 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;
|
||||
|
@ -46,6 +48,7 @@ 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.WebClientDetailsService;
|
||||
import ch.ethz.seb.sebserver.webservice.weblayer.oauth.WebserviceResourceConfiguration;
|
||||
|
||||
|
@ -102,6 +105,12 @@ public class WebServiceSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||
@Value("${sebserver.webservice.api.exam.accessTokenValiditySeconds:3600}")
|
||||
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
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue