Fixed property bean setup

This commit is contained in:
Kai Zimmermann
2016-02-25 20:36:17 +01:00
parent 3eaab83014
commit 7692a29918
9 changed files with 18 additions and 25 deletions

View File

@@ -9,13 +9,11 @@
package org.eclipse.hawkbit.autoconfigure.scheduling;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* Properties for the async configurer.
*
*/
@Component
@ConfigurationProperties("hawkbit.threadpool")
public class AsyncConfigurerThreadpoolProperties {

View File

@@ -115,7 +115,7 @@ public class SecurityManagedConfiguration {
@Autowired
private TenantAware tenantAware;
@Autowired
private DdiSecurityProperties securityConfiguration;
private DdiSecurityProperties ddiSecurityConfiguration;
@Autowired
private org.springframework.boot.autoconfigure.security.SecurityProperties springSecurityProperties;
@@ -124,7 +124,7 @@ public class SecurityManagedConfiguration {
final ControllerTenantAwareAuthenticationDetailsSource authenticationDetailsSource = new ControllerTenantAwareAuthenticationDetailsSource();
final HttpControllerPreAuthenticatedSecurityHeaderFilter securityHeaderFilter = new HttpControllerPreAuthenticatedSecurityHeaderFilter(
securityConfiguration.getRp().getCnHeader(), securityConfiguration.getRp().getSslIssuerHashHeader(),
ddiSecurityConfiguration.getRp().getCnHeader(), ddiSecurityConfiguration.getRp().getSslIssuerHashHeader(),
systemManagement, tenantAware);
securityHeaderFilter.setAuthenticationManager(authenticationManager());
securityHeaderFilter.setCheckForPrincipalChanges(true);
@@ -150,7 +150,7 @@ public class SecurityManagedConfiguration {
httpSec = httpSec.requiresChannel().anyRequest().requiresSecure().and();
}
if (securityConfiguration.getAuthentication().getAnonymous().isEnabled()) {
if (ddiSecurityConfiguration.getAuthentication().getAnonymous().isEnabled()) {
LOG.info(
"******************\n** Anonymous controller security enabled, should only use for developing purposes **\n******************");
final AnonymousAuthenticationFilter anoymousFilter = new AnonymousAuthenticationFilter(
@@ -181,7 +181,7 @@ public class SecurityManagedConfiguration {
@Override
protected void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.authenticationProvider(
new PreAuthTokenSourceTrustAuthenticationProvider(securityConfiguration.getRp().getTrustedIPs()));
new PreAuthTokenSourceTrustAuthenticationProvider(ddiSecurityConfiguration.getRp().getTrustedIPs()));
}
}
@@ -444,7 +444,7 @@ public class SecurityManagedConfiguration {
public static class IdRestSecurityConfigurationAdapter extends WebSecurityConfigurerAdapter {
@Autowired
private DdiSecurityProperties securityConfiguration;
private DdiSecurityProperties ddiSecurityConfiguration;
@Autowired
@Qualifier(CacheConstants.DOWNLOAD_ID_CACHE)
@@ -467,7 +467,7 @@ public class SecurityManagedConfiguration {
@Override
protected void configure(final AuthenticationManagerBuilder auth) throws Exception {
auth.authenticationProvider(
new PreAuthTokenSourceTrustAuthenticationProvider(securityConfiguration.getRp().getTrustedIPs()));
new PreAuthTokenSourceTrustAuthenticationProvider(ddiSecurityConfiguration.getRp().getTrustedIPs()));
}
}

View File

@@ -11,5 +11,4 @@ org.eclipse.hawkbit.autoconfigure.eventbus.EventBusAutoConfiguration,\
org.eclipse.hawkbit.autoconfigure.scheduling.AsyncConfigurerAutoConfiguration,\
org.eclipse.hawkbit.autoconfigure.cache.RedisAutoConfiguration,\
org.eclipse.hawkbit.autoconfigure.scheduling.ExecutorAutoConfiguration,\
org.eclipse.hawkbit.autoconfigure.conf.ControllerPollAutoConfiguration,\
org.eclipse.hawkbit.autoconfigure.amqp.AmqpAutoConfiguration

View File

@@ -29,11 +29,10 @@ flyway.initOnMigrate=true
flyway.sqlMigrationSuffix=${spring.jpa.database}.sql
# Vaadin Servlet
vaadin.static.servlet.productionMode=true
vaadin.servlet.productionMode=true
vaadin.servlet.urlMapping=/UI/*
vaadin.servlet.params.heartbeatInterval=60
vaadin.servlet.params.closeIdleSessions=false
vaadin.servlet.heartbeatInterval=60
vaadin.servlet.closeIdleSessions=false
# Spring MVC
spring.mvc.favicon.enabled=false

View File

@@ -9,13 +9,11 @@
package org.eclipse.hawkbit;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* Properties for the server e.g. the server's URL which must be configured.
*
*/
@Component
@ConfigurationProperties("hawkbit.server")
public class HawkbitServerProperties {
/**
@@ -31,7 +29,7 @@ public class HawkbitServerProperties {
}
/**
* Build information of the hawkBit instance. Influeneced by maven.
* Build information of the hawkBit instance. Influenced by maven.
*
*/
public static class Build {

View File

@@ -55,7 +55,7 @@ public class AmqpControllerAuthentfication {
private TenantAware tenantAware;
@Autowired
private DdiSecurityProperties secruityProperties;
private DdiSecurityProperties ddiSecruityProperties;
/**
* Constructor.
@@ -78,7 +78,7 @@ public class AmqpControllerAuthentfication {
filterChain.add(gatewaySecurityTokenFilter);
final ControllerPreAuthenticatedSecurityHeaderFilter securityHeaderFilter = new ControllerPreAuthenticatedSecurityHeaderFilter(
secruityProperties.getRp().getCnHeader(), secruityProperties.getRp().getSslIssuerHashHeader(),
ddiSecruityProperties.getRp().getCnHeader(), ddiSecruityProperties.getRp().getSslIssuerHashHeader(),
systemManagement, tenantAware);
filterChain.add(securityHeaderFilter);
@@ -138,7 +138,7 @@ public class AmqpControllerAuthentfication {
}
public void setSecruityProperties(final DdiSecurityProperties secruityProperties) {
this.secruityProperties = secruityProperties;
this.ddiSecruityProperties = secruityProperties;
}
public void setSystemManagement(final SystemManagement systemManagement) {

View File

@@ -50,7 +50,7 @@ public class PropertyBasedArtifactUrlHandlerTest extends AbstractIntegrationTest
}
@Test
@Description("Tests generate the http download url")
@Description("Tests the generation of http download url.")
public void testHttpUrl() {
final String url = urlHandlerProperties.getUrl(controllerId, localArtifact, Artifact.UrlProtocol.HTTP);
assertEquals("http://localhost/" + tenantAware.getCurrentTenant() + "/controller/v1/" + controllerId
@@ -59,7 +59,7 @@ public class PropertyBasedArtifactUrlHandlerTest extends AbstractIntegrationTest
}
@Test
@Description("Tests generate the https download url")
@Description("Tests the generation of https download url.")
public void testHttpsUrl() {
final String url = urlHandlerProperties.getUrl(controllerId, localArtifact, Artifact.UrlProtocol.HTTPS);
assertEquals("https://localhost/" + tenantAware.getCurrentTenant() + "/controller/v1/" + controllerId
@@ -68,7 +68,7 @@ public class PropertyBasedArtifactUrlHandlerTest extends AbstractIntegrationTest
}
@Test
@Description("Tests generate the coap download url")
@Description("Tests the generation of coap download url.")
public void testCoapUrl() {
final String url = urlHandlerProperties.getUrl(controllerId, localArtifact, Artifact.UrlProtocol.COAP);

View File

@@ -17,11 +17,13 @@ import org.eclipse.hawkbit.cache.TenantAwareCacheManager;
import org.eclipse.hawkbit.repository.model.helper.EventBusHolder;
import org.eclipse.hawkbit.repository.utils.RepositoryDataGenerator;
import org.eclipse.hawkbit.repository.utils.RepositoryDataGenerator.DatabaseCleanupUtil;
import org.eclipse.hawkbit.security.DdiSecurityProperties;
import org.eclipse.hawkbit.security.SecurityContextTenantAware;
import org.eclipse.hawkbit.security.SpringSecurityAuditorAware;
import org.eclipse.hawkbit.tenancy.TenantAware;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
import org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cache.Cache;
import org.springframework.cache.guava.GuavaCacheManager;
import org.springframework.context.annotation.AdviceMode;
@@ -45,8 +47,7 @@ import com.mongodb.MongoClientOptions;
*/
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true, mode = AdviceMode.ASPECTJ, proxyTargetClass = true, securedEnabled = true)
// @EnableConfigurationProperties({ DdiSecurityProperties.class,
// ControllerPollProperties.class })
@EnableConfigurationProperties({ DdiSecurityProperties.class, ControllerPollProperties.class })
@Profile("test")
public class TestConfiguration implements AsyncConfigurer {

View File

@@ -11,12 +11,10 @@ package org.eclipse.hawkbit.security;
import java.util.List;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* The common properties for DDI security.
*/
@Component
@ConfigurationProperties("hawkbit.server.ddi.security")
public class DdiSecurityProperties {