Skip to content

Upgrade dependencies for v1.17.x #698

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
May 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/code-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

env:
JAVA_DISTRIBUTION: temurin
JAVA_VERSION: 17
JAVA_VERSION: 21

steps:
- name: Checkout repository
Expand All @@ -45,7 +45,7 @@ jobs:

env:
JAVA_DISTRIBUTION: temurin
JAVA_VERSION: 17
JAVA_VERSION: 21

steps:
- name: Checkout repository
Expand All @@ -72,7 +72,7 @@ jobs:

env:
JAVA_DISTRIBUTION: temurin
JAVA_VERSION: 17
JAVA_VERSION: 21

steps:
- name: Checkout repository
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
verify:
uses: FAIRDataTeam/github-workflows/.github/workflows/maven-verify.yml@v2
with:
java-version: 17
java-version: 21
# todo: enable tests when test duration has been minimized
mvn-options: "-DskipTests"
publish:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/maven-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- os: macos-14
mongo: 8
java-version:
- 17
- 21
uses: FAIRDataTeam/github-workflows/.github/workflows/maven-verify.yml@v2
with:
runner: ${{ matrix.runner.os }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

env:
JAVA_DISTRIBUTION: temurin
JAVA_VERSION: 17
JAVA_VERSION: 21

steps:
- name: Checkout repository
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

- Cleaned up Dockerfile (backport)
- Separate Github workflows for test and publish (backport)
- Upgraded to Java JDK 21 (LTS)
- Upgraded to latest dependencies

## [1.17.2]

Expand Down
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
################################################################################
# BUILD JAR

FROM maven:3-eclipse-temurin-17-focal AS builder
FROM maven:3-eclipse-temurin-21-alpine AS builder

WORKDIR /builder

Expand All @@ -16,12 +16,11 @@ RUN mvn --quiet --batch-mode --update-snapshots --fail-fast -DskipTests package
################################################################################
# BUILD IMAGE

FROM eclipse-temurin:17-jdk-focal
FROM eclipse-temurin:21-jdk-alpine

# add non-root user to run the app
# https://spring.io/guides/gs/spring-boot-docker
# on ubuntu the following creates a group with the same name as user
RUN adduser spring --system --group
RUN addgroup -S spring && adduser -S spring -G spring
USER spring:spring

WORKDIR /fdp
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ e.g. [app.fairdatapoint.org/swagger-ui.html](https://app.fairdatapoint.org/swagg

### Technology Stack

- **Java** (JDK 17)
- **Java** (JDK 21)
- **MongoDB** (4.2)
- **Maven** (3.2.5 or higher)
- **Docker** (19.03.0-ce or higher) - *for building Docker image only*
Expand Down
32 changes: 14 additions & 18 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.1</version>
<version>3.5.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>nl.dtls</groupId>
Expand Down Expand Up @@ -47,34 +47,32 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<!-- Maven -->
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>

<!-- Project related -->
<spring.rdf.migration.version>2.0.0</spring.rdf.migration.version>
<rdf-resolver.version>0.2.0</rdf-resolver.version>
<spring.security.acl.mongodb.version>6.0.0</spring.security.acl.mongodb.version>

<!-- Core -->
<springdoc.version>2.1.0</springdoc.version>
<mongock.version>5.3.1</mongock.version>
<mongodb.spring-data.version>4.1.1</mongodb.spring-data.version>
<rdf4j.version>4.3.2</rdf4j.version>
<jwt.version>0.11.5</jwt.version>
<lombok.version>1.18.28</lombok.version>
<springdoc.version>2.8.8</springdoc.version>
<mongock.version>5.5.1</mongock.version>
<rdf4j.version>5.1.3</rdf4j.version>
<jwt.version>0.12.6</jwt.version>

<!-- Test -->
<httpclient5.version>5.2.1</httpclient5.version>
<httpclient5.version>5.5</httpclient5.version>

<!-- Plugins -->
<plugin.license.version>4.2</plugin.license.version>
<plugin.license.version>5.0.0</plugin.license.version>
<plugin.jacoco.version>0.7.6.201602180812</plugin.jacoco.version>
<plugin.coveralls.version>4.3.0</plugin.coveralls.version>
<plugin.javax_xml_bind.version>2.3.1</plugin.javax_xml_bind.version>
<plugin.git_commit_id.version>6.0.0</plugin.git_commit_id.version>
<plugin.git_commit_id.version>9.0.1</plugin.git_commit_id.version>
<plugin.rdf4j_generator.version>0.2.0</plugin.rdf4j_generator.version>
<plugin.checkstyle.version>3.3.0</plugin.checkstyle.version>
<plugin.spotbugs.version>4.7.3.5</plugin.spotbugs.version>
<plugin.checkstyle.version>3.6.0</plugin.checkstyle.version>
<plugin.spotbugs.version>4.9.3.0</plugin.spotbugs.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -175,7 +173,6 @@
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<version>${mongodb.spring-data.version}</version>
</dependency>

<!-- ////////////////// -->
Expand Down Expand Up @@ -228,7 +225,6 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>

<!-- ////////////////// -->
Expand Down Expand Up @@ -347,12 +343,12 @@
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>10.12.1</version>
<version>10.24.0</version>
</dependency>
<dependency>
<groupId>io.spring.javaformat</groupId>
<artifactId>spring-javaformat-checkstyle</artifactId>
<version>0.0.39</version>
<version>0.0.45</version>
</dependency>
</dependencies>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ private MetadataSchema createSchemaFixture(
.version(VERSION)
.versionString(VERSION.toString())
.name(name)
.description("")
.definition(definition)
.targetClasses(targetClasses)
.extendSchemas(extendsSchemas)
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/nl/dtls/fairdatapoint/service/jwt/JwtService.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public class JwtService {
protected void init() {
secretKey = Base64.getEncoder().encodeToString(secretKey.getBytes());
key = new SecretKeySpec(secretKey.getBytes(), SignatureAlgorithm.HS256.getJcaName());
parser = Jwts.parserBuilder().setSigningKey(key).build();
parser = Jwts.parser().setSigningKey(key).build();
}

public String createToken(AuthDTO authDTO) {
Expand All @@ -94,27 +94,27 @@ public Authentication getAuthentication(String token) {
}

public String getUserUuid(String token) {
return parser.parseClaimsJws(token).getBody().getSubject();
return parser.parseClaimsJws(token).getPayload().getSubject();
}

public boolean validateToken(String token) {
try {
final Jws<Claims> claims = parser.parseClaimsJws(token);
return !claims.getBody().getExpiration().before(new Date());
return !claims.getPayload().getExpiration().before(new Date());
}
catch (JwtException | IllegalArgumentException exception) {
throw new UnauthorizedException("Expired or invalid JWT token");
}
}

private String buildToken(User user) {
final Claims claims = Jwts.claims().setSubject(user.getUuid());
final Claims claims = Jwts.claims().subject(user.getUuid().toString()).build();
final Date now = new Date();
final Date validity = new Date(now.getTime() + (expiration * DAY_MS));
return Jwts.builder()
.setClaims(claims)
.setIssuedAt(now)
.setExpiration(validity)
.claims(claims)
.issuedAt(now)
.expiration(validity)
.signWith(key)
.compact();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import java.util.stream.Collectors;

import static java.lang.String.format;
import static nl.dtls.fairdatapoint.entity.metadata.MetadataGetter.getUri;
import static nl.dtls.fairdatapoint.util.RdfUtil.getObjectsBy;
import static nl.dtls.fairdatapoint.util.ValueFactoryHelper.i;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import nl.dtls.fairdatapoint.utils.CustomPageImpl;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.boot.http.client.ClientHttpRequestFactorySettings;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
Expand Down Expand Up @@ -61,7 +62,8 @@ public void res302_redirectsToSwaggerUI() {
.build();

// WHEN
ResponseEntity<String> result = client.exchange(request, new ParameterizedTypeReference<>() {});
ResponseEntity<String> result = client.withRedirects(ClientHttpRequestFactorySettings.Redirects.DONT_FOLLOW)
.exchange(request, new ParameterizedTypeReference<>() {});

// THEN
assertThat("Response code is FOUND", result.getStatusCode(), is(equalTo(HttpStatus.FOUND)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
package nl.dtls.fairdatapoint.acceptance.schema;

import nl.dtls.fairdatapoint.WebIntegrationTest;
import nl.dtls.fairdatapoint.api.dto.schema.MetadataSchemaRemoteDTO;
import nl.dtls.fairdatapoint.api.dto.schema.MetadataSchemaVersionDTO;
import nl.dtls.fairdatapoint.database.mongo.migration.development.schema.data.MetadataSchemaFixtures;
import nl.dtls.fairdatapoint.database.mongo.repository.MetadataSchemaRepository;
Expand Down Expand Up @@ -73,6 +72,8 @@ private MetadataSchemaVersionDTO schemaPublicDTO1() {
.description(metadataSchemaFixtures.customSchema().getDescription())
.definition(metadataSchemaFixtures.customSchema().getDefinition())
.abstractSchema(metadataSchemaFixtures.customSchema().isAbstractSchema())
.type(metadataSchemaFixtures.customSchema().getType())
.targetClasses(metadataSchemaFixtures.customSchema().getTargetClasses())
.extendsSchemaUuids(Collections.emptyList())
.build();
}
Expand All @@ -91,6 +92,8 @@ private MetadataSchemaVersionDTO schemaPublicDTO2() {
.description(metadataSchemaFixtures.customSchema().getDescription())
.definition(metadataSchemaFixtures.customSchema().getDefinition())
.abstractSchema(metadataSchemaFixtures.customSchema().isAbstractSchema())
.type(metadataSchemaFixtures.customSchema().getType())
.targetClasses(metadataSchemaFixtures.customSchema().getTargetClasses())
.extendsSchemaUuids(Collections.emptyList())
.build();
}
Expand Down
Loading