Skip to content

Commit 88e9b4a

Browse files
author
Dennis Labordus
authored
Merge pull request #116 from com-pas/develop
New release building native image
2 parents d14cc7f + 1013c26 commit 88e9b4a

File tree

15 files changed

+120
-28
lines changed

15 files changed

+120
-28
lines changed

.github/workflows/release-project.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ jobs:
2424
shell: bash
2525
# Extra the tagname form the git reference, value of GITHUB_REF will be something like refs/tags/<tag_name>.
2626
run: echo "##[set-output name=tagname;]$(echo ${GITHUB_REF##*/})"
27-
- name: Set up JDK 11
28-
uses: actions/setup-[email protected]
27+
- name: Install graalvm
28+
uses: DeLaGuardo/setup-[email protected]
2929
with:
30-
distribution: 'zulu'
31-
java-version: '11'
30+
graalvm: '21.2.0'
31+
java: 'java11'
32+
- name: Install native-image
33+
run: gu install native-image
3234
- name: Create custom Maven Settings.xml
3335
uses: whelk-io/maven-settings-xml-action@v20
3436
with:
@@ -39,6 +41,6 @@ jobs:
3941
env:
4042
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4143
- name: Deploy with Maven to GitHub Packages and Docker Hub
42-
run: ./mvnw -B -s custom_maven_settings.xml -Prelease clean deploy
44+
run: ./mvnw -B -s custom_maven_settings.xml -Prelease,native clean deploy
4345
env:
4446
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,15 @@ Below environment variable(s) can be used to configure the connection to BaseX,
8383
| BASEX_USERNAME | basex.username | Username under which the application logs in. | admin |
8484
| BASEX_PASSWORD | basex.password | Password of the username used above. | admin |
8585

86-
Below environment variable(s) can be used to configure which claims are used to fill the UserInfo response.
87-
88-
| Environment variable | Java Property | Description | Example |
89-
| -------------------------------- | ------------------------------ | --------------------------------------------- | ---------------- |
90-
| USERINFO_NAME_CLAIMNAME | compas.userinfo.name.claimname | The Name of the user logged in. | name |
91-
| USERINFO_WHO_CLAIMNAME | compas.userinfo.who.claimname | The Name of the user used in the Who History. | name |
86+
Below environment variable(s) can be used to configure which claims and information are used to fill the UserInfo
87+
response.
88+
89+
| Environment variable | Java Property | Description | Example |
90+
| -------------------------------- | ------------------------------- | ----------------------------------------------------------- | ---------------- |
91+
| USERINFO_NAME_CLAIMNAME | compas.userinfo.name.claimname | The Name of the user logged in. | name |
92+
| USERINFO_WHO_CLAIMNAME | compas.userinfo.who.claimname | The Name of the user used in the Who History. | name |
93+
| USERINFO_SESSION_WARNING | compas.userinfo.session.warning | Number of minutes a Session Warning can be displayed. | 20 |
94+
| USERINFO_SESSION_EXPIRES | compas.userinfo.session.expires | Number of minutes a Session Expires to display in Frontend. | 30 |
9295

9396
## Security
9497

app/pom.xml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ SPDX-License-Identifier: Apache-2.0
1919

2020
<properties>
2121
<quarkus.platform.version>2.2.3.Final</quarkus.platform.version>
22+
23+
<quarkus.container-image.group>lfenergycompas</quarkus.container-image.group>
24+
<quarkus.container-image.name>compas-scl-data-service</quarkus.container-image.name>
2225
</properties>
2326

2427
<dependencyManagement>
@@ -156,7 +159,9 @@ SPDX-License-Identifier: Apache-2.0
156159

157160
<properties>
158161
<quarkus.package.type>native</quarkus.package.type>
159-
<quarkus.native.container-build>true</quarkus.native.container-build> <!-- Allows for creating a Linux executable without GraalVM being installed -->
162+
<!-- Allows for creating a Linux executable without GraalVM being installed -->
163+
<quarkus.native.container-build>true</quarkus.native.container-build>
164+
<quarkus.native.additional-build-args>-H:ReflectionConfigurationFiles=reflection-config.json</quarkus.native.additional-build-args>
160165
</properties>
161166

