Moved tenant configuration functions to new management class

- moved fucntions to TenantConfigurationManagement, for better function capseling
- updated references
- updated references in tests, tests were succesfully

Signed-off-by: Nonnenmacher Fabian <fabian.nonnenmacher@bosch-si.com>
This commit is contained in:
Fabian Nonnenmacher
2016-01-27 17:00:39 +01:00
committed by Nonnenmacher Fabian
parent b56477191a
commit 6cef6aed1a
29 changed files with 466 additions and 373 deletions

View File

@@ -18,7 +18,7 @@ import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import org.eclipse.hawkbit.dmf.json.model.TenantSecruityToken;
import org.eclipse.hawkbit.repository.SystemManagement;
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
import org.eclipse.hawkbit.tenancy.TenantAware;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -55,7 +55,7 @@ public abstract class AbstractHttpControllerAuthenticationFilter extends Abstrac
private static final String CONTROLLER_DL_REQUEST_ANT_PATTERN = "/{" + TENANT_PLACE_HOLDER
+ "}/controller/artifacts/v1/**";
protected SystemManagement systemManagement;
protected TenantConfigurationManagement tenantConfigurationManagement;
protected TenantAware tenantAware;
private final AntPathMatcher pathExtractor;
@@ -70,9 +70,9 @@ public abstract class AbstractHttpControllerAuthenticationFilter extends Abstrac
* @param tenantAware
* the tenant aware service
*/
public AbstractHttpControllerAuthenticationFilter(final SystemManagement systemManagement,
public AbstractHttpControllerAuthenticationFilter(final TenantConfigurationManagement tenantConfigurationManagement,
final TenantAware tenantAware) {
this.systemManagement = systemManagement;
this.tenantConfigurationManagement = tenantConfigurationManagement;
this.tenantAware = tenantAware;
pathExtractor = new AntPathMatcher();
}

View File

@@ -9,7 +9,7 @@
package org.eclipse.hawkbit.security;
import org.eclipse.hawkbit.repository.ControllerManagement;
import org.eclipse.hawkbit.repository.SystemManagement;
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
import org.eclipse.hawkbit.tenancy.TenantAware;
/**
@@ -45,15 +45,17 @@ public class HttpControllerPreAuthenticateSecurityTokenFilter extends AbstractHt
* the controller management to retrieve the specific target
* security token to verify
*/
public HttpControllerPreAuthenticateSecurityTokenFilter(final SystemManagement systemManagement,
final TenantAware tenantAware, final ControllerManagement controllerManagement) {
super(systemManagement, tenantAware);
public HttpControllerPreAuthenticateSecurityTokenFilter(
final TenantConfigurationManagement tenantConfigurationManagement, final TenantAware tenantAware,
final ControllerManagement controllerManagement) {
super(tenantConfigurationManagement, tenantAware);
this.controllerManagement = controllerManagement;
}
@Override
protected PreAuthenficationFilter createControllerAuthenticationFilter() {
return new ControllerPreAuthenticateSecurityTokenFilter(systemManagement, controllerManagement, tenantAware);
return new ControllerPreAuthenticateSecurityTokenFilter(tenantConfigurationManagement, controllerManagement,
tenantAware);
}
}

View File

@@ -8,7 +8,7 @@
*/
package org.eclipse.hawkbit.security;
import org.eclipse.hawkbit.repository.SystemManagement;
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
import org.eclipse.hawkbit.tenancy.TenantAware;
/**
@@ -34,14 +34,14 @@ public class HttpControllerPreAuthenticatedGatewaySecurityTokenFilter
* the tenant aware service to get configuration for the specific
* tenant
*/
public HttpControllerPreAuthenticatedGatewaySecurityTokenFilter(final SystemManagement systemManagement,
final TenantAware tenantAware) {
super(systemManagement, tenantAware);
public HttpControllerPreAuthenticatedGatewaySecurityTokenFilter(
final TenantConfigurationManagement tenantConfigurationManagement, final TenantAware tenantAware) {
super(tenantConfigurationManagement, tenantAware);
}
@Override
protected PreAuthenficationFilter createControllerAuthenticationFilter() {
return new ControllerPreAuthenticatedGatewaySecurityTokenFilter(systemManagement, tenantAware);
return new ControllerPreAuthenticatedGatewaySecurityTokenFilter(tenantConfigurationManagement, tenantAware);
}
}

View File

@@ -8,7 +8,7 @@
*/
package org.eclipse.hawkbit.security;
import org.eclipse.hawkbit.repository.SystemManagement;
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
import org.eclipse.hawkbit.tenancy.TenantAware;
/**
@@ -44,9 +44,9 @@ public class HttpControllerPreAuthenticatedSecurityHeaderFilter extends Abstract
* tenant
*/
public HttpControllerPreAuthenticatedSecurityHeaderFilter(final String caCommonNameHeader,
final String caAuthorityNameHeader, final SystemManagement systemManagement,
final String caAuthorityNameHeader, final TenantConfigurationManagement tenantConfigurationManagement,
final TenantAware tenantAware) {
super(systemManagement, tenantAware);
super(tenantConfigurationManagement, tenantAware);
this.caCommonNameHeader = caCommonNameHeader;
this.caAuthorityNameHeader = caAuthorityNameHeader;
}
@@ -54,7 +54,7 @@ public class HttpControllerPreAuthenticatedSecurityHeaderFilter extends Abstract
@Override
protected PreAuthenficationFilter createControllerAuthenticationFilter() {
return new ControllerPreAuthenticatedSecurityHeaderFilter(caCommonNameHeader, caAuthorityNameHeader,
systemManagement, tenantAware);
tenantConfigurationManagement, tenantAware);
}
}