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

@@ -9,7 +9,7 @@
package org.eclipse.hawkbit.security;
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.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
import org.slf4j.Logger;
@@ -26,13 +26,13 @@ public abstract class AbstractControllerAuthenticationFilter implements PreAuthe
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractControllerAuthenticationFilter.class);
protected final SystemManagement systemManagement;
protected final TenantConfigurationManagement tenantConfigurationManagement;
protected final TenantAware tenantAware;
private final SecurityConfigurationKeyTenantRunner configurationKeyTenantRunner;
protected AbstractControllerAuthenticationFilter(final SystemManagement systemManagement,
protected AbstractControllerAuthenticationFilter(final TenantConfigurationManagement systemManagement,
final TenantAware tenantAware) {
this.systemManagement = systemManagement;
this.tenantConfigurationManagement = systemManagement;
this.tenantAware = tenantAware;
this.configurationKeyTenantRunner = new SecurityConfigurationKeyTenantRunner();
}
@@ -54,7 +54,8 @@ public abstract class AbstractControllerAuthenticationFilter implements PreAuthe
@Override
public Boolean run() {
LOGGER.trace("retrieving configuration value for configuration key {}", getTenantConfigurationKey());
return systemManagement.getConfigurationValue(getTenantConfigurationKey(), Boolean.class).getValue();
return tenantConfigurationManagement.getConfigurationValue(getTenantConfigurationKey(), Boolean.class)
.getValue();
}
}

View File

@@ -12,7 +12,7 @@ import org.eclipse.hawkbit.dmf.json.model.TenantSecruityToken;
import org.eclipse.hawkbit.im.authentication.SpPermission;
import org.eclipse.hawkbit.im.authentication.TenantAwareAuthenticationDetails;
import org.eclipse.hawkbit.repository.ControllerManagement;
import org.eclipse.hawkbit.repository.SystemManagement;
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
import org.eclipse.hawkbit.tenancy.TenantAware;
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
import org.slf4j.Logger;
@@ -55,9 +55,10 @@ public class ControllerPreAuthenticateSecurityTokenFilter extends AbstractContro
* the tenant aware service to get configuration for the specific
* tenant
*/
public ControllerPreAuthenticateSecurityTokenFilter(final SystemManagement systemManagement,
public ControllerPreAuthenticateSecurityTokenFilter(
final TenantConfigurationManagement tenantConfigurationManagement,
final ControllerManagement controllerManagement, final TenantAware tenantAware) {
super(systemManagement, tenantAware);
super(tenantConfigurationManagement, tenantAware);
this.controllerManagement = controllerManagement;
}

View File

@@ -9,7 +9,7 @@
package org.eclipse.hawkbit.security;
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.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
import org.slf4j.Logger;
@@ -46,9 +46,9 @@ public class ControllerPreAuthenticatedGatewaySecurityTokenFilter extends Abstra
* the tenant aware service to get configuration for the specific
* tenant
*/
public ControllerPreAuthenticatedGatewaySecurityTokenFilter(final SystemManagement systemManagement,
final TenantAware tenantAware) {
super(systemManagement, tenantAware);
public ControllerPreAuthenticatedGatewaySecurityTokenFilter(
final TenantConfigurationManagement tenantConfigurationManagement, final TenantAware tenantAware) {
super(tenantConfigurationManagement, tenantAware);
}
@Override
@@ -84,7 +84,7 @@ public class ControllerPreAuthenticatedGatewaySecurityTokenFilter extends Abstra
public String run() {
LOGGER.trace("retrieving configuration value for configuration key {}",
TenantConfigurationKey.AUTHENTICATION_MODE_GATEWAY_SECURITY_TOKEN_KEY);
return systemManagement.getConfigurationValue(
return tenantConfigurationManagement.getConfigurationValue(
TenantConfigurationKey.AUTHENTICATION_MODE_GATEWAY_SECURITY_TOKEN_KEY, String.class).getValue();
}
}

View File

@@ -9,7 +9,7 @@
package org.eclipse.hawkbit.security;
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.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
import org.slf4j.Logger;
@@ -65,9 +65,9 @@ public class ControllerPreAuthenticatedSecurityHeaderFilter extends AbstractCont
* tenant
*/
public ControllerPreAuthenticatedSecurityHeaderFilter(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.sslIssuerHashBasicHeader = caAuthorityNameHeader;
}
@@ -142,7 +142,7 @@ public class ControllerPreAuthenticatedSecurityHeaderFilter extends AbstractCont
private final class GetSecurityAuthorityNameTenantRunner implements TenantAware.TenantRunner<String> {
@Override
public String run() {
return systemManagement.getConfigurationValue(
return tenantConfigurationManagement.getConfigurationValue(
TenantConfigurationKey.AUTHENTICATION_MODE_HEADER_AUTHORITY_NAME, String.class).getValue();
}
}