Skip to content

Commit 797cffd

Browse files
author
Bas de Vos
committed
Upgraded to java 21, spring-boot 4
1 parent 1d21354 commit 797cffd

File tree

7 files changed

+15
-33
lines changed

7 files changed

+15
-33
lines changed

CHANGELOG.md

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,6 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
77

8-
- Instructions (for deployment instructions).
9-
- Added (for new features).
10-
- Changed (for changes in existing functionality
11-
- Deprecated (for soon-to-be removed features).
12-
- Removed (for now removed features).
13-
- Fixed (for any bug fixes).
14-
- Security (in case of vulnerabilities).
8+
## [3.0.0] 2025-12-03
9+
- Upgraded to Java 21, Spring Boot 4
1510

16-
## [Unreleased]
17-
18-
### Issues
19-
20-
- Upgraded to java 17
21-
- Updated spring from 2.4 to 2.7

owasp-suppressions.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<suppressions xmlns="https://jeremylong.github.io/DependencyCheck/dependency-suppression.1.3.xsd">
3-
<suppress>
4-
<cve>CVE-2025-48924</cve>
5-
</suppress>
63
</suppressions>

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
5252
<maven.compiler.release>21</maven.compiler.release>
5353

54-
<spring-boot.version>3.5.8</spring-boot.version>
55-
<rest-secure-starter.version>14.1.0</rest-secure-starter.version>
54+
<spring-boot.version>4.0.0</spring-boot.version>
55+
<rest-secure-starter.version>15.0.0</rest-secure-starter.version>
5656
<commons-io.version>2.21.0</commons-io.version>
5757

5858
<dependency-check-maven-plugin.version>12.1.9</dependency-check-maven-plugin.version>

src/main/java/nl/_42/max_login_attempts_spring_boot_starter/DefaultTooManyLoginAttemptsErrorHandler.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@
77
import java.util.Collections;
88

99
import jakarta.servlet.http.HttpServletResponse;
10-
1110
import nl._42.max_login_attempts_spring_boot_starter.error.TooManyLoginAttemptsErrorHandler;
12-
13-
import com.fasterxml.jackson.databind.ObjectMapper;
11+
import tools.jackson.databind.json.JsonMapper;
1412

1513
/**
1614
* Default implementation of TooManyLoginAttemptsErrorHandler.
@@ -21,7 +19,7 @@ class DefaultTooManyLoginAttemptsErrorHandler implements TooManyLoginAttemptsErr
2119

2220
@Override
2321
public void handle(HttpServletResponse response) throws IOException {
24-
ObjectMapper objectMapper = new ObjectMapper();
22+
JsonMapper objectMapper = JsonMapper.builder().build();
2523
response.setStatus(FORBIDDEN.value());
2624
response.setContentType(APPLICATION_JSON_VALUE);
2725
objectMapper.writeValue(response.getWriter(), Collections.singletonMap("errorCode", "TOO_MANY_LOGIN_ATTEMPTS"));

src/main/java/nl/_42/max_login_attempts_spring_boot_starter/filter/LoginAttemptFilter.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
import nl._42.max_login_attempts_spring_boot_starter.error.TooManyLoginAttemptsErrorHandler;
1212
import nl._42.max_login_attempts_spring_boot_starter.listener.UsernameRemoteAddressBlockedException;
1313
import nl._42.max_login_attempts_spring_boot_starter.service.LoginAttemptService;
14+
import tools.jackson.databind.json.JsonMapper;
15+
import tools.jackson.databind.node.ObjectNode;
1416

1517
import org.apache.commons.io.IOUtils;
1618
import org.springframework.beans.factory.annotation.Autowired;
@@ -19,9 +21,6 @@
1921
import org.springframework.stereotype.Component;
2022
import org.springframework.web.filter.OncePerRequestFilter;
2123

22-
import com.fasterxml.jackson.databind.ObjectMapper;
23-
import com.fasterxml.jackson.databind.node.ObjectNode;
24-
2524
/**
2625
* Filter which checks if the login request is executed while the user is already blocked
2726
* due to an excessive amount of login attempts. If so, a forbidden status with a specific
@@ -96,7 +95,7 @@ private void handleUsernameIpAddressBlocked(HttpServletResponse response) throws
9695

9796
private String readUsername(HttpServletRequest request) throws IOException {
9897
String loginFormJson = IOUtils.toString(request.getReader());
99-
ObjectNode node = new ObjectMapper().readValue(loginFormJson, ObjectNode.class);
100-
return node.get("username").asText();
98+
ObjectNode node = JsonMapper.builder().build().readValue(loginFormJson, ObjectNode.class);
99+
return node.get("username").asString();
101100
}
102101
}

src/test/java/nl/_42/max_login_attempts_spring_boot_starter/AbstractWebIntegrationTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.log;
88
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup;
99

10+
import tools.jackson.databind.ObjectMapper;
11+
1012
import org.junit.jupiter.api.BeforeEach;
1113
import org.springframework.beans.factory.annotation.Autowired;
1214
import org.springframework.test.web.servlet.MockMvc;
1315
import org.springframework.web.context.WebApplicationContext;
1416

15-
import com.fasterxml.jackson.databind.ObjectMapper;
16-
1717
public abstract class AbstractWebIntegrationTest extends AbstractSpringTest {
1818

1919
@Autowired

src/test/java/nl/_42/max_login_attempts_spring_boot_starter/TestConfiguration.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import nl._42.restsecure.autoconfigure.HttpSecurityCustomizer;
77
import nl._42.restsecure.autoconfigure.RestAuthenticationFilter;
88
import nl._42.restsecure.autoconfigure.WebSecurityAutoConfig;
9+
import tools.jackson.databind.json.JsonMapper;
910

1011
import org.springframework.beans.factory.annotation.Autowired;
1112
import org.springframework.context.annotation.Bean;
@@ -18,8 +19,6 @@
1819
import org.springframework.security.crypto.password.PasswordEncoder;
1920
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
2021

21-
import com.fasterxml.jackson.databind.ObjectMapper;
22-
2322
@Configuration
2423
@ComponentScan(value = "nl._42.max_login_attempts_spring_boot_starter")
2524
@Import({ WebSecurityAutoConfig.class })
@@ -36,8 +35,8 @@ public Clock clock() {
3635
}
3736

3837
@Bean
39-
public ObjectMapper objectMapper() {
40-
return new ObjectMapper();
38+
public JsonMapper objectMapper() {
39+
return JsonMapper.builder().build();
4140
}
4241

4342
@Bean

0 commit comments

Comments
 (0)