Skip to content

Commit c8d00a2

Browse files
authored
Feature/cors (#263)
* Update properties * Upgrade GHA to use Node.js 20 * Improve handling attributes in firewall * Modify SecurityConfig to use CORS config from property file * Fix wss ssl * Update pom.xml to use latest MMP * Update CHANGELOG.md and README.md * Address PR comments * Update test to check PUT method, since OPTIONS is now allowed in Firewall
1 parent dd18fe1 commit c8d00a2

File tree

21 files changed

+332
-181
lines changed

21 files changed

+332
-181
lines changed

.github/workflows/ECC.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
1616

1717
steps:
18-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v4
1919

2020
- name: Set up JDK 11
21-
uses: actions/setup-java@v3
21+
uses: actions/setup-java@v4
2222
with:
2323
distribution: 'temurin'
2424
java-version: '11'
@@ -40,7 +40,7 @@ jobs:
4040
TRUSTSTORE_PASSWORD_DOCKER: ${{secrets.TRUSTSTORE_PASSWORD_DOCKER}}
4141
steps:
4242
- name: Git Checkout
43-
uses: actions/checkout@v3
43+
uses: actions/checkout@v4
4444

4545
- name: Run env setup
4646
run: ./ci/setupEnv.sh
@@ -74,7 +74,7 @@ jobs:
7474
TRUSTSTORE_PASSWORD_DOCKER: ${{secrets.TRUSTSTORE_PASSWORD_DOCKER}}
7575
steps:
7676
- name: Git Checkout
77-
uses: actions/checkout@v3
77+
uses: actions/checkout@v4
7878

7979
- name: Run env setup
8080
run: ./ci/setupEnv.sh
@@ -108,7 +108,7 @@ jobs:
108108
TRUSTSTORE_PASSWORD_DOCKER: ${{secrets.TRUSTSTORE_PASSWORD_DOCKER}}
109109
steps:
110110
- name: Git Checkout
111-
uses: actions/checkout@v3
111+
uses: actions/checkout@v4
112112

113113
- name: Run env setup
114114
run: ./ci/setupEnv.sh
@@ -150,7 +150,7 @@ jobs:
150150
TRUSTSTORE_PASSWORD_DOCKER: ${{secrets.TRUSTSTORE_PASSWORD_DOCKER}}
151151
steps:
152152
- name: Git Checkout
153-
uses: actions/checkout@v3
153+
uses: actions/checkout@v4
154154

155155
- name: Run env setup
156156
run: ./ci/setupEnv.sh
@@ -184,7 +184,7 @@ jobs:
184184
TRUSTSTORE_PASSWORD_DOCKER: ${{secrets.TRUSTSTORE_PASSWORD_DOCKER}}
185185
steps:
186186
- name: Git Checkout
187-
uses: actions/checkout@v3
187+
uses: actions/checkout@v4
188188

189189
- name: Run env setup
190190
run: ./ci/setupEnv.sh
@@ -218,7 +218,7 @@ jobs:
218218
TRUSTSTORE_PASSWORD_DOCKER: ${{secrets.TRUSTSTORE_PASSWORD_DOCKER}}
219219
steps:
220220
- name: Git Checkout
221-
uses: actions/checkout@v3
221+
uses: actions/checkout@v4
222222

223223
- name: Run env setup
224224
run: ./ci/setupEnv.sh
@@ -252,7 +252,7 @@ jobs:
252252
TRUSTSTORE_PASSWORD_DOCKER: ${{secrets.TRUSTSTORE_PASSWORD_DOCKER}}
253253
steps:
254254
- name: Git Checkout
255-
uses: actions/checkout@v3
255+
uses: actions/checkout@v4
256256

257257
- name: Run env setup
258258
run: ./ci/setupEnv.sh
@@ -286,7 +286,7 @@ jobs:
286286
TRUSTSTORE_PASSWORD_DOCKER: ${{secrets.TRUSTSTORE_PASSWORD_DOCKER}}
287287
steps:
288288
- name: Git Checkout
289-
uses: actions/checkout@v3
289+
uses: actions/checkout@v4
290290

291291
- name: Run env setup
292292
run: ./ci/setupEnv.sh
@@ -320,7 +320,7 @@ jobs:
320320
TRUSTSTORE_PASSWORD_DOCKER: ${{secrets.TRUSTSTORE_PASSWORD_DOCKER}}
321321
steps:
322322
- name: Git Checkout
323-
uses: actions/checkout@v3
323+
uses: actions/checkout@v4
324324

325325
- name: Run env setup
326326
run: ./ci/setupEnv.sh
@@ -354,7 +354,7 @@ jobs:
354354
TRUSTSTORE_PASSWORD_DOCKER: ${{secrets.TRUSTSTORE_PASSWORD_DOCKER}}
355355
steps:
356356
- name: Git Checkout
357-
uses: actions/checkout@v3
357+
uses: actions/checkout@v4
358358

359359
- name: Run env setup
360360
run: ./ci/setupEnv.sh
@@ -388,7 +388,7 @@ jobs:
388388
TRUSTSTORE_PASSWORD_DOCKER: ${{secrets.TRUSTSTORE_PASSWORD_DOCKER}}
389389
steps:
390390
- name: Git Checkout
391-
uses: actions/checkout@v3
391+
uses: actions/checkout@v4
392392

393393
- name: Run env setup
394394
run: ./ci/setupEnv.sh

.github/workflows/docker-publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ jobs:
1515
build:
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v4
1919
- name: Set up JDK 11
20-
uses: actions/setup-java@v3
20+
uses: actions/setup-java@v4
2121
with:
2222
java-version: '11'
2323
distribution: 'temurin'

.github/workflows/maven_release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ jobs:
1515
if: "!contains(github.event.head_commit.message, '[maven-release-plugin]')"
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v4
1919
- name: Set up JDK 11
20-
uses: actions/setup-java@v3
20+
uses: actions/setup-java@v4
2121
with:
2222
java-version: '11'
2323
distribution: 'temurin'

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## [1.14.9] - 2024-07-11
5+
6+
### Added
7+
8+
- CORS configuration (for compatibility with UI)
9+
10+
### Changed
11+
12+
- Updated firewall.properties
13+
- Multipart message library upgraded to 1.0.18
14+
- Websocket library upgraded to 1.0.18
15+
- Fix WSS SSL support
16+
- Upgrade GHA to use Node.js 20
17+
18+
419
## [1.14.8] - 2024-02-14
520

621
### Added

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,35 @@ allowUrlEncodedPeriod=true
9797
```
9898
*IMPORTANT:* If you're not an expert, the strong advice is to keep values at their default values. If you decide to change values, pay special attention to allowHeaderNames and allowHeaderValues, since those set values are exclusive and considered as only values that should be present in the header.
9999

100+
## CORS Configuration
101+
102+
In order to communicate with UI, CORS (Cross-Origin Resource Sharing) settings should be configured in `application.properties` file. This allows you to specify which origins, methods, and headers are permitted when making cross-origin requests to your application.
103+
104+
```
105+
application.cors.allowed.origins=
106+
application.cors.allowed.methods=
107+
application.cors.allowed.headers=
108+
```
109+
110+
- `application.cors.allowed.origins`: Specifies the allowed origins. If empty, all origins (*) are allowed.
111+
- `application.cors.allowed.methods`: Specifies the allowed HTTP methods. If empty, all methods (*) are allowed.
112+
- `application.cors.allowed.header`s: Specifies the allowed headers. If empty, all headers (*) are allowed.
113+
114+
Example configuration:
115+
116+
```
117+
# Allow specific origins
118+
application.cors.allowed.origins=https://example.com,https://another-example.com
119+
120+
# Allow specific HTTP methods
121+
application.cors.allowed.methods=GET,POST,PUT,DELETE
122+
123+
# Allow specific headers
124+
application.cors.allowed.headers=
125+
```
126+
127+
128+
100129
## How to Test
101130
The reachability could be verified using the following endpoints:
102131
* **http://{IP_ADDRESS}:{HTTP_PUBLIC_PORT}/about/version**

ci/docker/be-dataapp_resources/application-docker.properties

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,11 @@ application.security.password=$2a$10$MQ5grDaIqDpBjMlG78PFduv.AMRe9cs0CNm/V4cgUub
6161

6262
#checkSum verification - true | false
6363
application.verifyCheckSum=false
64+
65+
#CORS configuration
66+
#Allow specific origins
67+
application.cors.allowed.origins=
68+
#Allow specific HTTP methods
69+
application.cors.allowed.methods=
70+
#Allow specific headers
71+
application.cors.allowed.headers=

ci/docker/be-dataapp_resources/firewall.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ allowedHeaderNames=
33
#Set which values in header names should have the exact value and allowed (if want to allow any values keep it empty)
44
allowedHeaderValues=
55
#Set which HTTP methods should be allowed (if want to allow all header names, keep it empty)
6-
allowedMethods=GET,POST
6+
allowedMethods=GET,POST,OPTIONS
77
#Set if a backslash "\" or a URL encoded backslash "%5C" should be allowed in the path or not
88
allowBackSlash=true
99
#Set if a slash "/" that is URL encoded "%2F" should be allowed in the path or not

ci/docker/ecc_resources_consumer/application-docker.properties

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,5 +196,13 @@ spring.h2.console.enabled=true
196196
spring.datasource.username=sa
197197
spring.datasource.password=file_password password
198198

199+
#CORS configuration
200+
#Allow specific origins
201+
application.cors.allowed.origins=
202+
#Allow specific HTTP methods
203+
application.cors.allowed.methods=
204+
#Allow specific headers
205+
application.cors.allowed.headers=
206+
199207
#For logging the response over WSS set to DEBUG, else leave empty
200208
#logging.level.it.eng.idsa.businesslogic.processor.receiver=

ci/docker/ecc_resources_consumer/firewall.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ allowedHeaderNames=
33
#Set which values in header names should have the exact value and allowed (if want to allow any values keep it empty)
44
allowedHeaderValues=
55
#Set which HTTP methods should be allowed (if want to allow all header names, keep it empty)
6-
allowedMethods=GET,POST
6+
allowedMethods=GET,POST,OPTIONS
77
#Set if a backslash "\" or a URL encoded backslash "%5C" should be allowed in the path or not
88
allowBackSlash=true
99
#Set if a slash "/" that is URL encoded "%2F" should be allowed in the path or not

ci/docker/ecc_resources_provider/application-docker.properties

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,5 +199,13 @@ spring.h2.console.enabled=true
199199
spring.datasource.username=sa
200200
spring.datasource.password=file_password password
201201

202+
#CORS configuration
203+
#Allow specific origins
204+
application.cors.allowed.origins=
205+
#Allow specific HTTP methods
206+
application.cors.allowed.methods=
207+
#Allow specific headers
208+
application.cors.allowed.headers=
209+
202210
#For logging the response over WSS set to DEBUG, else leave empty
203211
#logging.level.it.eng.idsa.businesslogic.processor.receiver=

0 commit comments

Comments
 (0)