162167
<build>
@@ -202,8 +207,6 @@ SPDX-License-Identifier: Apache-2.0
202207
<properties>
203208
<!-- Properties only used for publishing a native docker image (default to Docker Hub) -->
204209
<quarkus.container-image.build>true</quarkus.container-image.build>
205-
<quarkus.container-image.group>lfenergycompas</quarkus.container-image.group>
206-
<quarkus.container-image.name>compas-scl-data-service</quarkus.container-image.name>
207210
<quarkus.container-image.push>true</quarkus.container-image.push>
208211
<quarkus.container-image.additional-tags>latest</quarkus.container-image.additional-tags>
209212
</properties>

app/src/main/java/org/lfenergy/compas/scl/data/rest/UserInfoProperties.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,10 @@ public interface UserInfoProperties {
1313

1414
@WithName("who.claimname")
1515
String who();
16+
17+
@WithName("session.warning")
18+
int sessionWarning();
19+
20+
@WithName("session.expires")
21+
int sessionExpires();
1622
}

app/src/main/java/org/lfenergy/compas/scl/data/rest/v1/CompasCommonResource.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ public UserInfoResponse getUserInfo(@HeaderParam("Authorization") String authHea
6666

6767
var response = new UserInfoResponse();
6868
response.setName(jsonWebToken.getClaim(userInfoProperties.name()));
69+
response.setSessionWarning(userInfoProperties.sessionWarning());
70+
response.setSessionExpires(userInfoProperties.sessionExpires());
6971
return response;
7072
}
7173
}

app/src/main/java/org/lfenergy/compas/scl/data/rest/v1/model/UserInfoResponse.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// SPDX-License-Identifier: Apache-2.0
44
package org.lfenergy.compas.scl.data.rest.v1.model;
55

6+
import org.eclipse.microprofile.openapi.annotations.media.Schema;
7+
68
import javax.xml.bind.annotation.XmlAccessType;
79
import javax.xml.bind.annotation.XmlAccessorType;
810
import javax.xml.bind.annotation.XmlElement;
@@ -13,14 +15,39 @@
1315
@XmlRootElement(name = "UserInfoResponse", namespace = SCL_DATA_SERVICE_V1_NS_URI)
1416
@XmlAccessorType(XmlAccessType.FIELD)
1517
public class UserInfoResponse {
18+
@Schema(description = "The name of the user retrieved from the JWT Claim.")
1619
@XmlElement(name = "Name", namespace = SCL_DATA_SERVICE_V1_NS_URI)
1720
private String name;
1821

22+
@Schema(description = "The number of minutes when the frontend isn't used and a warning message will be shown.")
23+
@XmlElement(name = "SessionWarning", namespace = SCL_DATA_SERVICE_V1_NS_URI)
24+
private int sessionWarning;
25+
26+
@Schema(description = "The number of minutes when the session will expire and a expired message will be shown if the frontend isn't used.")
27+
@XmlElement(name = "SessionExpires", namespace = SCL_DATA_SERVICE_V1_NS_URI)
28+
private int sessionExpires;
29+
1930
public String getName() {
2031
return name;
2132
}
2233

2334
public void setName(String name) {
2435
this.name = name;
2536
}
37+
38+
public int getSessionWarning() {
39+
return sessionWarning;
40+
}
41+
42+
public void setSessionWarning(int sessionWarning) {
43+
this.sessionWarning = sessionWarning;
44+
}
45+
46+
public int getSessionExpires() {
47+
return sessionExpires;
48+
}
49+
50+
public void setSessionExpires(int sessionExpires) {
51+
this.sessionExpires = sessionExpires;
52+
}
2653
}

app/src/main/resources/application.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
compas.userinfo.name.claimname = ${USERINFO_NAME_CLAIMNAME:name}
66
compas.userinfo.who.claimname = ${USERINFO_WHO_CLAIMNAME:name}
7+
compas.userinfo.session.warning = ${USERINFO_SESSION_WARNING:10}
8+
compas.userinfo.session.expires = ${USERINFO_SESSION_EXPIRES:15}
79

810
quarkus.http.cors = false
911
quarkus.http.root-path = /compas-scl-data-service/
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[
2+
{
3+
"name" : "org.lfenergy.compas.scl.data.model.ObjectFactory",
4+
"allDeclaredMethods" : true,
5+
"allPublicMethods" : true
6+
}
7+
]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-FileCopyrightText: 2021 Alliander N.V.
2+
3+
SPDX-License-Identifier: Apache-2.0

app/src/native-test/java/org/lfenergy/compas/scl/data/NativeHealthCheckIT.java

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)