Modular hawkBit (#378)

* Cleaned up component scan
* More flexibility for hawkBit micro services
* Introduce spring boot starters
* Eclipse Jetty as hawkBit default
* Fixed links as prep for wiki removal

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
Kai Zimmermann
2016-12-13 12:29:21 +01:00
committed by GitHub
parent 63adbd0298
commit 92dd6a1a0e
178 changed files with 981 additions and 585 deletions

View File

@@ -6,7 +6,7 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit;
package org.eclipse.hawkbit.security;
import java.io.IOException;
@@ -23,10 +23,6 @@ import org.springframework.web.filter.ShallowEtagHeaderFilter;
* where no ETag header should be generated due that calculating the ETag is an
* expensive operation and the response output need to be copied in memory which
* should be excluded in case of artifact downloads which could be big of size.
*
*
*
*
*/
public class ExcludePathAwareShallowETagFilter extends ShallowEtagHeaderFilter {
@@ -41,14 +37,6 @@ public class ExcludePathAwareShallowETagFilter extends ShallowEtagHeaderFilter {
this.antMatcher = new AntPathMatcher();
}
/*
* (non-Javadoc)
*
* @see
* org.springframework.web.filter.ShallowEtagHeaderFilter#doFilterInternal(
* javax.servlet.http .HttpServletRequest,
* javax.servlet.http.HttpServletResponse, javax.servlet.FilterChain)
*/
@Override
protected void doFilterInternal(final HttpServletRequest request, final HttpServletResponse response,
final FilterChain filterChain) throws ServletException, IOException {

View File

@@ -9,13 +9,11 @@
package org.eclipse.hawkbit.security;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* Security related hawkbit configuration.
*
*/
@Component
@ConfigurationProperties("hawkbit.server.security")
public class HawkbitSecurityProperties {

View File

@@ -11,18 +11,12 @@ package org.eclipse.hawkbit.security;
import java.security.SecureRandom;
import org.apache.commons.lang3.RandomStringUtils;
import org.springframework.stereotype.Service;
/**
* A security token generator service which can be used to generate security
* tokens for e.g. target or gateway tokens which are valid for authenticates
* against SP.
*
*
*
*
*/
@Service
public class SecurityTokenGenerator {
private static final boolean LETTERS_GENERATION = true;

View File

@@ -17,21 +17,18 @@ import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
import org.eclipse.hawkbit.tenancy.TenantAware;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.context.SecurityContextImpl;
import org.springframework.stereotype.Service;
import com.google.common.base.Throwables;
/**
* A Service which provide to run system code.
*/
@Service
public class SystemSecurityContext {
private static final Logger LOG = LoggerFactory.getLogger(SystemSecurityContext.class);
@@ -44,7 +41,6 @@ public class SystemSecurityContext {
* @param tenantAware
* the tenant aware bean to retrieve the current tenant
*/
@Autowired
public SystemSecurityContext(final TenantAware tenantAware) {
this.tenantAware = tenantAware;
}

View File

@@ -1,39 +0,0 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.util;
import javax.servlet.MultipartConfigElement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Bean which contains all informations about the SP software, e.g. like
* version, built time etc. from the environment.
*
*/
@Component
public class SPInfo {
// package private for testing purposes
static final String UNKNOWN_VERSION = "unknown";
static final String UNKNOWN_CREDENTIAL = "unknown credential";
@Autowired
private MultipartConfigElement configElement;
/**
* @return the max file size to upload artifact files in bytes which has
* been configured.
*/
public long getMaxArtifactFileSize() {
return configElement.getMaxFileSize();
}
}

View File

@@ -6,7 +6,7 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit;
package org.eclipse.hawkbit.security;
import static org.fest.assertions.Assertions.assertThat;
import static org.mockito.Mockito.mockingDetails;
@@ -21,6 +21,7 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.hawkbit.security.ExcludePathAwareShallowETagFilter;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;