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:
27
README.md
27
README.md
@@ -9,7 +9,7 @@ Build: [](
|
|||||||
|
|
||||||
# Documentation
|
# Documentation
|
||||||
|
|
||||||
see [hawkBit Wiki](https://github.com/eclipse/hawkbit/wiki)
|
see [hawkBit Documentation](https://www.eclipse.org/hawkbit/documentation/overview/introduction.html)
|
||||||
|
|
||||||
# Contact us
|
# Contact us
|
||||||
|
|
||||||
@@ -27,6 +27,10 @@ https://hawkbit.eu-gb.mybluemix.net/UI/
|
|||||||
|
|
||||||
We are not providing an off the shelf installation ready hawkBit update server. However, we recommend to check out the [Example Application](examples/hawkbit-example-app) for a runtime ready Spring Boot based update server that is empowered by hawkBit. In addition we have [guide](https://github.com/eclipse/hawkbit/wiki/Run-hawkBit) for setting up a complete landscape.
|
We are not providing an off the shelf installation ready hawkBit update server. However, we recommend to check out the [Example Application](examples/hawkbit-example-app) for a runtime ready Spring Boot based update server that is empowered by hawkBit. In addition we have [guide](https://github.com/eclipse/hawkbit/wiki/Run-hawkBit) for setting up a complete landscape.
|
||||||
|
|
||||||
|
# hawkBit (Spring boot) starters
|
||||||
|
|
||||||
|
Next to the [Example Application](examples/hawkbit-example-app) we are also providing a set of [Spring Boot Starters](hawkbit-starters) to quick start your own [Spring Boot](https://projects.spring.io/spring-boot/) based application.
|
||||||
|
|
||||||
#### Clone and build hawkBit
|
#### Clone and build hawkBit
|
||||||
```
|
```
|
||||||
$ git clone https://github.com/eclipse/hawkbit.git
|
$ git clone https://github.com/eclipse/hawkbit.git
|
||||||
@@ -57,24 +61,3 @@ $ java -jar ./examples/hawkbit-example-mgmt-simulator/target/hawkbit-example-mgm
|
|||||||
* Clustering capabilities for the update server.
|
* Clustering capabilities for the update server.
|
||||||
* Upgrade of Spring Boot and Vaadin dependencies.
|
* Upgrade of Spring Boot and Vaadin dependencies.
|
||||||
* And of course tons of usability improvements and bug fixes.
|
* And of course tons of usability improvements and bug fixes.
|
||||||
|
|
||||||
|
|
||||||
# Modules
|
|
||||||
* `examples` : hawkBit examples
|
|
||||||
* `hawkbit-artifact-repository-mongo` : Artifact repository implementation to mongoDB.
|
|
||||||
* `hawkbit-autoconfigure` : Spring-boot auto-configuration.
|
|
||||||
* `hawkbit-core` : Core elements for internal interfaces and utility classes.
|
|
||||||
* `hawkbit-ddi-api` : The hawkBit DDI API.
|
|
||||||
* `hawkbit-ddi-dl-api` : The hawkBit DDI Download API.
|
|
||||||
* `hawkbit-ddi-resource` : Implementation of the hawkBit DDI API
|
|
||||||
* `hawkbit-dmf-amqp` : AMQP endpoint implementation for the DMF API.
|
|
||||||
* `hawkbit-dmf-api` : API for the Device Management Integration.
|
|
||||||
* `hawkbit-http-security` : Implementation for security filters for HTTP.
|
|
||||||
* `hawkbit-mgmt-api` : The hawkBit Management API
|
|
||||||
* `hawkbit-mgmt-resource` : Implementation of the hawkBit Management API
|
|
||||||
* `hawkbit-repository` : Repository implementation based on SQL for all meta-data.
|
|
||||||
* `hawkbit-rest-core` : Core elements for the rest modules.
|
|
||||||
* `hawkbit-security-core` : Core security elements.
|
|
||||||
* `hawkbit-security-integration` : Security integration elements to integrate security into hawkBit.
|
|
||||||
* `hawkbit-test-report` : Test reports
|
|
||||||
* `hawkbit-ui` : Vaadin UI.
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ title: Clustering
|
|||||||
In this guide we describe how to create a [Feign](https://github.com/Netflix/feign) Rest Client based on a [Spring Boot](http://projects.spring.io/spring-boot/) Application. [hawkBit](https://projects.eclipse.org/projects/iot.hawkbit) provides REST interfaces for [Management API](https://github.com/eclipse/hawkbit/tree/master/hawkbit-ddi-api) and [DDI API] (https://github.com/eclipse/hawkbit/tree/master/hawkbit-ddi-api). Using this interfaces you can create a feign client with the help of the [feign inheritance support] (http://projects.spring.io/spring-cloud/spring-cloud.html#spring-cloud-feign-inheritance).
|
In this guide we describe how to create a [Feign](https://github.com/Netflix/feign) Rest Client based on a [Spring Boot](http://projects.spring.io/spring-boot/) Application. [hawkBit](https://projects.eclipse.org/projects/iot.hawkbit) provides REST interfaces for [Management API](https://github.com/eclipse/hawkbit/tree/master/hawkbit-ddi-api) and [DDI API] (https://github.com/eclipse/hawkbit/tree/master/hawkbit-ddi-api). Using this interfaces you can create a feign client with the help of the [feign inheritance support] (http://projects.spring.io/spring-cloud/spring-cloud.html#spring-cloud-feign-inheritance).
|
||||||
Our [example](https://github.com/eclipse/hawkbit/tree/master/examples) modules demonstrate how to create [Feign](https://github.com/Netflix/feign) client resources. Here you can find the [Management API client resources](https://github.com/eclipse/hawkbit/tree/master/examples/hawkbit-example-mgmt-feign-client) and the [DDI client resources](https://github.com/eclipse/hawkbit/tree/master/examples/hawkbit-example-ddi-feign-client).
|
Our [example](https://github.com/eclipse/hawkbit/tree/master/examples) modules demonstrate how to create [Feign](https://github.com/Netflix/feign) client resources. Here you can find the [Management API client resources](https://github.com/eclipse/hawkbit/tree/master/examples/hawkbit-example-mgmt-feign-client) and the [DDI client resources](https://github.com/eclipse/hawkbit/tree/master/examples/hawkbit-example-ddi-feign-client).
|
||||||
A small [simulator application](https://github.com/eclipse/hawkbit/blob/master/examples/hawkbit-example-mgmt-simulator/src/main/java/org/eclipse/hawkbit/mgmt/client/Application.java) demonstrates how you can interact with the [hawkBit](https://projects.eclipse.org/projects/iot.hawkbit) via the [Management API
|
A small [simulator application](https://github.com/eclipse/hawkbit/blob/master/examples/hawkbit-example-mgmt-simulator/src/main/java/org/eclipse/hawkbit/mgmt/client/Application.java) demonstrates how you can interact with the [hawkBit](https://projects.eclipse.org/projects/iot.hawkbit) via the [Management API
|
||||||
](https://github.com/eclipse/hawkbit/wiki/Management-API).
|
](http://www.eclipse.org/hawkbit/documentation/interfaces/management-api.html).
|
||||||
|
|
||||||
Note: A hawkbit application have to be run. Therefore, you can use our [example application](https://github.com/eclipse/hawkbit/tree/master/examples/hawkbit-example-app)
|
Note: A hawkbit application have to be run. Therefore, you can use our [example application](https://github.com/eclipse/hawkbit/tree/master/examples/hawkbit-example-app)
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ title: Run hawkBit
|
|||||||
|
|
||||||
In this guide we describe how to run a full featured hawkBit setup based on a production ready infrastructure. It is based on the _hawkBit_ example modules. We call these _examples_ as we expect that developers who intend to create a _hawkBit_ based IoT application on their own will create a custom [Spring Boot](http://projects.spring.io/spring-boot/) app based on _hawkBit_ as demonstrated with the [hawkBit example app](https://github.com/eclipse/hawkbit/tree/master/examples/hawkbit-example-app).
|
In this guide we describe how to run a full featured hawkBit setup based on a production ready infrastructure. It is based on the _hawkBit_ example modules. We call these _examples_ as we expect that developers who intend to create a _hawkBit_ based IoT application on their own will create a custom [Spring Boot](http://projects.spring.io/spring-boot/) app based on _hawkBit_ as demonstrated with the [hawkBit example app](https://github.com/eclipse/hawkbit/tree/master/examples/hawkbit-example-app).
|
||||||
|
|
||||||
Note: the example app can in fact be run [stand alone](https://github.com/eclipse/hawkbit/tree/master/examples/hawkbit-example-app). However, only with an embedded H2, no [Device Management Federation API](https://github.com/eclipse/hawkbit/wiki/Device-Management-Federation-API) and no artifact storage.
|
Note: the example app can in fact be run [stand alone](https://github.com/eclipse/hawkbit/tree/master/examples/hawkbit-example-app). However, only with an embedded H2, no [Device Management Federation API](../interfaces/dmf-api.html) and no artifact storage.
|
||||||
|
|
||||||
This guide will focus on a complete setup that includes all _hawkBit_ features.
|
This guide will focus on a complete setup that includes all _hawkBit_ features.
|
||||||
|
|
||||||
@@ -99,6 +99,6 @@ However, this is not done by _DMF_ which is in fact used by the device simulator
|
|||||||
|
|
||||||
see [device simulator](https://github.com/eclipse/hawkbit/tree/master/examples/hawkbit-device-simulator)
|
see [device simulator](https://github.com/eclipse/hawkbit/tree/master/examples/hawkbit-device-simulator)
|
||||||
|
|
||||||
## Enjoy hawkBit with a real database, artifact storage and all [interfaces](https://github.com/eclipse/hawkbit/wiki/Interfaces) available.
|
## Enjoy hawkBit with a real database, artifact storage and all [interfaces](../interfaces/interfaces.html) available.
|
||||||
|
|
||||||
{:width="100%"}
|
{:width="100%"}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ The _hawkbit_ [update server](https://github.com/eclipse/hawkbit) provides REST
|
|||||||
Note: in DDI the target is identified using a **controllerId**. Controller is used as a term for the actual service/client on the device. That allows users to have in some cases even multiple clients on the same target for different tasks, e.g. Firmware update and App management.
|
Note: in DDI the target is identified using a **controllerId**. Controller is used as a term for the actual service/client on the device. That allows users to have in some cases even multiple clients on the same target for different tasks, e.g. Firmware update and App management.
|
||||||
|
|
||||||
# State Machine Mapping
|
# State Machine Mapping
|
||||||
For historical reasons the DDI has a different state machine and status messages than the [Target State Machine](https://github.com/eclipse/hawkbit/wiki/Target-State-Machine) of the _hawkBit_ update server.
|
For historical reasons the DDI has a different state machine and status messages than the [Target State Machine](../architecture/targetstate.html) of the _hawkBit_ update server.
|
||||||
|
|
||||||
This is kept in order to ensure that _DDI_ stays compatible for devices out there in the field. A future version "2" of _DDI_ might change that. _DDI_ also defines more states than the update server, e.g. multiple DDI states are currently mapped by the _DDI_ implementation to _RUNNING_ state. It is possible that in the future _hawkBit_ will fully leverage these additional states.
|
This is kept in order to ensure that _DDI_ stays compatible for devices out there in the field. A future version "2" of _DDI_ might change that. _DDI_ also defines more states than the update server, e.g. multiple DDI states are currently mapped by the _DDI_ implementation to _RUNNING_ state. It is possible that in the future _hawkBit_ will fully leverage these additional states.
|
||||||
|
|
||||||
|
|||||||
@@ -10,20 +10,20 @@ title: Interfaces
|
|||||||
|
|
||||||
# Graphical User Interface
|
# Graphical User Interface
|
||||||
|
|
||||||
To get started _hawkBit_ offers a [Management UI](https://github.com/eclipse/hawkbit/wiki/Management-UI) that allows operators to manage the repository and trigger provisioning operations.
|
To get started _hawkBit_ offers a [Management UI](management-ui.html) that allows operators to manage the repository and trigger provisioning operations.
|
||||||
|
|
||||||
In addition Eclipse _hawkBit_ offers developers multiple options to integrate.
|
In addition Eclipse _hawkBit_ offers developers multiple options to integrate.
|
||||||
|
|
||||||
# Application Integration
|
# Application Integration
|
||||||
The _hawkBit_ [Management API](https://github.com/eclipse/hawkbit/wiki/Management-API) allows applications to manage the repository and trigger provisioning operations. It is in general feature compliant with the _Management UI_. However, small differences may occur here and there. The authentication and authorization structure is identical, i.e. a user can login both at Management API and UI with the same credentials and has the same permissions available.
|
The _hawkBit_ [Management API](management-api.html) allows applications to manage the repository and trigger provisioning operations. It is in general feature compliant with the _Management UI_. However, small differences may occur here and there. The authentication and authorization structure is identical, i.e. a user can login both at Management API and UI with the same credentials and has the same permissions available.
|
||||||
|
|
||||||
# Device Integration
|
# Device Integration
|
||||||
For device integration two options exist.
|
For device integration two options exist.
|
||||||
|
|
||||||
The [Direct Device Integration API](https://github.com/eclipse/hawkbit/wiki/Direct-Device-Integration-API) allows direct integration from the device to the _hawkBit_ server. It has been designed with simplicity in mind as its is fully focused on software update. It allows device integrators to separate concerns by means of having distinguished channels for business data and general device management tasks on one side and software update on the other. As a result it is possible to keep the _lifesaving_ provisioning process controller on the device separate from the more complex business functionality. A benefit of such an architecture should not be underestimated.
|
The [Direct Device Integration API](ddi-api.html) allows direct integration from the device to the _hawkBit_ server. It has been designed with simplicity in mind as its is fully focused on software update. It allows device integrators to separate concerns by means of having distinguished channels for business data and general device management tasks on one side and software update on the other. As a result it is possible to keep the _lifesaving_ provisioning process controller on the device separate from the more complex business functionality. A benefit of such an architecture should not be underestimated.
|
||||||
|
|
||||||
As result of such a simple HTTP/REST/JSON based API even a major back-end migration or disaster can be covered with simple web server hosting a text file that contains only the command to update one more time to execute a migration on the device. The API was designed on purpose in way to have that last resort even if the plan is that this will never be necessary.
|
As result of such a simple HTTP/REST/JSON based API even a major back-end migration or disaster can be covered with simple web server hosting a text file that contains only the command to update one more time to execute a migration on the device. The API was designed on purpose in way to have that last resort even if the plan is that this will never be necessary.
|
||||||
|
|
||||||
The [Device Management Federation API](https://github.com/eclipse/hawkbit/wiki/Device-Management-Federation-API) however allows to combine the business data and _hawkBit_ connectivity. This is especially usefull if a constrained device cannot handle a TLS/HTTP connection, is supporting a standard device management protocol that covers also the software update part (e.g. TR-069, OMA-DM, LWM2M) or the device is already connected and _hawkBit_ is introduced later on.
|
The [Device Management Federation API](dmf-api.html) however allows to combine the business data and _hawkBit_ connectivity. This is especially usefull if a constrained device cannot handle a TLS/HTTP connection, is supporting a standard device management protocol that covers also the software update part (e.g. TR-069, OMA-DM, LWM2M) or the device is already connected and _hawkBit_ is introduced later on.
|
||||||
|
|
||||||
The decision for the right device integration path is up to the integration party.
|
The decision for the right device integration path is up to the integration party.
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ For all requests an `Authorization` header has to be set.
|
|||||||
* Username: `Tenant\username`
|
* Username: `Tenant\username`
|
||||||
* Password: `password`
|
* Password: `password`
|
||||||
|
|
||||||
Also have a look to the [Security](https://github.com/eclipse/hawkbit/wiki/Security) chapter.
|
Also have a look to the [Security](../security/security.html) chapter.
|
||||||
|
|
||||||
In addition, for POST and PUT requests the `Content-Type` header has to be set. Accepted content-types are.
|
In addition, for POST and PUT requests the `Content-Type` header has to be set. Accepted content-types are.
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ We offer a sandbox installation that is free for everyone to try out hawkBit. Ho
|
|||||||
|
|
||||||
# Compile, Run and Getting Started
|
# Compile, Run and Getting Started
|
||||||
|
|
||||||
We are not providing an off the shelf installation ready hawkBit update server. However, we recommend to check out the [Example Application](examples/hawkbit-example-app) for a runtime ready Spring Boot based update server that is empowered by hawkBit. In addition we have [guide](https://github.com/eclipse/hawkbit/wiki/Run-hawkBit) for setting up a complete landscape.
|
We are not providing an off the shelf installation ready hawkBit update server. However, we recommend to check out the [Example Application](examples/hawkbit-example-app) for a runtime ready Spring Boot based update server that is empowered by hawkBit. In addition we have [guide](../guide/runhawkbit.html) for setting up a complete landscape.
|
||||||
|
|
||||||
#### Clone and build hawkBit
|
#### Clone and build hawkBit
|
||||||
{% highlight bash %}
|
{% highlight bash %}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ Host: your.hawkBit.server
|
|||||||
Authorization: TargetToken bH7XXAprK1ChnLfKSdtlsp7NOlPnZAYY
|
Authorization: TargetToken bH7XXAprK1ChnLfKSdtlsp7NOlPnZAYY
|
||||||
```
|
```
|
||||||
|
|
||||||
The target security token is provided in [DMF API](https://github.com/eclipse/hawkbit/wiki/Device-Management-Federation-API) as part of the update message in order to allow DMF clients to leverage the feature or can it be manually retrieved per target by [Management API](https://github.com/eclipse/hawkbit/wiki/Management-API) or in the [Management UI](https://github.com/eclipse/hawkbit/wiki/Management-UI) in the target details.
|
The target security token is provided in [DMF API](../interfaces/dmf-api.html) as part of the update message in order to allow DMF clients to leverage the feature or can it be manually retrieved per target by [Management API](../interfaces/management-api.html) or in the [Management UI](../interfaces/management-ui.html) in the target details.
|
||||||
|
|
||||||
Note: needs to be enabled in your _hawkBit_ installation **and** in the tenant configuration. That allows both the operator as well as the individual customer (if run in a multi-tenant setup) to enable this access method. See [DdiSecurityProperties](https://github.com/eclipse/hawkbit/blob/master/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/DdiSecurityProperties.java) for system wide enablement.
|
Note: needs to be enabled in your _hawkBit_ installation **and** in the tenant configuration. That allows both the operator as well as the individual customer (if run in a multi-tenant setup) to enable this access method. See [DdiSecurityProperties](https://github.com/eclipse/hawkbit/blob/master/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/DdiSecurityProperties.java) for system wide enablement.
|
||||||
|
|
||||||
|
|||||||
1
examples/hawkbit-custom-theme-example/.gitignore
vendored
Normal file
1
examples/hawkbit-custom-theme-example/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/.springBeans
|
||||||
@@ -8,7 +8,6 @@ package org.eclipse.hawkbit.app;
|
|||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.eclipse.hawkbit.EnableJpaRepository;
|
|
||||||
import org.eclipse.hawkbit.autoconfigure.security.EnableHawkbitManagedSecurityConfiguration;
|
import org.eclipse.hawkbit.autoconfigure.security.EnableHawkbitManagedSecurityConfiguration;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
@@ -22,7 +21,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
@EnableHawkbitManagedSecurityConfiguration
|
@EnableHawkbitManagedSecurityConfiguration
|
||||||
// Exception squid:S1118 - Spring boot standard behavior
|
// Exception squid:S1118 - Spring boot standard behavior
|
||||||
@SuppressWarnings({ "squid:S1118" })
|
@SuppressWarnings({ "squid:S1118" })
|
||||||
@EnableJpaRepository
|
|
||||||
public class Start {
|
public class Start {
|
||||||
/**
|
/**
|
||||||
* Main method to start the spring-boot application.
|
* Main method to start the spring-boot application.
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ Example: for 10 simulated devices that start with the name prefix "activeSim":
|
|||||||
http://localhost:8083/start?amount=10&name=activeSim
|
http://localhost:8083/start?amount=10&name=activeSim
|
||||||
```
|
```
|
||||||
|
|
||||||
Example: for 5 simulated devices that start with the name prefix "ddi" using the Direct Device Integration API (http):
|
Example: for 5 simulated devices that start with the name prefix "ddi" using the Direct Device Integration API (http) authenticated by given gateway token, a pool interval of 10 seconds and a custom port for the DDI service.:
|
||||||
```
|
```
|
||||||
http://localhost:8083/start?amount=5&name=ddi?api=ddi
|
http://localhost:8083/start?amount=5&name=ddi&api=ddi&gatewaytoken=d5F2mmlARiMuMOquRmLlxW4xZFHy4mEV&polldelay=10&endpoint=http://localhost:8085
|
||||||
```
|
```
|
||||||
|
|||||||
1
examples/hawkbit-example-app/.gitignore
vendored
1
examples/hawkbit-example-app/.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
/target/
|
/target/
|
||||||
/artifactrepo/*
|
/artifactrepo/*
|
||||||
|
/.springBeans
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<version>0.2.0-SNAPSHOT</version>
|
<version>0.2.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>hawkbit-example-app</artifactId>
|
<artifactId>hawkbit-example-app</artifactId>
|
||||||
<name>hawkBit-example :: UI Application</name>
|
<name>hawkBit-example :: Update Server</name>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
@@ -56,76 +56,17 @@
|
|||||||
</build>
|
</build>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- Hawkbit -->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-autoconfigure</artifactId>
|
<artifactId>hawkbit-boot-starter</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
|
||||||
<artifactId>hawkbit-mgmt-resource</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
|
||||||
<artifactId>hawkbit-ddi-resource</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
|
||||||
<artifactId>hawkbit-dmf-amqp</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
|
||||||
<artifactId>hawkbit-ui</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
|
||||||
<artifactId>hawkbit-security-integration</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
|
||||||
<artifactId>hawkbit-http-security</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
|
||||||
<artifactId>hawkbit-repository-jpa</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- Spring -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.security</groupId>
|
|
||||||
<artifactId>spring-security-aspects</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.h2database</groupId>
|
<groupId>com.h2database</groupId>
|
||||||
<artifactId>h2</artifactId>
|
<artifactId>h2</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- exclude gwt-elemental as there are class conflicts -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.vaadin</groupId>
|
|
||||||
<artifactId>vaadin-client</artifactId>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>com.vaadin.external.gwt</groupId>
|
|
||||||
<artifactId>gwt-elemental</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -8,10 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.app;
|
package org.eclipse.hawkbit.app;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.EnableJpaRepository;
|
|
||||||
import org.eclipse.hawkbit.autoconfigure.security.EnableHawkbitManagedSecurityConfiguration;
|
import org.eclipse.hawkbit.autoconfigure.security.EnableHawkbitManagedSecurityConfiguration;
|
||||||
import org.eclipse.hawkbit.ddi.EnableDdiApi;
|
|
||||||
import org.eclipse.hawkbit.mgmt.EnableMgmtApi;
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
@@ -22,9 +19,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
*/
|
*/
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableHawkbitManagedSecurityConfiguration
|
@EnableHawkbitManagedSecurityConfiguration
|
||||||
@EnableMgmtApi
|
|
||||||
@EnableDdiApi
|
|
||||||
@EnableJpaRepository
|
|
||||||
// Exception squid:S1118 - Spring boot standard behavior
|
// Exception squid:S1118 - Spring boot standard behavior
|
||||||
@SuppressWarnings({ "squid:S1118" })
|
@SuppressWarnings({ "squid:S1118" })
|
||||||
public class Start {
|
public class Start {
|
||||||
|
|||||||
@@ -112,10 +112,6 @@ public class ConfigurableScenario {
|
|||||||
runRollouts(scenario);
|
runRollouts(scenario);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scenario.isRunRollouts()) {
|
|
||||||
runRollouts(scenario);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scenario.isRunSemiAutomaticRollouts() && !scenario.getDeviceGroups().isEmpty()) {
|
if (scenario.isRunSemiAutomaticRollouts() && !scenario.getDeviceGroups().isEmpty()) {
|
||||||
runSemiAutomaticRollouts(scenario);
|
runSemiAutomaticRollouts(scenario);
|
||||||
}
|
}
|
||||||
@@ -217,7 +213,7 @@ public class ConfigurableScenario {
|
|||||||
// start the created Rollout
|
// start the created Rollout
|
||||||
rolloutResource.start(rolloutResponseBody.getRolloutId());
|
rolloutResource.start(rolloutResponseBody.getRolloutId());
|
||||||
|
|
||||||
waitUntilRolloutIsComplete(scenario);
|
waitUntilRolloutIsComplete(rolloutResponseBody.getRolloutId());
|
||||||
LOGGER.info("Run rollout for set {} -> Done", set.getDsId());
|
LOGGER.info("Run rollout for set {} -> Done", set.getDsId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,20 +252,19 @@ public class ConfigurableScenario {
|
|||||||
// start the created Rollout
|
// start the created Rollout
|
||||||
rolloutResource.start(rolloutResponseBody.getRolloutId());
|
rolloutResource.start(rolloutResponseBody.getRolloutId());
|
||||||
|
|
||||||
waitUntilRolloutIsComplete(scenario);
|
waitUntilRolloutIsComplete(rolloutResponseBody.getRolloutId());
|
||||||
LOGGER.info("Run rollout for set {} -> Done", set.getDsId());
|
LOGGER.info("Run rollout for set {} -> Done", set.getDsId());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void waitUntilRolloutIsComplete(final Scenario scenario) {
|
private void waitUntilRolloutIsComplete(final Long id) {
|
||||||
do {
|
do {
|
||||||
try {
|
try {
|
||||||
TimeUnit.SECONDS.sleep(35);
|
TimeUnit.SECONDS.sleep(5);
|
||||||
} catch (final InterruptedException e) {
|
} catch (final InterruptedException e) {
|
||||||
LOGGER.warn("Interrupted!");
|
LOGGER.warn("Interrupted!");
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
}
|
}
|
||||||
} while (targetResource.getTargets(0, 1, null, "updateStatus==IN_SYNC").getBody().getTotal() < scenario
|
} while (!"FINISHED".equalsIgnoreCase(rolloutResource.getRollout(id).getBody().getStatus()));
|
||||||
.getTargets());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void waitUntilRolloutIsReady(final Long id) {
|
private void waitUntilRolloutIsReady(final Long id) {
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
/artifactrepo/*
|
/artifactrepo/*
|
||||||
|
/.apt_generated/
|
||||||
|
|||||||
@@ -6,23 +6,19 @@
|
|||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.autoconfigure.repository;
|
package org.eclipse.hawkbit.artifact.repository;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.artifact.repository.ArtifactFilesystemProperties;
|
|
||||||
import org.eclipse.hawkbit.artifact.repository.ArtifactFilesystemRepository;
|
|
||||||
import org.eclipse.hawkbit.artifact.repository.ArtifactRepository;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Auto configuration for the {@link ArtifactFilesystemRepository}.
|
* Configuration for the {@link ArtifactFilesystemRepository}.
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@ConditionalOnMissingBean(ArtifactRepository.class)
|
|
||||||
@EnableConfigurationProperties(ArtifactFilesystemProperties.class)
|
@EnableConfigurationProperties(ArtifactFilesystemProperties.class)
|
||||||
public class ArtifactStoreAutoConfiguration {
|
public class ArtifactFilesystemConfiguration {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param artifactFilesystemProperties
|
* @param artifactFilesystemProperties
|
||||||
@@ -30,6 +26,7 @@ public class ArtifactStoreAutoConfiguration {
|
|||||||
* @return Default {@link ArtifactRepository} implementation.
|
* @return Default {@link ArtifactRepository} implementation.
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
|
@ConditionalOnMissingBean
|
||||||
public ArtifactRepository artifactRepository(final ArtifactFilesystemProperties artifactFilesystemProperties) {
|
public ArtifactRepository artifactRepository(final ArtifactFilesystemProperties artifactFilesystemProperties) {
|
||||||
return new ArtifactFilesystemRepository(artifactFilesystemProperties);
|
return new ArtifactFilesystemRepository(artifactFilesystemProperties);
|
||||||
}
|
}
|
||||||
@@ -8,25 +8,22 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.autoconfigure.amqp;
|
package org.eclipse.hawkbit.autoconfigure.amqp;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.amqp.AmqpConfiguration;
|
import org.eclipse.hawkbit.amqp.DmfApiConfiguration;
|
||||||
import org.eclipse.hawkbit.amqp.annotation.EnableAmqp;
|
|
||||||
import org.springframework.amqp.rabbit.listener.ConditionalRejectingErrorHandler;
|
import org.springframework.amqp.rabbit.listener.ConditionalRejectingErrorHandler;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
import org.springframework.util.ErrorHandler;
|
import org.springframework.util.ErrorHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The amqp autoconfiguration.
|
* The AMQP 0.9 based device Management Federation API (DMF) auto configuration.
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@ConditionalOnClass(value = AmqpConfiguration.class)
|
@ConditionalOnClass(DmfApiConfiguration.class)
|
||||||
@EnableAmqp
|
@Import(DmfApiConfiguration.class)
|
||||||
public class AmqpAutoConfiguration {
|
public class DmfApiAutoConfiguration {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create default error handler bean.
|
* Create default error handler bean.
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* 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.autoconfigure.repository;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.artifact.repository.ArtifactFilesystemConfiguration;
|
||||||
|
import org.eclipse.hawkbit.artifact.repository.ArtifactFilesystemRepository;
|
||||||
|
import org.eclipse.hawkbit.artifact.repository.ArtifactRepository;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto configuration for the {@link ArtifactFilesystemRepository}.
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@ConditionalOnMissingBean(ArtifactRepository.class)
|
||||||
|
@ConditionalOnClass({ ArtifactFilesystemConfiguration.class })
|
||||||
|
@Import(ArtifactFilesystemConfiguration.class)
|
||||||
|
public class ArtifactFilesystemAutoConfiguration {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.autoconfigure.repository;
|
package org.eclipse.hawkbit.autoconfigure.repository;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.EnableJpaRepository;
|
import org.eclipse.hawkbit.repository.jpa.RepositoryApplicationConfiguration;
|
||||||
import org.eclipse.hawkbit.repository.rsql.VirtualPropertyReplacer;
|
import org.eclipse.hawkbit.repository.rsql.VirtualPropertyReplacer;
|
||||||
import org.eclipse.hawkbit.repository.rsql.VirtualPropertyResolver;
|
import org.eclipse.hawkbit.repository.rsql.VirtualPropertyResolver;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||||
@@ -22,8 +22,8 @@ import org.springframework.context.annotation.Import;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@ConditionalOnClass({ EnableJpaRepository.class })
|
@ConditionalOnClass({ RepositoryApplicationConfiguration.class })
|
||||||
@Import({ EnableJpaRepository.class })
|
@Import({ RepositoryApplicationConfiguration.class })
|
||||||
public class JpaRepositoryAutoConfiguration {
|
public class JpaRepositoryAutoConfiguration {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -10,8 +10,11 @@ package org.eclipse.hawkbit.autoconfigure.security;
|
|||||||
|
|
||||||
import org.eclipse.hawkbit.im.authentication.PermissionService;
|
import org.eclipse.hawkbit.im.authentication.PermissionService;
|
||||||
import org.eclipse.hawkbit.security.DdiSecurityProperties;
|
import org.eclipse.hawkbit.security.DdiSecurityProperties;
|
||||||
|
import org.eclipse.hawkbit.security.HawkbitSecurityProperties;
|
||||||
import org.eclipse.hawkbit.security.SecurityContextTenantAware;
|
import org.eclipse.hawkbit.security.SecurityContextTenantAware;
|
||||||
|
import org.eclipse.hawkbit.security.SecurityTokenGenerator;
|
||||||
import org.eclipse.hawkbit.security.SpringSecurityAuditorAware;
|
import org.eclipse.hawkbit.security.SpringSecurityAuditorAware;
|
||||||
|
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
||||||
import org.eclipse.hawkbit.tenancy.TenantAware;
|
import org.eclipse.hawkbit.tenancy.TenantAware;
|
||||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
@@ -22,12 +25,9 @@ import org.springframework.data.domain.AuditorAware;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link EnableAutoConfiguration Auto-configuration} for security.
|
* {@link EnableAutoConfiguration Auto-configuration} for security.
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableConfigurationProperties(DdiSecurityProperties.class)
|
@EnableConfigurationProperties({ DdiSecurityProperties.class, HawkbitSecurityProperties.class })
|
||||||
public class SecurityAutoConfiguration {
|
public class SecurityAutoConfiguration {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -62,4 +62,24 @@ public class SecurityAutoConfiguration {
|
|||||||
return new SpringSecurityAuditorAware();
|
return new SpringSecurityAuditorAware();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param tenantAware
|
||||||
|
* singleton bean
|
||||||
|
* @return tenantAware {@link SystemSecurityContext}
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnMissingBean
|
||||||
|
public SystemSecurityContext systemSecurityContext(final TenantAware tenantAware) {
|
||||||
|
return new SystemSecurityContext(tenantAware);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {@link SecurityTokenGenerator} bean
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnMissingBean
|
||||||
|
public SecurityTokenGenerator securityTokenGenerator() {
|
||||||
|
return new SecurityTokenGenerator();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,19 +22,21 @@ import javax.servlet.ServletException;
|
|||||||
import javax.servlet.ServletRequest;
|
import javax.servlet.ServletRequest;
|
||||||
import javax.servlet.ServletResponse;
|
import javax.servlet.ServletResponse;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.ExcludePathAwareShallowETagFilter;
|
|
||||||
import org.eclipse.hawkbit.cache.DownloadIdCache;
|
import org.eclipse.hawkbit.cache.DownloadIdCache;
|
||||||
|
import org.eclipse.hawkbit.ddi.rest.resource.DdiApiConfiguration;
|
||||||
import org.eclipse.hawkbit.im.authentication.SpPermission;
|
import org.eclipse.hawkbit.im.authentication.SpPermission;
|
||||||
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
||||||
import org.eclipse.hawkbit.im.authentication.TenantUserPasswordAuthenticationToken;
|
import org.eclipse.hawkbit.im.authentication.TenantUserPasswordAuthenticationToken;
|
||||||
import org.eclipse.hawkbit.im.authentication.UserAuthenticationFilter;
|
import org.eclipse.hawkbit.im.authentication.UserAuthenticationFilter;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
||||||
|
import org.eclipse.hawkbit.mgmt.rest.resource.MgmtApiConfiguration;
|
||||||
import org.eclipse.hawkbit.repository.ControllerManagement;
|
import org.eclipse.hawkbit.repository.ControllerManagement;
|
||||||
import org.eclipse.hawkbit.repository.SystemManagement;
|
import org.eclipse.hawkbit.repository.SystemManagement;
|
||||||
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||||
import org.eclipse.hawkbit.security.ControllerTenantAwareAuthenticationDetailsSource;
|
import org.eclipse.hawkbit.security.ControllerTenantAwareAuthenticationDetailsSource;
|
||||||
import org.eclipse.hawkbit.security.DdiSecurityProperties;
|
import org.eclipse.hawkbit.security.DdiSecurityProperties;
|
||||||
import org.eclipse.hawkbit.security.DosFilter;
|
import org.eclipse.hawkbit.security.DosFilter;
|
||||||
|
import org.eclipse.hawkbit.security.ExcludePathAwareShallowETagFilter;
|
||||||
import org.eclipse.hawkbit.security.HawkbitSecurityProperties;
|
import org.eclipse.hawkbit.security.HawkbitSecurityProperties;
|
||||||
import org.eclipse.hawkbit.security.HttpControllerPreAuthenticateAnonymousDownloadFilter;
|
import org.eclipse.hawkbit.security.HttpControllerPreAuthenticateAnonymousDownloadFilter;
|
||||||
import org.eclipse.hawkbit.security.HttpControllerPreAuthenticateSecurityTokenFilter;
|
import org.eclipse.hawkbit.security.HttpControllerPreAuthenticateSecurityTokenFilter;
|
||||||
@@ -44,9 +46,11 @@ import org.eclipse.hawkbit.security.HttpDownloadAuthenticationFilter;
|
|||||||
import org.eclipse.hawkbit.security.PreAuthTokenSourceTrustAuthenticationProvider;
|
import org.eclipse.hawkbit.security.PreAuthTokenSourceTrustAuthenticationProvider;
|
||||||
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
||||||
import org.eclipse.hawkbit.tenancy.TenantAware;
|
import org.eclipse.hawkbit.tenancy.TenantAware;
|
||||||
|
import org.eclipse.hawkbit.ui.MgmtUiConfiguration;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
import org.springframework.boot.autoconfigure.security.SecurityProperties;
|
import org.springframework.boot.autoconfigure.security.SecurityProperties;
|
||||||
import org.springframework.boot.context.embedded.FilterRegistrationBean;
|
import org.springframework.boot.context.embedded.FilterRegistrationBean;
|
||||||
@@ -96,9 +100,6 @@ public class SecurityManagedConfiguration {
|
|||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(SecurityManagedConfiguration.class);
|
private static final Logger LOG = LoggerFactory.getLogger(SecurityManagedConfiguration.class);
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private HawkbitSecurityProperties securityProperties;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AuthenticationConfiguration configuration;
|
private AuthenticationConfiguration configuration;
|
||||||
|
|
||||||
@@ -131,6 +132,7 @@ public class SecurityManagedConfiguration {
|
|||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@Order(300)
|
@Order(300)
|
||||||
|
@ConditionalOnClass(DdiApiConfiguration.class)
|
||||||
static class ControllerSecurityConfigurationAdapter extends WebSecurityConfigurerAdapter {
|
static class ControllerSecurityConfigurationAdapter extends WebSecurityConfigurerAdapter {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -151,6 +153,26 @@ public class SecurityManagedConfiguration {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SystemSecurityContext systemSecurityContext;
|
private SystemSecurityContext systemSecurityContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter to protect the hawkBit server DDI interface against to many
|
||||||
|
* requests.
|
||||||
|
*
|
||||||
|
* @param securityProperties
|
||||||
|
* for filter configuration
|
||||||
|
*
|
||||||
|
* @return the spring filter registration bean for registering a denial
|
||||||
|
* of service protection filter in the filter chain
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnClass(DdiApiConfiguration.class)
|
||||||
|
public FilterRegistrationBean dosDDiFilter(final HawkbitSecurityProperties securityProperties) {
|
||||||
|
|
||||||
|
final FilterRegistrationBean filterRegBean = dosFilter(securityProperties);
|
||||||
|
filterRegBean.addUrlPatterns("/{tenant}/controller/v1/**");
|
||||||
|
|
||||||
|
return filterRegBean;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure(final HttpSecurity http) throws Exception {
|
protected void configure(final HttpSecurity http) throws Exception {
|
||||||
|
|
||||||
@@ -221,14 +243,26 @@ public class SecurityManagedConfiguration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter to protect the SP server against denial of service attacks.
|
* Filter to protect the hawkBit server system management interface against
|
||||||
|
* to many requests.
|
||||||
*
|
*
|
||||||
* @return he spring filter registration bean for registering an denial of
|
* @param securityProperties
|
||||||
|
* for filter configuration
|
||||||
|
*
|
||||||
|
* @return the spring filter registration bean for registering a denial of
|
||||||
* service protection filter in the filter chain
|
* service protection filter in the filter chain
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
@Order(50)
|
@Order(52)
|
||||||
public FilterRegistrationBean dosFilter() {
|
public FilterRegistrationBean dosSystemFilter(final HawkbitSecurityProperties securityProperties) {
|
||||||
|
|
||||||
|
final FilterRegistrationBean filterRegBean = dosFilter(securityProperties);
|
||||||
|
filterRegBean.addUrlPatterns("/system/*");
|
||||||
|
|
||||||
|
return filterRegBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static FilterRegistrationBean dosFilter(final HawkbitSecurityProperties securityProperties) {
|
||||||
|
|
||||||
final FilterRegistrationBean filterRegBean = new FilterRegistrationBean();
|
final FilterRegistrationBean filterRegBean = new FilterRegistrationBean();
|
||||||
|
|
||||||
@@ -236,7 +270,6 @@ public class SecurityManagedConfiguration {
|
|||||||
securityProperties.getDos().getFilter().getMaxWrite(),
|
securityProperties.getDos().getFilter().getMaxWrite(),
|
||||||
securityProperties.getDos().getFilter().getWhitelist(), securityProperties.getClients().getBlacklist(),
|
securityProperties.getDos().getFilter().getWhitelist(), securityProperties.getClients().getBlacklist(),
|
||||||
securityProperties.getClients().getRemoteIpHeader()));
|
securityProperties.getClients().getRemoteIpHeader()));
|
||||||
filterRegBean.addUrlPatterns("/{tenant}/controller/v1/*", "/rest/*");
|
|
||||||
|
|
||||||
return filterRegBean;
|
return filterRegBean;
|
||||||
}
|
}
|
||||||
@@ -268,6 +301,7 @@ public class SecurityManagedConfiguration {
|
|||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@Order(350)
|
@Order(350)
|
||||||
|
@ConditionalOnClass(MgmtApiConfiguration.class)
|
||||||
public static class RestSecurityConfigurationAdapter extends WebSecurityConfigurerAdapter {
|
public static class RestSecurityConfigurationAdapter extends WebSecurityConfigurerAdapter {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -276,15 +310,31 @@ public class SecurityManagedConfiguration {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SystemManagement systemManagement;
|
private SystemManagement systemManagement;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private TenantAware tenantAware;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SecurityProperties springSecurityProperties;
|
private SecurityProperties springSecurityProperties;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SystemSecurityContext systemSecurityContext;
|
private SystemSecurityContext systemSecurityContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter to protect the hawkBit server Management interface against to
|
||||||
|
* many requests.
|
||||||
|
*
|
||||||
|
* @param securityProperties
|
||||||
|
* for filter configuration
|
||||||
|
*
|
||||||
|
* @return the spring filter registration bean for registering a denial
|
||||||
|
* of service protection filter in the filter chain
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public FilterRegistrationBean dosMgmtFilter(final HawkbitSecurityProperties securityProperties) {
|
||||||
|
|
||||||
|
final FilterRegistrationBean filterRegBean = dosFilter(securityProperties);
|
||||||
|
filterRegBean.addUrlPatterns("/rest/**");
|
||||||
|
|
||||||
|
return filterRegBean;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure(final HttpSecurity http) throws Exception {
|
protected void configure(final HttpSecurity http) throws Exception {
|
||||||
|
|
||||||
@@ -330,6 +380,7 @@ public class SecurityManagedConfiguration {
|
|||||||
@Configuration
|
@Configuration
|
||||||
@Order(400)
|
@Order(400)
|
||||||
@EnableVaadinSecurity
|
@EnableVaadinSecurity
|
||||||
|
@ConditionalOnClass(MgmtUiConfiguration.class)
|
||||||
public static class UISecurityConfigurationAdapter extends WebSecurityConfigurerAdapter {
|
public static class UISecurityConfigurationAdapter extends WebSecurityConfigurerAdapter {
|
||||||
@Autowired
|
@Autowired
|
||||||
private VaadinSecurityContext vaadinSecurityContext;
|
private VaadinSecurityContext vaadinSecurityContext;
|
||||||
@@ -417,8 +468,7 @@ public class SecurityManagedConfiguration {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configure(final WebSecurity webSecurity) throws Exception {
|
public void configure(final WebSecurity webSecurity) throws Exception {
|
||||||
webSecurity.ignoring().antMatchers("/documentation/**", "/VAADIN/**", "/*.*", "/v2/api-docs/**",
|
webSecurity.ignoring().antMatchers("/documentation/**", "/VAADIN/**", "/*.*", "/docs/**");
|
||||||
"/docs/**");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -428,6 +478,7 @@ public class SecurityManagedConfiguration {
|
|||||||
@Configuration
|
@Configuration
|
||||||
@EnableWebSecurity
|
@EnableWebSecurity
|
||||||
@Order(200)
|
@Order(200)
|
||||||
|
@ConditionalOnClass(DdiApiConfiguration.class)
|
||||||
public static class IdRestSecurityConfigurationAdapter extends WebSecurityConfigurerAdapter {
|
public static class IdRestSecurityConfigurationAdapter extends WebSecurityConfigurerAdapter {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|||||||
@@ -11,14 +11,17 @@ package org.eclipse.hawkbit.autoconfigure.ui;
|
|||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.DistributedResourceBundleMessageSource;
|
import org.eclipse.hawkbit.DistributedResourceBundleMessageSource;
|
||||||
|
import org.eclipse.hawkbit.ui.MgmtUiConfiguration;
|
||||||
import org.eclipse.hawkbit.ui.push.DelayedEventBusPushStrategy;
|
import org.eclipse.hawkbit.ui.push.DelayedEventBusPushStrategy;
|
||||||
import org.eclipse.hawkbit.ui.push.EventPushStrategy;
|
import org.eclipse.hawkbit.ui.push.EventPushStrategy;
|
||||||
import org.eclipse.hawkbit.ui.push.HawkbitEventProvider;
|
import org.eclipse.hawkbit.ui.push.HawkbitEventProvider;
|
||||||
import org.eclipse.hawkbit.ui.push.UIEventProvider;
|
import org.eclipse.hawkbit.ui.push.UIEventProvider;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
import org.springframework.context.ConfigurableApplicationContext;
|
import org.springframework.context.ConfigurableApplicationContext;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
import org.vaadin.spring.annotation.EnableVaadinExtensions;
|
import org.vaadin.spring.annotation.EnableVaadinExtensions;
|
||||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
import org.vaadin.spring.events.annotation.EnableEventBus;
|
import org.vaadin.spring.events.annotation.EnableEventBus;
|
||||||
@@ -33,6 +36,8 @@ import com.vaadin.spring.annotation.UIScope;
|
|||||||
@EnableVaadinSecurity
|
@EnableVaadinSecurity
|
||||||
@EnableVaadinExtensions
|
@EnableVaadinExtensions
|
||||||
@EnableEventBus
|
@EnableEventBus
|
||||||
|
@ConditionalOnClass(MgmtUiConfiguration.class)
|
||||||
|
@Import(MgmtUiConfiguration.class)
|
||||||
public class UIAutoConfiguration {
|
public class UIAutoConfiguration {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -8,19 +8,18 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.autoconfigure.web;
|
package org.eclipse.hawkbit.autoconfigure.web;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.ddi.EnableDdiApi;
|
import org.eclipse.hawkbit.ddi.rest.resource.DdiApiConfiguration;
|
||||||
import org.eclipse.hawkbit.mgmt.EnableMgmtApi;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Auto-Configuration for enabling the REST-Resources.
|
* Auto-Configuration for enabling the DDI REST-Resources.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@ConditionalOnClass({ EnableDdiApi.class, EnableMgmtApi.class })
|
@ConditionalOnClass(DdiApiConfiguration.class)
|
||||||
@Import({ EnableDdiApi.class, EnableMgmtApi.class })
|
@Import(DdiApiConfiguration.class)
|
||||||
public class ResourceControllerAutoConfiguration {
|
public class DDiApiAutoConfiguration {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
/**
|
||||||
|
* 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.autoconfigure.web;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.mgmt.rest.resource.MgmtApiConfiguration;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-Configuration for enabling the Management API REST-Resources.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@ConditionalOnClass(MgmtApiConfiguration.class)
|
||||||
|
@Import(MgmtApiConfiguration.class)
|
||||||
|
public class MgmtApiAutoConfiguration {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -18,8 +18,6 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
|
|||||||
* from Spring because it will truncate the dot in a REST URL which leads to
|
* from Spring because it will truncate the dot in a REST URL which leads to
|
||||||
* problem in case a controllerId contains dots and is a path parameter or
|
* problem in case a controllerId contains dots and is a path parameter or
|
||||||
* filename ending.
|
* filename ending.
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
public class WebMvcAutoConfiguration extends WebMvcConfigurerAdapter {
|
public class WebMvcAutoConfiguration extends WebMvcConfigurerAdapter {
|
||||||
|
|||||||
@@ -5,11 +5,14 @@ org.eclipse.hawkbit.autoconfigure.ui.UIAutoConfiguration,\
|
|||||||
org.eclipse.hawkbit.autoconfigure.security.SecurityAutoConfiguration,\
|
org.eclipse.hawkbit.autoconfigure.security.SecurityAutoConfiguration,\
|
||||||
org.eclipse.hawkbit.autoconfigure.url.PropertyHostnameResolverAutoConfiguration,\
|
org.eclipse.hawkbit.autoconfigure.url.PropertyHostnameResolverAutoConfiguration,\
|
||||||
org.eclipse.hawkbit.autoconfigure.web.WebMvcAutoConfiguration,\
|
org.eclipse.hawkbit.autoconfigure.web.WebMvcAutoConfiguration,\
|
||||||
|
org.eclipse.hawkbit.autoconfigure.web.DDiApiAutoConfiguration,\
|
||||||
|
org.eclipse.hawkbit.autoconfigure.web.MgmtApiAutoConfiguration,\
|
||||||
org.eclipse.hawkbit.autoconfigure.cache.CacheAutoConfiguration,\
|
org.eclipse.hawkbit.autoconfigure.cache.CacheAutoConfiguration,\
|
||||||
org.eclipse.hawkbit.autoconfigure.cache.DownloadIdCacheAutoConfiguration,\
|
org.eclipse.hawkbit.autoconfigure.cache.DownloadIdCacheAutoConfiguration,\
|
||||||
org.eclipse.hawkbit.autoconfigure.event.EventPublisherAutoConfiguration,\
|
org.eclipse.hawkbit.autoconfigure.event.EventPublisherAutoConfiguration,\
|
||||||
org.eclipse.hawkbit.autoconfigure.scheduling.AsyncConfigurerAutoConfiguration,\
|
org.eclipse.hawkbit.autoconfigure.scheduling.AsyncConfigurerAutoConfiguration,\
|
||||||
org.eclipse.hawkbit.autoconfigure.scheduling.ExecutorAutoConfiguration,\
|
org.eclipse.hawkbit.autoconfigure.scheduling.ExecutorAutoConfiguration,\
|
||||||
org.eclipse.hawkbit.autoconfigure.amqp.AmqpAutoConfiguration,\
|
org.eclipse.hawkbit.autoconfigure.amqp.DmfApiAutoConfiguration,\
|
||||||
org.eclipse.hawkbit.autoconfigure.security.InMemoryUserManagementConfiguration,\
|
org.eclipse.hawkbit.autoconfigure.security.InMemoryUserManagementConfiguration,\
|
||||||
org.eclipse.hawkbit.autoconfigure.repository.ArtifactStoreAutoConfiguration
|
org.eclipse.hawkbit.autoconfigure.repository.ArtifactFilesystemAutoConfiguration,\
|
||||||
|
org.eclipse.hawkbit.autoconfigure.repository.JpaRepositoryAutoConfiguration
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import java.io.Serializable;
|
|||||||
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
|
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.context.EnvironmentAware;
|
import org.springframework.context.EnvironmentAware;
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines global configuration for the controllers/clients on the provisioning
|
* Defines global configuration for the controllers/clients on the provisioning
|
||||||
@@ -25,7 +24,6 @@ import org.springframework.stereotype.Component;
|
|||||||
* {@link TenantConfigurationKey} and injected using {@link EnvironmentAware}.
|
* {@link TenantConfigurationKey} and injected using {@link EnvironmentAware}.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Component
|
|
||||||
@ConfigurationProperties(prefix = "hawkbit.controller")
|
@ConfigurationProperties(prefix = "hawkbit.controller")
|
||||||
public class ControllerPollProperties implements Serializable {
|
public class ControllerPollProperties implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ public interface ArtifactRepository {
|
|||||||
* @param contentType
|
* @param contentType
|
||||||
* the content type of the artifact
|
* the content type of the artifact
|
||||||
* @return the stored artifact
|
* @return the stored artifact
|
||||||
|
*
|
||||||
|
* @throws MethodNotSupportedException
|
||||||
|
* if implementation does not support the operation
|
||||||
* @throws ArtifactStoreException
|
* @throws ArtifactStoreException
|
||||||
* in case storing of the artifact was not successful
|
* in case storing of the artifact was not successful
|
||||||
*/
|
*/
|
||||||
@@ -51,6 +54,9 @@ public interface ArtifactRepository {
|
|||||||
* the hashes of the artifact to do hash-checks after storing the
|
* the hashes of the artifact to do hash-checks after storing the
|
||||||
* artifact, might be {@code null}
|
* artifact, might be {@code null}
|
||||||
* @return the stored artifact
|
* @return the stored artifact
|
||||||
|
*
|
||||||
|
* @throws MethodNotSupportedException
|
||||||
|
* if implementation does not support the operation
|
||||||
* @throws ArtifactStoreException
|
* @throws ArtifactStoreException
|
||||||
* in case storing of the artifact was not successful
|
* in case storing of the artifact was not successful
|
||||||
* @throws HashNotMatchException
|
* @throws HashNotMatchException
|
||||||
@@ -62,8 +68,12 @@ public interface ArtifactRepository {
|
|||||||
/**
|
/**
|
||||||
* Deletes an artifact by its SHA1 hash.
|
* Deletes an artifact by its SHA1 hash.
|
||||||
*
|
*
|
||||||
|
*
|
||||||
* @param sha1Hash
|
* @param sha1Hash
|
||||||
* the sha1-hash of the artifact to delete
|
* the sha1-hash of the artifact to delete
|
||||||
|
*
|
||||||
|
* @throws MethodNotSupportedException
|
||||||
|
* if implementation does not support the operation
|
||||||
*/
|
*/
|
||||||
void deleteBySha1(final String sha1Hash);
|
void deleteBySha1(final String sha1Hash);
|
||||||
|
|
||||||
@@ -73,6 +83,9 @@ public interface ArtifactRepository {
|
|||||||
* @param sha1Hash
|
* @param sha1Hash
|
||||||
* the sha1-hash of the file to lookup.
|
* the sha1-hash of the file to lookup.
|
||||||
* @return The artifact file object or {@code null} if no file exists.
|
* @return The artifact file object or {@code null} if no file exists.
|
||||||
|
*
|
||||||
|
* @throws MethodNotSupportedException
|
||||||
|
* if implementation does not support the operation
|
||||||
*/
|
*/
|
||||||
DbArtifact getArtifactBySha1(String sha1);
|
DbArtifact getArtifactBySha1(String sha1Hash);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -169,7 +169,12 @@ public enum SpServerError {
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
SP_ROLLOUT_VERIFICATION_FAILED("hawkbit.server.error.rollout.verificationFailed", "The rollout configuration could not be verified successfully");
|
SP_ROLLOUT_VERIFICATION_FAILED("hawkbit.server.error.rollout.verificationFailed", "The rollout configuration could not be verified successfully"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
SP_REPO_OPERATION_NOT_SUPPORTED("hawkbit.server.error.operation.notSupported", "Operation or method is (no longer) supported by service.");
|
||||||
|
|
||||||
private final String key;
|
private final String key;
|
||||||
private final String message;
|
private final String message;
|
||||||
|
|||||||
@@ -45,6 +45,11 @@
|
|||||||
<groupId>org.springframework.plugin</groupId>
|
<groupId>org.springframework.plugin</groupId>
|
||||||
<artifactId>spring-plugin-core</artifactId>
|
<artifactId>spring-plugin-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<!-- Test -->
|
<!-- Test -->
|
||||||
|
|||||||
@@ -6,28 +6,22 @@
|
|||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ddi;
|
package org.eclipse.hawkbit.ddi.rest.resource;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import org.eclipse.hawkbit.rest.RestConfiguration;
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
import org.eclipse.hawkbit.rest.configuration.RestConfiguration;
|
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Annotation to enable {@link ComponentScan} in the resource package to setup
|
* Enable {@link ComponentScan} in the resource package to setup all
|
||||||
* all {@link Controller} annotated classes and setup the Direct Device API.
|
* {@link Controller} annotated classes and setup the REST-Resources for the
|
||||||
|
* Direct Device Integration API.
|
||||||
*/
|
*/
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@ComponentScan
|
@ComponentScan
|
||||||
@Import(RestConfiguration.class)
|
@Import(RestConfiguration.class)
|
||||||
public @interface EnableDdiApi {
|
public class DdiApiConfiguration {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
/**
|
||||||
|
* 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.ddi.rest.resource;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.rest.AbstractRestIntegrationTest;
|
||||||
|
import org.springframework.boot.test.SpringApplicationConfiguration;
|
||||||
|
|
||||||
|
@SpringApplicationConfiguration(classes = { DdiApiConfiguration.class })
|
||||||
|
public abstract class AbstractDDiApiIntegrationTest extends AbstractRestIntegrationTest {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -38,7 +38,6 @@ import org.eclipse.hawkbit.repository.model.DistributionSet;
|
|||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
import org.eclipse.hawkbit.repository.test.util.TestdataFactory;
|
import org.eclipse.hawkbit.repository.test.util.TestdataFactory;
|
||||||
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
||||||
import org.eclipse.hawkbit.rest.AbstractRestIntegrationTest;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.boot.test.SpringApplicationConfiguration;
|
import org.springframework.boot.test.SpringApplicationConfiguration;
|
||||||
@@ -63,7 +62,7 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
|||||||
@Features("Component Tests - Direct Device Integration API")
|
@Features("Component Tests - Direct Device Integration API")
|
||||||
@Stories("Artifact Download Resource")
|
@Stories("Artifact Download Resource")
|
||||||
@SpringApplicationConfiguration(classes = DownloadTestConfiguration.class)
|
@SpringApplicationConfiguration(classes = DownloadTestConfiguration.class)
|
||||||
public class DdiArtifactDownloadTest extends AbstractRestIntegrationTest {
|
public class DdiArtifactDownloadTest extends AbstractDDiApiIntegrationTest {
|
||||||
|
|
||||||
private static final int ARTIFACT_SIZE = 5 * 1024 * 1024;
|
private static final int ARTIFACT_SIZE = 5 * 1024 * 1024;
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ import org.eclipse.hawkbit.repository.model.Action.Status;
|
|||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
import org.eclipse.hawkbit.repository.test.util.TestdataFactory;
|
import org.eclipse.hawkbit.repository.test.util.TestdataFactory;
|
||||||
import org.eclipse.hawkbit.rest.AbstractRestIntegrationTest;
|
|
||||||
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
||||||
import org.eclipse.hawkbit.rest.util.MockMvcResultPrinter;
|
import org.eclipse.hawkbit.rest.util.MockMvcResultPrinter;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -43,7 +42,7 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
|||||||
*/
|
*/
|
||||||
@Features("Component Tests - Direct Device Integration API")
|
@Features("Component Tests - Direct Device Integration API")
|
||||||
@Stories("Cancel Action Resource")
|
@Stories("Cancel Action Resource")
|
||||||
public class DdiCancelActionTest extends AbstractRestIntegrationTest {
|
public class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Test of the controller can continue a started update even after a cancel command if it so desires.")
|
@Description("Test of the controller can continue a started update even after a cancel command if it so desires.")
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
import org.eclipse.hawkbit.rest.AbstractRestIntegrationTest;
|
|
||||||
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
||||||
import org.eclipse.hawkbit.rest.util.MockMvcResultPrinter;
|
import org.eclipse.hawkbit.rest.util.MockMvcResultPrinter;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -40,7 +39,7 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
|||||||
@ActiveProfiles({ "im", "test" })
|
@ActiveProfiles({ "im", "test" })
|
||||||
@Features("Component Tests - Direct Device Integration API")
|
@Features("Component Tests - Direct Device Integration API")
|
||||||
@Stories("Config Data Resource")
|
@Stories("Config Data Resource")
|
||||||
public class DdiConfigDataTest extends AbstractRestIntegrationTest {
|
public class DdiConfigDataTest extends AbstractDDiApiIntegrationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("We verify that the config data (i.e. device attributes like serial number, hardware revision etc.) "
|
@Description("We verify that the config data (i.e. device attributes like serial number, hardware revision etc.) "
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ import org.eclipse.hawkbit.repository.model.DistributionSetAssignmentResult;
|
|||||||
import org.eclipse.hawkbit.repository.model.RepositoryModelConstants;
|
import org.eclipse.hawkbit.repository.model.RepositoryModelConstants;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||||
import org.eclipse.hawkbit.rest.AbstractRestIntegrationTest;
|
|
||||||
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
||||||
import org.eclipse.hawkbit.rest.util.MockMvcResultPrinter;
|
import org.eclipse.hawkbit.rest.util.MockMvcResultPrinter;
|
||||||
import org.fest.assertions.core.Condition;
|
import org.fest.assertions.core.Condition;
|
||||||
@@ -59,7 +58,7 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
|||||||
*/
|
*/
|
||||||
@Features("Component Tests - Direct Device Integration API")
|
@Features("Component Tests - Direct Device Integration API")
|
||||||
@Stories("Deployment Action Resource")
|
@Stories("Deployment Action Resource")
|
||||||
public class DdiDeploymentBaseTest extends AbstractRestIntegrationTest {
|
public class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
|
||||||
|
|
||||||
private static final String HTTP_LOCALHOST = "http://localhost:8080/";
|
private static final String HTTP_LOCALHOST = "http://localhost:8080/";
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ import org.eclipse.hawkbit.repository.test.matcher.Expect;
|
|||||||
import org.eclipse.hawkbit.repository.test.matcher.ExpectEvents;
|
import org.eclipse.hawkbit.repository.test.matcher.ExpectEvents;
|
||||||
import org.eclipse.hawkbit.repository.test.util.WithSpringAuthorityRule;
|
import org.eclipse.hawkbit.repository.test.util.WithSpringAuthorityRule;
|
||||||
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
||||||
import org.eclipse.hawkbit.rest.AbstractRestIntegrationTest;
|
|
||||||
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
||||||
import org.eclipse.hawkbit.rest.util.MockMvcResultPrinter;
|
import org.eclipse.hawkbit.rest.util.MockMvcResultPrinter;
|
||||||
import org.eclipse.hawkbit.security.HawkbitSecurityProperties;
|
import org.eclipse.hawkbit.security.HawkbitSecurityProperties;
|
||||||
@@ -58,7 +57,7 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
|||||||
*/
|
*/
|
||||||
@Features("Component Tests - Direct Device Integration API")
|
@Features("Component Tests - Direct Device Integration API")
|
||||||
@Stories("Root Poll Resource")
|
@Stories("Root Poll Resource")
|
||||||
public class DdiRootControllerTest extends AbstractRestIntegrationTest {
|
public class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private HawkbitSecurityProperties securityProperties;
|
private HawkbitSecurityProperties securityProperties;
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import java.util.List;
|
|||||||
import org.eclipse.hawkbit.repository.model.Action;
|
import org.eclipse.hawkbit.repository.model.Action;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
import org.eclipse.hawkbit.rest.AbstractRestIntegrationTest;
|
|
||||||
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -40,7 +39,7 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
|||||||
@ActiveProfiles({ "test" })
|
@ActiveProfiles({ "test" })
|
||||||
@Features("Component Tests - REST Security")
|
@Features("Component Tests - REST Security")
|
||||||
@Stories("Denial of Service protection filter")
|
@Stories("Denial of Service protection filter")
|
||||||
public class DosFilterTest extends AbstractRestIntegrationTest {
|
public class DosFilterTest extends AbstractDDiApiIntegrationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Ensures that clients that are on the blacklist are forbidded ")
|
@Description("Ensures that clients that are on the blacklist are forbidded ")
|
||||||
|
|||||||
@@ -6,24 +6,18 @@
|
|||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.amqp.annotation;
|
package org.eclipse.hawkbit.amqp;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
import java.lang.annotation.Retention;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
import org.eclipse.hawkbit.amqp.AmqpConfiguration;
|
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Annotation to enable amqp.
|
* Enable Device Management Federation API.
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Target(ElementType.TYPE)
|
@Configuration
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@ComponentScan
|
||||||
@Import(AmqpConfiguration.class)
|
@Import(AmqpConfiguration.class)
|
||||||
public @interface EnableAmqp {
|
public class DmfApiConfiguration {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,7 @@ import org.eclipse.hawkbit.dmf.json.model.DownloadAndUpdateRequest;
|
|||||||
import org.eclipse.hawkbit.repository.SystemManagement;
|
import org.eclipse.hawkbit.repository.SystemManagement;
|
||||||
import org.eclipse.hawkbit.repository.event.remote.TargetAssignDistributionSetEvent;
|
import org.eclipse.hawkbit.repository.event.remote.TargetAssignDistributionSetEvent;
|
||||||
import org.eclipse.hawkbit.repository.event.remote.entity.CancelTargetAssignmentEvent;
|
import org.eclipse.hawkbit.repository.event.remote.entity.CancelTargetAssignmentEvent;
|
||||||
import org.eclipse.hawkbit.repository.jpa.ActionRepository;
|
import org.eclipse.hawkbit.repository.jpa.RepositoryApplicationConfiguration;
|
||||||
import org.eclipse.hawkbit.repository.model.Action;
|
import org.eclipse.hawkbit.repository.model.Action;
|
||||||
import org.eclipse.hawkbit.repository.model.Artifact;
|
import org.eclipse.hawkbit.repository.model.Artifact;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
@@ -50,7 +50,6 @@ import org.springframework.amqp.core.MessageProperties;
|
|||||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
import org.springframework.amqp.support.converter.AbstractJavaTypeMapper;
|
import org.springframework.amqp.support.converter.AbstractJavaTypeMapper;
|
||||||
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
|
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.test.SpringApplicationConfiguration;
|
import org.springframework.boot.test.SpringApplicationConfiguration;
|
||||||
import org.springframework.test.context.ActiveProfiles;
|
import org.springframework.test.context.ActiveProfiles;
|
||||||
|
|
||||||
@@ -63,7 +62,7 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
|||||||
@ActiveProfiles({ "test" })
|
@ActiveProfiles({ "test" })
|
||||||
@Features("Component Tests - Device Management Federation API")
|
@Features("Component Tests - Device Management Federation API")
|
||||||
@Stories("AmqpMessage Dispatcher Service Test")
|
@Stories("AmqpMessage Dispatcher Service Test")
|
||||||
@SpringApplicationConfiguration(classes = { org.eclipse.hawkbit.RepositoryApplicationConfiguration.class })
|
@SpringApplicationConfiguration(classes = { RepositoryApplicationConfiguration.class })
|
||||||
public class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTest {
|
public class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTest {
|
||||||
|
|
||||||
private static final String TENANT = "default";
|
private static final String TENANT = "default";
|
||||||
@@ -73,21 +72,16 @@ public class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTest {
|
|||||||
|
|
||||||
private static final String TEST_TOKEN = "testToken";
|
private static final String TEST_TOKEN = "testToken";
|
||||||
|
|
||||||
|
private static final String CONTROLLER_ID = "1";
|
||||||
|
|
||||||
private AmqpMessageDispatcherService amqpMessageDispatcherService;
|
private AmqpMessageDispatcherService amqpMessageDispatcherService;
|
||||||
|
|
||||||
private RabbitTemplate rabbitTemplate;
|
private RabbitTemplate rabbitTemplate;
|
||||||
|
|
||||||
private DefaultAmqpSenderService senderService;
|
private DefaultAmqpSenderService senderService;
|
||||||
|
|
||||||
private SystemManagement systemManagement;
|
|
||||||
|
|
||||||
private static final String CONTROLLER_ID = "1";
|
|
||||||
|
|
||||||
private Target testTarget;
|
private Target testTarget;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
protected ActionRepository actionRepository;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void before() throws Exception {
|
public void before() throws Exception {
|
||||||
super.before();
|
super.before();
|
||||||
|
|||||||
@@ -35,6 +35,11 @@
|
|||||||
<artifactId>hawkbit-security-integration</artifactId>
|
<artifactId>hawkbit-security-integration</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Test -->
|
<!-- Test -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -44,6 +44,11 @@
|
|||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-context</artifactId>
|
<artifactId>spring-context</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Test -->
|
<!-- Test -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -6,29 +6,22 @@
|
|||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt;
|
package org.eclipse.hawkbit.mgmt.rest.resource;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import org.eclipse.hawkbit.rest.RestConfiguration;
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
import org.eclipse.hawkbit.rest.configuration.RestConfiguration;
|
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Annotation to enable {@link ComponentScan} in the resource package to setup
|
* Enable {@link ComponentScan} in the resource package to setup all
|
||||||
* all {@link Controller} annotated classes and setup the REST-Resources for the
|
* {@link Controller} annotated classes and setup the REST-Resources for the
|
||||||
* Management API.
|
* Management API.
|
||||||
*/
|
*/
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@ComponentScan
|
@ComponentScan
|
||||||
@Import(RestConfiguration.class)
|
@Import(RestConfiguration.class)
|
||||||
public @interface EnableMgmtApi {
|
public class MgmtApiConfiguration {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
/**
|
||||||
|
* 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.mgmt.rest.resource;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.rest.AbstractRestIntegrationTest;
|
||||||
|
import org.springframework.boot.test.SpringApplicationConfiguration;
|
||||||
|
|
||||||
|
@SpringApplicationConfiguration(classes = { MgmtApiConfiguration.class })
|
||||||
|
public abstract class AbstractManagementApiIntegrationTest extends AbstractRestIntegrationTest {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -39,7 +39,6 @@ import org.eclipse.hawkbit.repository.model.Target;
|
|||||||
import org.eclipse.hawkbit.repository.model.TargetWithActionType;
|
import org.eclipse.hawkbit.repository.model.TargetWithActionType;
|
||||||
import org.eclipse.hawkbit.repository.test.util.TestdataFactory;
|
import org.eclipse.hawkbit.repository.test.util.TestdataFactory;
|
||||||
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
||||||
import org.eclipse.hawkbit.rest.AbstractRestIntegrationTest;
|
|
||||||
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
||||||
import org.eclipse.hawkbit.rest.util.MockMvcResultPrinter;
|
import org.eclipse.hawkbit.rest.util.MockMvcResultPrinter;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
@@ -59,7 +58,7 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
|||||||
|
|
||||||
@Features("Component Tests - Management API")
|
@Features("Component Tests - Management API")
|
||||||
@Stories("Distribution Set Resource")
|
@Stories("Distribution Set Resource")
|
||||||
public class MgmtDistributionSetResourceTest extends AbstractRestIntegrationTest {
|
public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("This test verifies the call of all Software Modules that are assiged to a Distribution Set through the RESTful API.")
|
@Description("This test verifies the call of all Software Modules that are assiged to a Distribution Set through the RESTful API.")
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
|||||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||||
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
||||||
import org.eclipse.hawkbit.rest.AbstractRestIntegrationTest;
|
|
||||||
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
||||||
import org.eclipse.hawkbit.rest.util.MockMvcResultPrinter;
|
import org.eclipse.hawkbit.rest.util.MockMvcResultPrinter;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
@@ -53,7 +52,7 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
|||||||
*/
|
*/
|
||||||
@Features("Component Tests - Management API")
|
@Features("Component Tests - Management API")
|
||||||
@Stories("Distribution Set Type Resource")
|
@Stories("Distribution Set Type Resource")
|
||||||
public class MgmtDistributionSetTypeResourceTest extends AbstractRestIntegrationTest {
|
public class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@WithUser(principal = "uploadTester", allSpPermissions = true)
|
@WithUser(principal = "uploadTester", allSpPermissions = true)
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
|||||||
import org.eclipse.hawkbit.repository.model.Artifact;
|
import org.eclipse.hawkbit.repository.model.Artifact;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
import org.eclipse.hawkbit.rest.AbstractRestIntegrationTest;
|
|
||||||
import org.eclipse.hawkbit.rest.util.MockMvcResultPrinter;
|
import org.eclipse.hawkbit.rest.util.MockMvcResultPrinter;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -30,7 +29,7 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
|||||||
|
|
||||||
@Features("Component Tests - Management API")
|
@Features("Component Tests - Management API")
|
||||||
@Stories("Download Resource")
|
@Stories("Download Resource")
|
||||||
public class MgmtDownloadResourceTest extends AbstractRestIntegrationTest {
|
public class MgmtDownloadResourceTest extends AbstractManagementApiIntegrationTest {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DownloadIdCache downloadIdCache;
|
private DownloadIdCache downloadIdCache;
|
||||||
@@ -44,7 +43,7 @@ public class MgmtDownloadResourceTest extends AbstractRestIntegrationTest {
|
|||||||
|
|
||||||
final DistributionSet distributionSet = testdataFactory.createDistributionSet("Test");
|
final DistributionSet distributionSet = testdataFactory.createDistributionSet("Test");
|
||||||
final SoftwareModule softwareModule = distributionSet.getModules().stream().findFirst().get();
|
final SoftwareModule softwareModule = distributionSet.getModules().stream().findFirst().get();
|
||||||
final Artifact artifact = testdataFactory.createArtifacts(softwareModule.getId()).stream().findFirst().get();
|
final Artifact artifact = testdataFactory.createArtifacts(softwareModule.getId()).stream().findFirst().get();
|
||||||
|
|
||||||
downloadIdCache.put(downloadIdSha1, new DownloadArtifactCache(DownloadType.BY_SHA1, artifact.getSha1Hash()));
|
downloadIdCache.put(downloadIdSha1, new DownloadArtifactCache(DownloadType.BY_SHA1, artifact.getSha1Hash()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ import org.eclipse.hawkbit.repository.model.RolloutGroupConditionBuilder;
|
|||||||
import org.eclipse.hawkbit.repository.model.RolloutGroupConditions;
|
import org.eclipse.hawkbit.repository.model.RolloutGroupConditions;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
||||||
import org.eclipse.hawkbit.rest.AbstractRestIntegrationTest;
|
|
||||||
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
||||||
import org.eclipse.hawkbit.rest.util.MockMvcResultPrinter;
|
import org.eclipse.hawkbit.rest.util.MockMvcResultPrinter;
|
||||||
import org.eclipse.hawkbit.rest.util.SuccessCondition;
|
import org.eclipse.hawkbit.rest.util.SuccessCondition;
|
||||||
@@ -59,7 +58,7 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
|||||||
*/
|
*/
|
||||||
@Features("Component Tests - Management API")
|
@Features("Component Tests - Management API")
|
||||||
@Stories("Rollout Resource")
|
@Stories("Rollout Resource")
|
||||||
public class MgmtRolloutResourceTest extends AbstractRestIntegrationTest {
|
public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||||
|
|
||||||
private static final String HREF_ROLLOUT_PREFIX = "http://localhost/rest/v1/rollouts/";
|
private static final String HREF_ROLLOUT_PREFIX = "http://localhost/rest/v1/rollouts/";
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
|||||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
|
import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
|
||||||
import org.eclipse.hawkbit.repository.test.util.HashGeneratorUtils;
|
import org.eclipse.hawkbit.repository.test.util.HashGeneratorUtils;
|
||||||
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
||||||
import org.eclipse.hawkbit.rest.AbstractRestIntegrationTest;
|
|
||||||
import org.eclipse.hawkbit.rest.json.model.ExceptionInfo;
|
import org.eclipse.hawkbit.rest.json.model.ExceptionInfo;
|
||||||
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
||||||
import org.eclipse.hawkbit.rest.util.MockMvcResultPrinter;
|
import org.eclipse.hawkbit.rest.util.MockMvcResultPrinter;
|
||||||
@@ -71,7 +70,7 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
|||||||
*/
|
*/
|
||||||
@Features("Component Tests - Management API")
|
@Features("Component Tests - Management API")
|
||||||
@Stories("Software Module Resource")
|
@Stories("Software Module Resource")
|
||||||
public class MgmtSoftwareModuleResourceTest extends AbstractRestIntegrationTest {
|
public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTest {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void assertPreparationOfRepo() {
|
public void assertPreparationOfRepo() {
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ import org.apache.commons.lang3.RandomStringUtils;
|
|||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||||
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
||||||
import org.eclipse.hawkbit.rest.AbstractRestIntegrationTest;
|
|
||||||
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
||||||
import org.eclipse.hawkbit.rest.util.MockMvcResultPrinter;
|
import org.eclipse.hawkbit.rest.util.MockMvcResultPrinter;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
@@ -50,7 +49,7 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
|||||||
*/
|
*/
|
||||||
@Features("Component Tests - Management API")
|
@Features("Component Tests - Management API")
|
||||||
@Stories("Software Module Type Resource")
|
@Stories("Software Module Type Resource")
|
||||||
public class MgmtSoftwareModuleTypeResourceTest extends AbstractRestIntegrationTest {
|
public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiIntegrationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@WithUser(principal = "uploadTester", allSpPermissions = true)
|
@WithUser(principal = "uploadTester", allSpPermissions = true)
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import org.eclipse.hawkbit.exception.SpServerError;
|
|||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
||||||
import org.eclipse.hawkbit.rest.AbstractRestIntegrationTest;
|
|
||||||
import org.eclipse.hawkbit.rest.exception.MessageNotReadableException;
|
import org.eclipse.hawkbit.rest.exception.MessageNotReadableException;
|
||||||
import org.eclipse.hawkbit.rest.json.model.ExceptionInfo;
|
import org.eclipse.hawkbit.rest.json.model.ExceptionInfo;
|
||||||
import org.eclipse.hawkbit.rest.util.MockMvcResultPrinter;
|
import org.eclipse.hawkbit.rest.util.MockMvcResultPrinter;
|
||||||
@@ -42,7 +41,7 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
|||||||
*/
|
*/
|
||||||
@Features("Component Tests - Management API")
|
@Features("Component Tests - Management API")
|
||||||
@Stories("Target Filter Query Resource")
|
@Stories("Target Filter Query Resource")
|
||||||
public class MgmtTargetFilterQueryResourceTest extends AbstractRestIntegrationTest {
|
public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiIntegrationTest {
|
||||||
|
|
||||||
private static final String JSON_PATH_ROOT = "$";
|
private static final String JSON_PATH_ROOT = "$";
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ import org.eclipse.hawkbit.repository.model.DistributionSet;
|
|||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
||||||
import org.eclipse.hawkbit.rest.AbstractRestIntegrationTest;
|
|
||||||
import org.eclipse.hawkbit.rest.exception.MessageNotReadableException;
|
import org.eclipse.hawkbit.rest.exception.MessageNotReadableException;
|
||||||
import org.eclipse.hawkbit.rest.json.model.ExceptionInfo;
|
import org.eclipse.hawkbit.rest.json.model.ExceptionInfo;
|
||||||
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
import org.eclipse.hawkbit.rest.util.JsonBuilder;
|
||||||
@@ -73,7 +72,7 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
|||||||
*/
|
*/
|
||||||
@Features("Component Tests - Management API")
|
@Features("Component Tests - Management API")
|
||||||
@Stories("Target Resource")
|
@Stories("Target Resource")
|
||||||
public class MgmtTargetResourceTest extends AbstractRestIntegrationTest {
|
public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||||
|
|
||||||
private static final String TARGET_DESCRIPTION_TEST = "created in test";
|
private static final String TARGET_DESCRIPTION_TEST = "created in test";
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,12 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>spring-cloud-bus</artifactId>
|
<artifactId>spring-cloud-bus</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Optional -->
|
<!-- Optional -->
|
||||||
|
|||||||
@@ -24,11 +24,16 @@ public class AutoAssignProperties {
|
|||||||
public static final String PROP_SCHEDULER_DELAY_PLACEHOLDER = "${hawkbit.autoassign.scheduler.fixedDelay:60000}";
|
public static final String PROP_SCHEDULER_DELAY_PLACEHOLDER = "${hawkbit.autoassign.scheduler.fixedDelay:60000}";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schedule where the autoassign scheduler looks necessary state changes in
|
* Schedule where the autoassign scheduler looks necessary state changes
|
||||||
* milliseconds.
|
* in milliseconds.
|
||||||
*/
|
*/
|
||||||
private long fixedDelay = 60000L;
|
private long fixedDelay = 60000L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set to true to run the autoassign scheduler.
|
||||||
|
*/
|
||||||
|
private boolean enabled = true;
|
||||||
|
|
||||||
public long getFixedDelay() {
|
public long getFixedDelay() {
|
||||||
return fixedDelay;
|
return fixedDelay;
|
||||||
}
|
}
|
||||||
@@ -37,6 +42,14 @@ public class AutoAssignProperties {
|
|||||||
this.fixedDelay = fixedDelay;
|
this.fixedDelay = fixedDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnabled(final boolean enabled) {
|
||||||
|
this.enabled = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Scheduler scheduler = new Scheduler();
|
private final Scheduler scheduler = new Scheduler();
|
||||||
|
|||||||
@@ -9,13 +9,11 @@
|
|||||||
package org.eclipse.hawkbit.repository;
|
package org.eclipse.hawkbit.repository;
|
||||||
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rollout Management properties.
|
* Rollout Management properties.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Component
|
|
||||||
@ConfigurationProperties("hawkbit.rollout")
|
@ConfigurationProperties("hawkbit.rollout")
|
||||||
public class RolloutProperties {
|
public class RolloutProperties {
|
||||||
// used by @Scheduled annotation which needs constant
|
// used by @Scheduled annotation which needs constant
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
/**
|
||||||
|
* 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.repository.exception;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||||
|
import org.eclipse.hawkbit.exception.SpServerError;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown if repository operation is no longer supported.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public final class MethodNotSupportedException extends AbstractServerRtException {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new MethodNotSupportedException with
|
||||||
|
* {@link SpServerError#SP_REPO_OPERATION_NOT_SUPPORTED} error.
|
||||||
|
*/
|
||||||
|
public MethodNotSupportedException() {
|
||||||
|
super(SpServerError.SP_REPO_OPERATION_NOT_SUPPORTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new MethodNotSupportedException with
|
||||||
|
* {@link SpServerError#SP_REPO_OPERATION_NOT_SUPPORTED} error.
|
||||||
|
*
|
||||||
|
* @param cause
|
||||||
|
* for the exception
|
||||||
|
*/
|
||||||
|
public MethodNotSupportedException(final Throwable cause) {
|
||||||
|
super(SpServerError.SP_REPO_OPERATION_NOT_SUPPORTED, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new MethodNotSupportedException with
|
||||||
|
* {@link SpServerError#SP_REPO_OPERATION_NOT_SUPPORTED} error.
|
||||||
|
*
|
||||||
|
* @param message
|
||||||
|
* of the error
|
||||||
|
*/
|
||||||
|
public MethodNotSupportedException(final String message) {
|
||||||
|
super(message, SpServerError.SP_REPO_OPERATION_NOT_SUPPORTED);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,32 +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;
|
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.context.annotation.Import;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Annotation to enable {@link ComponentScan} in the resource package to setup
|
|
||||||
* all {@link Controller} annotated classes and setup the REST-Resources for the
|
|
||||||
* Management API.
|
|
||||||
*/
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Configuration
|
|
||||||
@Import(RepositoryApplicationConfiguration.class)
|
|
||||||
public @interface EnableJpaRepository {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -14,7 +14,6 @@ import java.util.Map;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.persistence.EntityManager;
|
|
||||||
import javax.persistence.EntityNotFoundException;
|
import javax.persistence.EntityNotFoundException;
|
||||||
import javax.validation.ConstraintDeclarationException;
|
import javax.validation.ConstraintDeclarationException;
|
||||||
|
|
||||||
@@ -92,9 +91,6 @@ public class JpaRolloutManagement implements RolloutManagement {
|
|||||||
*/
|
*/
|
||||||
private static final int TRANSACTION_TARGETS = 1000;
|
private static final int TRANSACTION_TARGETS = 1000;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private EntityManager entityManager;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RolloutRepository rolloutRepository;
|
private RolloutRepository rolloutRepository;
|
||||||
|
|
||||||
|
|||||||
@@ -6,12 +6,13 @@
|
|||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit;
|
package org.eclipse.hawkbit.repository.jpa;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.ControllerPollProperties;
|
||||||
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
||||||
import org.eclipse.hawkbit.repository.ControllerManagement;
|
import org.eclipse.hawkbit.repository.ControllerManagement;
|
||||||
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
||||||
@@ -21,6 +22,7 @@ import org.eclipse.hawkbit.repository.ReportManagement;
|
|||||||
import org.eclipse.hawkbit.repository.RepositoryProperties;
|
import org.eclipse.hawkbit.repository.RepositoryProperties;
|
||||||
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
|
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
|
||||||
import org.eclipse.hawkbit.repository.RolloutManagement;
|
import org.eclipse.hawkbit.repository.RolloutManagement;
|
||||||
|
import org.eclipse.hawkbit.repository.RolloutProperties;
|
||||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||||
import org.eclipse.hawkbit.repository.SystemManagement;
|
import org.eclipse.hawkbit.repository.SystemManagement;
|
||||||
import org.eclipse.hawkbit.repository.TagManagement;
|
import org.eclipse.hawkbit.repository.TagManagement;
|
||||||
@@ -35,21 +37,6 @@ import org.eclipse.hawkbit.repository.builder.SoftwareModuleBuilder;
|
|||||||
import org.eclipse.hawkbit.repository.builder.TargetFilterQueryBuilder;
|
import org.eclipse.hawkbit.repository.builder.TargetFilterQueryBuilder;
|
||||||
import org.eclipse.hawkbit.repository.event.remote.EventEntityManager;
|
import org.eclipse.hawkbit.repository.event.remote.EventEntityManager;
|
||||||
import org.eclipse.hawkbit.repository.event.remote.EventEntityManagerHolder;
|
import org.eclipse.hawkbit.repository.event.remote.EventEntityManagerHolder;
|
||||||
import org.eclipse.hawkbit.repository.jpa.JpaArtifactManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.JpaControllerManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.JpaDeploymentManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.JpaDistributionSetManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.JpaEntityFactory;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.JpaReportManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.JpaRolloutGroupManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.JpaRolloutManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.JpaSoftwareManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.JpaSystemManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.JpaTagManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.JpaTargetFilterQueryManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.JpaTargetManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.JpaTenantConfigurationManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.JpaTenantStatsManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.aspects.ExceptionMappingAspectHandler;
|
import org.eclipse.hawkbit.repository.jpa.aspects.ExceptionMappingAspectHandler;
|
||||||
import org.eclipse.hawkbit.repository.jpa.autoassign.AutoAssignChecker;
|
import org.eclipse.hawkbit.repository.jpa.autoassign.AutoAssignChecker;
|
||||||
import org.eclipse.hawkbit.repository.jpa.autoassign.AutoAssignScheduler;
|
import org.eclipse.hawkbit.repository.jpa.autoassign.AutoAssignScheduler;
|
||||||
@@ -78,6 +65,7 @@ import org.eclipse.hawkbit.security.SecurityTokenGenerator;
|
|||||||
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
||||||
import org.eclipse.hawkbit.tenancy.TenantAware;
|
import org.eclipse.hawkbit.tenancy.TenantAware;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration;
|
import org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration;
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
import org.springframework.boot.orm.jpa.EntityScan;
|
import org.springframework.boot.orm.jpa.EntityScan;
|
||||||
@@ -106,7 +94,7 @@ import com.google.common.collect.Maps;
|
|||||||
@EnableAspectJAutoProxy
|
@EnableAspectJAutoProxy
|
||||||
@Configuration
|
@Configuration
|
||||||
@ComponentScan
|
@ComponentScan
|
||||||
@EnableConfigurationProperties(RepositoryProperties.class)
|
@EnableConfigurationProperties({ RepositoryProperties.class, ControllerPollProperties.class, RolloutProperties.class })
|
||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
@EntityScan("org.eclipse.hawkbit.repository.jpa.model")
|
@EntityScan("org.eclipse.hawkbit.repository.jpa.model")
|
||||||
public class RepositoryApplicationConfiguration extends JpaBaseConfiguration {
|
public class RepositoryApplicationConfiguration extends JpaBaseConfiguration {
|
||||||
@@ -525,6 +513,7 @@ public class RepositoryApplicationConfiguration extends JpaBaseConfiguration {
|
|||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnMissingBean
|
@ConditionalOnMissingBean
|
||||||
|
@ConditionalOnProperty(prefix = "hawkbit.autoassign.scheduler", name = "enabled", matchIfMissing = true)
|
||||||
public AutoAssignScheduler autoAssignScheduler(final TenantAware tenantAware,
|
public AutoAssignScheduler autoAssignScheduler(final TenantAware tenantAware,
|
||||||
final SystemManagement systemManagement, final SystemSecurityContext systemSecurityContext,
|
final SystemManagement systemManagement, final SystemSecurityContext systemSecurityContext,
|
||||||
final AutoAssignChecker autoAssignChecker) {
|
final AutoAssignChecker autoAssignChecker) {
|
||||||
@@ -50,8 +50,8 @@ public class AutoAssignScheduler {
|
|||||||
* @param autoAssignChecker
|
* @param autoAssignChecker
|
||||||
* to run a check as tenant
|
* to run a check as tenant
|
||||||
*/
|
*/
|
||||||
public AutoAssignScheduler(TenantAware tenantAware, SystemManagement systemManagement,
|
public AutoAssignScheduler(final TenantAware tenantAware, final SystemManagement systemManagement,
|
||||||
SystemSecurityContext systemSecurityContext, AutoAssignChecker autoAssignChecker) {
|
final SystemSecurityContext systemSecurityContext, final AutoAssignChecker autoAssignChecker) {
|
||||||
this.tenantAware = tenantAware;
|
this.tenantAware = tenantAware;
|
||||||
this.systemManagement = systemManagement;
|
this.systemManagement = systemManagement;
|
||||||
this.systemSecurityContext = systemSecurityContext;
|
this.systemSecurityContext = systemSecurityContext;
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ import org.springframework.boot.test.SpringApplicationConfiguration;
|
|||||||
import org.springframework.transaction.annotation.Isolation;
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@SpringApplicationConfiguration(classes = { org.eclipse.hawkbit.RepositoryApplicationConfiguration.class })
|
@SpringApplicationConfiguration(classes = {
|
||||||
|
org.eclipse.hawkbit.repository.jpa.RepositoryApplicationConfiguration.class })
|
||||||
public abstract class AbstractJpaIntegrationTest extends AbstractIntegrationTest {
|
public abstract class AbstractJpaIntegrationTest extends AbstractIntegrationTest {
|
||||||
|
|
||||||
@PersistenceContext
|
@PersistenceContext
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ spring.jpa.properties.eclipselink.logging.parameters=true
|
|||||||
|
|
||||||
flyway.enabled=true
|
flyway.enabled=true
|
||||||
flyway.sqlMigrationSuffix=${spring.jpa.database}.sql
|
flyway.sqlMigrationSuffix=${spring.jpa.database}.sql
|
||||||
#spring.jpa.show-sql=true
|
|
||||||
|
|
||||||
# DDI configuration
|
# DDI configuration
|
||||||
hawkbit.controller.pollingTime=00:01:00
|
hawkbit.controller.pollingTime=00:01:00
|
||||||
|
|||||||
@@ -43,6 +43,20 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-logging</artifactId>
|
<artifactId>spring-boot-starter-logging</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-jetty</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-context-support</artifactId>
|
<artifactId>spring-context-support</artifactId>
|
||||||
|
|||||||
@@ -6,11 +6,13 @@
|
|||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit;
|
package org.eclipse.hawkbit.repository.test;
|
||||||
|
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.ControllerPollProperties;
|
||||||
|
import org.eclipse.hawkbit.HawkbitServerProperties;
|
||||||
import org.eclipse.hawkbit.api.ArtifactUrlHandlerProperties;
|
import org.eclipse.hawkbit.api.ArtifactUrlHandlerProperties;
|
||||||
import org.eclipse.hawkbit.api.PropertyBasedArtifactUrlHandler;
|
import org.eclipse.hawkbit.api.PropertyBasedArtifactUrlHandler;
|
||||||
import org.eclipse.hawkbit.artifact.repository.ArtifactFilesystemProperties;
|
import org.eclipse.hawkbit.artifact.repository.ArtifactFilesystemProperties;
|
||||||
@@ -29,7 +31,9 @@ import org.eclipse.hawkbit.repository.test.util.TestContextProvider;
|
|||||||
import org.eclipse.hawkbit.repository.test.util.TestRepositoryManagement;
|
import org.eclipse.hawkbit.repository.test.util.TestRepositoryManagement;
|
||||||
import org.eclipse.hawkbit.repository.test.util.TestdataFactory;
|
import org.eclipse.hawkbit.repository.test.util.TestdataFactory;
|
||||||
import org.eclipse.hawkbit.security.DdiSecurityProperties;
|
import org.eclipse.hawkbit.security.DdiSecurityProperties;
|
||||||
|
import org.eclipse.hawkbit.security.HawkbitSecurityProperties;
|
||||||
import org.eclipse.hawkbit.security.SecurityContextTenantAware;
|
import org.eclipse.hawkbit.security.SecurityContextTenantAware;
|
||||||
|
import org.eclipse.hawkbit.security.SecurityTokenGenerator;
|
||||||
import org.eclipse.hawkbit.security.SpringSecurityAuditorAware;
|
import org.eclipse.hawkbit.security.SpringSecurityAuditorAware;
|
||||||
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
||||||
import org.eclipse.hawkbit.tenancy.TenantAware;
|
import org.eclipse.hawkbit.tenancy.TenantAware;
|
||||||
@@ -56,21 +60,28 @@ import org.springframework.security.concurrent.DelegatingSecurityContextExecutor
|
|||||||
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
|
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
|
||||||
import org.springframework.util.AntPathMatcher;
|
import org.springframework.util.AntPathMatcher;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Spring context configuration required for Dev.Environment.
|
* Spring context configuration required for Dev.Environment.
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableGlobalMethodSecurity(prePostEnabled = true, mode = AdviceMode.PROXY, proxyTargetClass = false, securedEnabled = true)
|
@EnableGlobalMethodSecurity(prePostEnabled = true, mode = AdviceMode.PROXY, proxyTargetClass = false, securedEnabled = true)
|
||||||
@EnableConfigurationProperties({ HawkbitServerProperties.class, DdiSecurityProperties.class,
|
@EnableConfigurationProperties({ HawkbitServerProperties.class, DdiSecurityProperties.class,
|
||||||
ArtifactUrlHandlerProperties.class, ArtifactFilesystemProperties.class })
|
ArtifactUrlHandlerProperties.class, ArtifactFilesystemProperties.class, HawkbitSecurityProperties.class,
|
||||||
|
ControllerPollProperties.class })
|
||||||
@Profile("test")
|
@Profile("test")
|
||||||
@EnableAutoConfiguration
|
@EnableAutoConfiguration
|
||||||
public class TestConfiguration implements AsyncConfigurer {
|
public class TestConfiguration implements AsyncConfigurer {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public SecurityTokenGenerator securityTokenGenerator() {
|
||||||
|
return new SecurityTokenGenerator();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public SystemSecurityContext systemSecurityContext(final TenantAware tenantAware) {
|
||||||
|
return new SystemSecurityContext(tenantAware);
|
||||||
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public ArtifactRepository artifactRepository(final ArtifactFilesystemProperties artifactFilesystemProperties) {
|
public ArtifactRepository artifactRepository(final ArtifactFilesystemProperties artifactFilesystemProperties) {
|
||||||
return new ArtifactFilesystemRepository(artifactFilesystemProperties);
|
return new ArtifactFilesystemRepository(artifactFilesystemProperties);
|
||||||
@@ -19,8 +19,6 @@ import java.util.List;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.eclipse.hawkbit.ExcludePathAwareShallowETagFilter;
|
|
||||||
import org.eclipse.hawkbit.TestConfiguration;
|
|
||||||
import org.eclipse.hawkbit.artifact.repository.ArtifactFilesystemProperties;
|
import org.eclipse.hawkbit.artifact.repository.ArtifactFilesystemProperties;
|
||||||
import org.eclipse.hawkbit.artifact.repository.ArtifactRepository;
|
import org.eclipse.hawkbit.artifact.repository.ArtifactRepository;
|
||||||
import org.eclipse.hawkbit.cache.TenantAwareCacheManager;
|
import org.eclipse.hawkbit.cache.TenantAwareCacheManager;
|
||||||
@@ -54,8 +52,10 @@ import org.eclipse.hawkbit.repository.model.RolloutGroupConditions;
|
|||||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetWithActionType;
|
import org.eclipse.hawkbit.repository.model.TargetWithActionType;
|
||||||
|
import org.eclipse.hawkbit.repository.test.TestConfiguration;
|
||||||
import org.eclipse.hawkbit.repository.test.matcher.EventVerifier;
|
import org.eclipse.hawkbit.repository.test.matcher.EventVerifier;
|
||||||
import org.eclipse.hawkbit.security.DosFilter;
|
import org.eclipse.hawkbit.security.DosFilter;
|
||||||
|
import org.eclipse.hawkbit.security.ExcludePathAwareShallowETagFilter;
|
||||||
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
||||||
import org.eclipse.hawkbit.tenancy.TenantAware;
|
import org.eclipse.hawkbit.tenancy.TenantAware;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.rest.configuration;
|
package org.eclipse.hawkbit.rest;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
@@ -15,6 +15,7 @@ import org.eclipse.hawkbit.rest.util.HttpResponseFactoryBean;
|
|||||||
import org.eclipse.hawkbit.rest.util.RequestResponseContextHolder;
|
import org.eclipse.hawkbit.rest.util.RequestResponseContextHolder;
|
||||||
import org.springframework.beans.factory.FactoryBean;
|
import org.springframework.beans.factory.FactoryBean;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.hateoas.config.EnableHypermediaSupport;
|
import org.springframework.hateoas.config.EnableHypermediaSupport;
|
||||||
@@ -25,6 +26,7 @@ import org.springframework.web.context.WebApplicationContext;
|
|||||||
* Configuration for Rest api.
|
* Configuration for Rest api.
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
|
@ComponentScan
|
||||||
@EnableHypermediaSupport(type = { HypermediaType.HAL })
|
@EnableHypermediaSupport(type = { HypermediaType.HAL })
|
||||||
public class RestConfiguration {
|
public class RestConfiguration {
|
||||||
|
|
||||||
@@ -70,6 +70,8 @@ public class ResponseExceptionHandler {
|
|||||||
ERROR_TO_HTTP_STATUS.put(SpServerError.SP_CONFIGURATION_KEY_INVALID, HttpStatus.BAD_REQUEST);
|
ERROR_TO_HTTP_STATUS.put(SpServerError.SP_CONFIGURATION_KEY_INVALID, HttpStatus.BAD_REQUEST);
|
||||||
ERROR_TO_HTTP_STATUS.put(SpServerError.SP_REPO_INVALID_TARGET_ADDRESS, HttpStatus.BAD_REQUEST);
|
ERROR_TO_HTTP_STATUS.put(SpServerError.SP_REPO_INVALID_TARGET_ADDRESS, HttpStatus.BAD_REQUEST);
|
||||||
ERROR_TO_HTTP_STATUS.put(SpServerError.SP_REPO_CONSTRAINT_VIOLATION, HttpStatus.BAD_REQUEST);
|
ERROR_TO_HTTP_STATUS.put(SpServerError.SP_REPO_CONSTRAINT_VIOLATION, HttpStatus.BAD_REQUEST);
|
||||||
|
ERROR_TO_HTTP_STATUS.put(SpServerError.SP_REPO_OPERATION_NOT_SUPPORTED, HttpStatus.GONE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static HttpStatus getStatusOrDefault(final SpServerError error) {
|
private static HttpStatus getStatusOrDefault(final SpServerError error) {
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.rest;
|
package org.eclipse.hawkbit.rest;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.repository.jpa.RepositoryApplicationConfiguration;
|
||||||
import org.eclipse.hawkbit.repository.test.util.AbstractIntegrationTest;
|
import org.eclipse.hawkbit.repository.test.util.AbstractIntegrationTest;
|
||||||
import org.eclipse.hawkbit.rest.configuration.RestConfiguration;
|
|
||||||
import org.eclipse.hawkbit.rest.util.FilterHttpResponse;
|
import org.eclipse.hawkbit.rest.util.FilterHttpResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.SpringApplicationConfiguration;
|
import org.springframework.boot.test.SpringApplicationConfiguration;
|
||||||
@@ -18,8 +18,7 @@ import org.springframework.test.web.servlet.setup.DefaultMockMvcBuilder;
|
|||||||
/**
|
/**
|
||||||
* Abstract Test for Rest tests.
|
* Abstract Test for Rest tests.
|
||||||
*/
|
*/
|
||||||
@SpringApplicationConfiguration(classes = { RestConfiguration.class,
|
@SpringApplicationConfiguration(classes = { RestConfiguration.class, RepositoryApplicationConfiguration.class })
|
||||||
org.eclipse.hawkbit.RepositoryApplicationConfiguration.class })
|
|
||||||
public abstract class AbstractRestIntegrationTest extends AbstractIntegrationTest {
|
public abstract class AbstractRestIntegrationTest extends AbstractIntegrationTest {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit;
|
package org.eclipse.hawkbit.security;
|
||||||
|
|
||||||
import java.io.IOException;
|
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
|
* 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
|
* 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.
|
* should be excluded in case of artifact downloads which could be big of size.
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class ExcludePathAwareShallowETagFilter extends ShallowEtagHeaderFilter {
|
public class ExcludePathAwareShallowETagFilter extends ShallowEtagHeaderFilter {
|
||||||
|
|
||||||
@@ -41,14 +37,6 @@ public class ExcludePathAwareShallowETagFilter extends ShallowEtagHeaderFilter {
|
|||||||
this.antMatcher = new AntPathMatcher();
|
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
|
@Override
|
||||||
protected void doFilterInternal(final HttpServletRequest request, final HttpServletResponse response,
|
protected void doFilterInternal(final HttpServletRequest request, final HttpServletResponse response,
|
||||||
final FilterChain filterChain) throws ServletException, IOException {
|
final FilterChain filterChain) throws ServletException, IOException {
|
||||||
@@ -9,13 +9,11 @@
|
|||||||
package org.eclipse.hawkbit.security;
|
package org.eclipse.hawkbit.security;
|
||||||
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Security related hawkbit configuration.
|
* Security related hawkbit configuration.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Component
|
|
||||||
@ConfigurationProperties("hawkbit.server.security")
|
@ConfigurationProperties("hawkbit.server.security")
|
||||||
public class HawkbitSecurityProperties {
|
public class HawkbitSecurityProperties {
|
||||||
|
|
||||||
|
|||||||
@@ -11,18 +11,12 @@ package org.eclipse.hawkbit.security;
|
|||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
|
|
||||||
import org.apache.commons.lang3.RandomStringUtils;
|
import org.apache.commons.lang3.RandomStringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A security token generator service which can be used to generate security
|
* 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
|
* tokens for e.g. target or gateway tokens which are valid for authenticates
|
||||||
* against SP.
|
* against SP.
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Service
|
|
||||||
public class SecurityTokenGenerator {
|
public class SecurityTokenGenerator {
|
||||||
|
|
||||||
private static final boolean LETTERS_GENERATION = true;
|
private static final boolean LETTERS_GENERATION = true;
|
||||||
|
|||||||
@@ -17,21 +17,18 @@ import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
|||||||
import org.eclipse.hawkbit.tenancy.TenantAware;
|
import org.eclipse.hawkbit.tenancy.TenantAware;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.security.core.GrantedAuthority;
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||||
import org.springframework.security.core.context.SecurityContext;
|
import org.springframework.security.core.context.SecurityContext;
|
||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
import org.springframework.security.core.context.SecurityContextImpl;
|
import org.springframework.security.core.context.SecurityContextImpl;
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import com.google.common.base.Throwables;
|
import com.google.common.base.Throwables;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Service which provide to run system code.
|
* A Service which provide to run system code.
|
||||||
*/
|
*/
|
||||||
@Service
|
|
||||||
public class SystemSecurityContext {
|
public class SystemSecurityContext {
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(SystemSecurityContext.class);
|
private static final Logger LOG = LoggerFactory.getLogger(SystemSecurityContext.class);
|
||||||
@@ -44,7 +41,6 @@ public class SystemSecurityContext {
|
|||||||
* @param tenantAware
|
* @param tenantAware
|
||||||
* the tenant aware bean to retrieve the current tenant
|
* the tenant aware bean to retrieve the current tenant
|
||||||
*/
|
*/
|
||||||
@Autowired
|
|
||||||
public SystemSecurityContext(final TenantAware tenantAware) {
|
public SystemSecurityContext(final TenantAware tenantAware) {
|
||||||
this.tenantAware = tenantAware;
|
this.tenantAware = tenantAware;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* 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.fest.assertions.Assertions.assertThat;
|
||||||
import static org.mockito.Mockito.mockingDetails;
|
import static org.mockito.Mockito.mockingDetails;
|
||||||
@@ -21,6 +21,7 @@ import javax.servlet.ServletException;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.security.ExcludePathAwareShallowETagFilter;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.mockito.ArgumentCaptor;
|
import org.mockito.ArgumentCaptor;
|
||||||
@@ -35,6 +35,11 @@
|
|||||||
<groupId>org.springframework.security</groupId>
|
<groupId>org.springframework.security</groupId>
|
||||||
<artifactId>spring-security-web</artifactId>
|
<artifactId>spring-security-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- TEST -->
|
<!-- TEST -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
5
hawkbit-starters/README.md
Normal file
5
hawkbit-starters/README.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
This is a set of [Spring Boot Starters](http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#using-boot-starter) that allows to quick start a spring boot based application with hawkBit's core functionality.
|
||||||
|
|
||||||
|
The [all in one](hawkbit-boot-starter) starter contains the complete feature set in addition we provide four starters for the hawkBit interfaces. They can be combined in any order.
|
||||||
|
|
||||||
|
Check out the hawkBit [example application](../examples/hawkbit-example-app) as a reference.
|
||||||
1
hawkbit-starters/hawkbit-boot-starter-ddi-api/README.MD
Normal file
1
hawkbit-starters/hawkbit-boot-starter-ddi-api/README.MD
Normal file
@@ -0,0 +1 @@
|
|||||||
|
[Spring Boot Starter](http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#using-boot-starter) for the [Direct Device Integration API](https://www.eclipse.org/hawkbit/documentation/interfaces/ddi-api.html).
|
||||||
85
hawkbit-starters/hawkbit-boot-starter-ddi-api/pom.xml
Normal file
85
hawkbit-starters/hawkbit-boot-starter-ddi-api/pom.xml
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
<!--
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
-->
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-starters</artifactId>
|
||||||
|
<version>0.2.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<artifactId>hawkbit-boot-starter-ddi-api</artifactId>
|
||||||
|
<name>hawkBit :: Spring Boot Starter DDI API</name>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!-- Spring - START -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-jetty</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-config</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-aspects</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- Spring - END -->
|
||||||
|
|
||||||
|
<!-- hawkBit - START -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-ddi-resource</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-security-integration</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-http-security</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-repository-jpa</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-autoconfigure</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- hawkBit - END -->
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
1
hawkbit-starters/hawkbit-boot-starter-dmf-api/README.MD
Normal file
1
hawkbit-starters/hawkbit-boot-starter-dmf-api/README.MD
Normal file
@@ -0,0 +1 @@
|
|||||||
|
[Spring Boot Starter](http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#using-boot-starter) for the [Device Management Federation API (AMQP 0.9)](https://www.eclipse.org/hawkbit/documentation/interfaces/dmf-api.html).
|
||||||
56
hawkbit-starters/hawkbit-boot-starter-dmf-api/pom.xml
Normal file
56
hawkbit-starters/hawkbit-boot-starter-dmf-api/pom.xml
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
<!--
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
-->
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-starters</artifactId>
|
||||||
|
<version>0.2.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<artifactId>hawkbit-boot-starter-dmf-api</artifactId>
|
||||||
|
<name>hawkBit :: Spring Boot Starter DMF API</name>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!-- Spring - START -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-config</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-aspects</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- Spring - END -->
|
||||||
|
|
||||||
|
<!-- hawkBit - START -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-dmf-amqp</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-repository-jpa</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-autoconfigure</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- hawkBit - END -->
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
1
hawkbit-starters/hawkbit-boot-starter-mgmt-api/README.MD
Normal file
1
hawkbit-starters/hawkbit-boot-starter-mgmt-api/README.MD
Normal file
@@ -0,0 +1 @@
|
|||||||
|
[Spring Boot Starter](http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#using-boot-starter) for the [Management API](https://www.eclipse.org/hawkbit/documentation/interfaces/management-api.html).
|
||||||
85
hawkbit-starters/hawkbit-boot-starter-mgmt-api/pom.xml
Normal file
85
hawkbit-starters/hawkbit-boot-starter-mgmt-api/pom.xml
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
<!--
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
-->
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-starters</artifactId>
|
||||||
|
<version>0.2.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<artifactId>hawkbit-boot-starter-mgmt-api</artifactId>
|
||||||
|
<name>hawkBit :: Spring Boot Starter Management API</name>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!-- Spring - START -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-jetty</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-config</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-aspects</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- Spring - END -->
|
||||||
|
|
||||||
|
<!-- hawkBit - START -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-mgmt-resource</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-security-integration</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-http-security</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-repository-jpa</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-autoconfigure</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- hawkBit - END -->
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
||||||
1
hawkbit-starters/hawkbit-boot-starter-mgmt-ui/README.MD
Normal file
1
hawkbit-starters/hawkbit-boot-starter-mgmt-ui/README.MD
Normal file
@@ -0,0 +1 @@
|
|||||||
|
[Spring Boot Starter](http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#using-boot-starter) for the [Management UI](https://www.eclipse.org/hawkbit/documentation/interfaces/management-ui.html).
|
||||||
86
hawkbit-starters/hawkbit-boot-starter-mgmt-ui/pom.xml
Normal file
86
hawkbit-starters/hawkbit-boot-starter-mgmt-ui/pom.xml
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
<!--
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
-->
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-starters</artifactId>
|
||||||
|
<version>0.2.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<artifactId>hawkbit-boot-starter-mgmt-ui</artifactId>
|
||||||
|
<name>hawkBit :: Spring Boot Starter Management UI</name>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!-- Spring - START -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-jetty</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-config</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-aspects</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- Spring - END -->
|
||||||
|
|
||||||
|
<!-- hawkBit - START -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-ui</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-repository-jpa</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-autoconfigure</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- hawkBit - END -->
|
||||||
|
|
||||||
|
<!-- exclude gwt-elemental as there are class conflicts -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.vaadin</groupId>
|
||||||
|
<artifactId>vaadin-client</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>com.vaadin.external.gwt</groupId>
|
||||||
|
<artifactId>gwt-elemental</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
6
hawkbit-starters/hawkbit-boot-starter/README.MD
Normal file
6
hawkbit-starters/hawkbit-boot-starter/README.MD
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
[Spring Boot Starter](http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#using-boot-starter) including all four interfaces:
|
||||||
|
|
||||||
|
* [Management UI](https://www.eclipse.org/hawkbit/documentation/interfaces/management-ui.html)
|
||||||
|
* [Management API](https://www.eclipse.org/hawkbit/documentation/interfaces/management-api.html)
|
||||||
|
* [Direct Device Integration API](https://www.eclipse.org/hawkbit/documentation/interfaces/ddi-api.html)
|
||||||
|
* [Device Management Federation API (AMQP 0.9)](https://www.eclipse.org/hawkbit/documentation/interfaces/dmf-api.html)
|
||||||
46
hawkbit-starters/hawkbit-boot-starter/pom.xml
Normal file
46
hawkbit-starters/hawkbit-boot-starter/pom.xml
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
<!--
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
-->
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-starters</artifactId>
|
||||||
|
<version>0.2.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<artifactId>hawkbit-boot-starter</artifactId>
|
||||||
|
<name>hawkBit :: Spring Boot Starter</name>
|
||||||
|
<description>Complete starter, including auto-configuration, logging and all hawkBit interfaces</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-boot-starter-ddi-api</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-boot-starter-dmf-api</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-boot-starter-mgmt-api</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-boot-starter-mgmt-ui</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
||||||
30
hawkbit-starters/pom.xml
Normal file
30
hawkbit-starters/pom.xml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<!--
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
-->
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-parent</artifactId>
|
||||||
|
<version>0.2.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<artifactId>hawkbit-starters</artifactId>
|
||||||
|
<name>hawkBit :: Spring Boot Starters Parent</name>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<modules>
|
||||||
|
<module>hawkbit-boot-starter</module>
|
||||||
|
<module>hawkbit-boot-starter-mgmt-ui</module>
|
||||||
|
<module>hawkbit-boot-starter-mgmt-api</module>
|
||||||
|
<module>hawkbit-boot-starter-ddi-api</module>
|
||||||
|
<module>hawkbit-boot-starter-dmf-api</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -130,7 +130,7 @@
|
|||||||
<pluginExecutionFilter>
|
<pluginExecutionFilter>
|
||||||
<groupId>com.vaadin</groupId>
|
<groupId>com.vaadin</groupId>
|
||||||
<artifactId>vaadin-maven-plugin</artifactId>
|
<artifactId>vaadin-maven-plugin</artifactId>
|
||||||
<versionRange>[7.6.3,)</versionRange>
|
<versionRange>[7.7.3,)</versionRange>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>compile-theme</goal>
|
<goal>compile-theme</goal>
|
||||||
</goals>
|
</goals>
|
||||||
|
|||||||
@@ -1,69 +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.repository;
|
|
||||||
|
|
||||||
import org.springframework.data.domain.PageRequest;
|
|
||||||
import org.springframework.data.domain.Sort;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An implementation of the {@link PageRequest} which is offset based by means
|
|
||||||
* the offset is given and not the page number as in the original
|
|
||||||
* {@link PageRequest} implemntation where the offset is generated. Due that the
|
|
||||||
* REST-API is working with {@code offset} and {@code limit} parameter we need
|
|
||||||
* an offset based page request for JPA.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public final class OffsetBasedPageRequest extends PageRequest {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
private final int offset;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new {@link OffsetBasedPageRequest}. Offsets are zero indexed,
|
|
||||||
* thus providing 0 for {@code offset} will return the first entry.
|
|
||||||
*
|
|
||||||
* @param offset
|
|
||||||
* zero-based offset index.
|
|
||||||
* @param limit
|
|
||||||
* the limit of the page to be returned.
|
|
||||||
*/
|
|
||||||
public OffsetBasedPageRequest(final int offset, final int limit) {
|
|
||||||
this(offset, limit, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new {@link OffsetBasedPageRequest}. Offsets are zero indexed,
|
|
||||||
* thus providing 0 for {@code offset} will return the first entry.
|
|
||||||
*
|
|
||||||
* @param offset
|
|
||||||
* zero-based offset index.
|
|
||||||
* @param limit
|
|
||||||
* the limit of the page to be returned.
|
|
||||||
* @param sort
|
|
||||||
* sort can be {@literal null}.
|
|
||||||
*/
|
|
||||||
public OffsetBasedPageRequest(final int offset, final int limit, final Sort sort) {
|
|
||||||
super(0, limit, sort);
|
|
||||||
this.offset = offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getOffset() {
|
|
||||||
return offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "OffsetBasedPageRequest [offset=" + offset + ", getPageSize()=" + getPageSize() + ", getPageNumber()="
|
|
||||||
+ getPageNumber() + "]";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.push;
|
package org.eclipse.hawkbit.ui;
|
||||||
|
|
||||||
import org.atmosphere.container.JSR356AsyncSupport;
|
import org.atmosphere.container.JSR356AsyncSupport;
|
||||||
import org.atmosphere.cpr.ApplicationConfig;
|
import org.atmosphere.cpr.ApplicationConfig;
|
||||||
@@ -23,9 +23,6 @@ import com.vaadin.spring.boot.internal.VaadinServletConfigurationProperties;
|
|||||||
* {@link VaadinServletConfiguration} that sets the context path for
|
* {@link VaadinServletConfiguration} that sets the context path for
|
||||||
* {@link JSR356AsyncSupport} that registers
|
* {@link JSR356AsyncSupport} that registers
|
||||||
* {@link SpringSecurityAtmosphereInterceptor} for spring security integration.
|
* {@link SpringSecurityAtmosphereInterceptor} for spring security integration.
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableConfigurationProperties(VaadinServletConfigurationProperties.class)
|
@EnableConfigurationProperties(VaadinServletConfigurationProperties.class)
|
||||||
@@ -16,10 +16,6 @@ import com.vaadin.ui.UI;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract class for the ui to set widgetset and theme.
|
* Abstract class for the ui to set widgetset and theme.
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
@Widgetset(value = HawkbitTheme.WIDGET_SET_NAME)
|
@Widgetset(value = HawkbitTheme.WIDGET_SET_NAME)
|
||||||
|
|||||||
@@ -20,10 +20,6 @@ import com.vaadin.util.CurrentInstance;
|
|||||||
/**
|
/**
|
||||||
* A {@link Runnable} implementation for the {@link UI#access(Runnable)} to
|
* A {@link Runnable} implementation for the {@link UI#access(Runnable)} to
|
||||||
* dispatch events to the UI in the UI thread.
|
* dispatch events to the UI in the UI thread.
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class DispatcherRunnable implements Runnable {
|
public class DispatcherRunnable implements Runnable {
|
||||||
|
|
||||||
@@ -51,11 +47,6 @@ public class DispatcherRunnable implements Runnable {
|
|||||||
this.event = event;
|
this.event = event;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see java.lang.Runnable#run()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
CurrentInstance.setCurrent(session.getUIs().iterator().next());
|
CurrentInstance.setCurrent(session.getUIs().iterator().next());
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
/**
|
||||||
|
* 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.ui;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.im.authentication.PermissionService;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables UI components for the Management UI.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@ComponentScan
|
||||||
|
@Import(AsyncVaadinServletConfiguration.class)
|
||||||
|
@EnableConfigurationProperties(UiProperties.class)
|
||||||
|
public class MgmtUiConfiguration {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param permissionService
|
||||||
|
* to use in the checker
|
||||||
|
* @return {@link SpPermissionChecker} bean
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnMissingBean
|
||||||
|
public SpPermissionChecker spPermissionChecker(final PermissionService permissionService) {
|
||||||
|
return new SpPermissionChecker(permissionService);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository;
|
package org.eclipse.hawkbit.ui;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.push;
|
package org.eclipse.hawkbit.ui;
|
||||||
|
|
||||||
import org.atmosphere.config.service.AtmosphereInterceptorService;
|
import org.atmosphere.config.service.AtmosphereInterceptorService;
|
||||||
import org.atmosphere.cpr.Action;
|
import org.atmosphere.cpr.Action;
|
||||||
@@ -23,20 +23,10 @@ import org.springframework.security.web.context.HttpSessionSecurityContextReposi
|
|||||||
* {@link SecurityContextHolder}. This is necessary due that websocket requests
|
* {@link SecurityContextHolder}. This is necessary due that websocket requests
|
||||||
* are not going through the spring security filter chain and the
|
* are not going through the spring security filter chain and the
|
||||||
* {@link SecurityContext} will not be present in the current Thread.
|
* {@link SecurityContext} will not be present in the current Thread.
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@AtmosphereInterceptorService
|
@AtmosphereInterceptorService
|
||||||
public class SpringSecurityAtmosphereInterceptor extends AtmosphereInterceptorAdapter {
|
public class SpringSecurityAtmosphereInterceptor extends AtmosphereInterceptorAdapter {
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.atmosphere.cpr.AtmosphereInterceptor#inspect(org.atmosphere.cpr.
|
|
||||||
* AtmosphereResource)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Action inspect(final AtmosphereResource r) {
|
public Action inspect(final AtmosphereResource r) {
|
||||||
final SecurityContext context = (SecurityContext) r.getRequest().getSession()
|
final SecurityContext context = (SecurityContext) r.getRequest().getSession()
|
||||||
@@ -11,13 +11,11 @@ package org.eclipse.hawkbit.ui;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Properties for Management UI customization.
|
* Properties for Management UI customization.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Component
|
|
||||||
@ConfigurationProperties("hawkbit.server.ui")
|
@ConfigurationProperties("hawkbit.server.ui")
|
||||||
public class UiProperties implements Serializable {
|
public class UiProperties implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|||||||
@@ -10,13 +10,14 @@ package org.eclipse.hawkbit.ui.artifacts;
|
|||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.annotation.PreDestroy;
|
import javax.annotation.PreDestroy;
|
||||||
|
import javax.servlet.MultipartConfigElement;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
||||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
|
||||||
import org.eclipse.hawkbit.repository.TagManagement;
|
import org.eclipse.hawkbit.repository.TagManagement;
|
||||||
import org.eclipse.hawkbit.ui.HawkbitUI;
|
import org.eclipse.hawkbit.ui.HawkbitUI;
|
||||||
|
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.details.ArtifactDetailsLayout;
|
import org.eclipse.hawkbit.ui.artifacts.details.ArtifactDetailsLayout;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.ArtifactDetailsEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.ArtifactDetailsEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
||||||
@@ -30,7 +31,6 @@ import org.eclipse.hawkbit.ui.dd.criteria.UploadViewClientCriterion;
|
|||||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||||
import org.eclipse.hawkbit.util.SPInfo;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.vaadin.spring.events.EventBus;
|
import org.vaadin.spring.events.EventBus;
|
||||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||||
@@ -92,7 +92,7 @@ public class UploadArtifactView extends VerticalLayout implements View, BrowserW
|
|||||||
final UINotification uiNotification, final ArtifactUploadState artifactUploadState,
|
final UINotification uiNotification, final ArtifactUploadState artifactUploadState,
|
||||||
final TagManagement tagManagement, final EntityFactory entityFactory,
|
final TagManagement tagManagement, final EntityFactory entityFactory,
|
||||||
final SoftwareManagement softwareManagement, final UploadViewClientCriterion uploadViewClientCriterion,
|
final SoftwareManagement softwareManagement, final UploadViewClientCriterion uploadViewClientCriterion,
|
||||||
final SPInfo spInfo, final ArtifactManagement artifactManagement) {
|
final MultipartConfigElement multipartConfigElement, final ArtifactManagement artifactManagement) {
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
this.permChecker = permChecker;
|
this.permChecker = permChecker;
|
||||||
this.i18n = i18n;
|
this.i18n = i18n;
|
||||||
@@ -104,8 +104,8 @@ public class UploadArtifactView extends VerticalLayout implements View, BrowserW
|
|||||||
eventBus, softwareManagement, entityFactory, uploadViewClientCriterion);
|
eventBus, softwareManagement, entityFactory, uploadViewClientCriterion);
|
||||||
this.artifactDetailsLayout = new ArtifactDetailsLayout(i18n, eventBus, artifactUploadState, uiNotification,
|
this.artifactDetailsLayout = new ArtifactDetailsLayout(i18n, eventBus, artifactUploadState, uiNotification,
|
||||||
artifactManagement);
|
artifactManagement);
|
||||||
this.uploadLayout = new UploadLayout(i18n, uiNotification, eventBus, artifactUploadState, spInfo,
|
this.uploadLayout = new UploadLayout(i18n, uiNotification, eventBus, artifactUploadState,
|
||||||
artifactManagement);
|
multipartConfigElement, artifactManagement);
|
||||||
this.deleteActionsLayout = new SMDeleteActionsLayout(i18n, permChecker, eventBus, uiNotification,
|
this.deleteActionsLayout = new SMDeleteActionsLayout(i18n, permChecker, eventBus, uiNotification,
|
||||||
artifactUploadState, softwareManagement, uploadViewClientCriterion);
|
artifactUploadState, softwareManagement, uploadViewClientCriterion);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ package org.eclipse.hawkbit.ui.artifacts.footer;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
||||||
import org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout;
|
import org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout;
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ package org.eclipse.hawkbit.ui.artifacts.smtable;
|
|||||||
|
|
||||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||||
import org.eclipse.hawkbit.repository.SpPermissionChecker;
|
|
||||||
import org.eclipse.hawkbit.repository.model.MetaData;
|
import org.eclipse.hawkbit.repository.model.MetaData;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
|
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
||||||
import org.eclipse.hawkbit.ui.common.detailslayout.AbstractNamedVersionedEntityTableDetailsLayout;
|
import org.eclipse.hawkbit.ui.common.detailslayout.AbstractNamedVersionedEntityTableDetailsLayout;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user