diff --git a/pom.xml b/pom.xml
index f433c5a..fc02338 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
org.springframework.boot
spring-boot-starter-parent
- 2.7.17
+ 3.3.0
@@ -20,7 +20,9 @@
2023
- 1.8
+ 21
+ 1.19.8
+ 6.2.0-M3
@@ -52,7 +54,7 @@
org.springframework.boot
spring-boot-configuration-processor
- 2.7.6
+ 3.2.6
@@ -70,25 +72,24 @@
org.springframework.security
spring-security-test
- 5.7.7
test
org.testcontainers
testcontainers
- 1.17.6
+ ${testcontainers.version}
test
org.testcontainers
junit-jupiter
- 1.17.6
+ ${testcontainers.version}
test
org.testcontainers
postgresql
- 1.17.6
+ ${testcontainers.version}
test
@@ -110,7 +111,7 @@
com.giffing.bucket4j.spring.boot.starter
bucket4j-spring-boot-starter
- 0.8.1
+ 0.12.7
org.springframework.boot
@@ -119,26 +120,26 @@
com.github.ben-manes.caffeine
caffeine
- 2.9.3
+ 3.1.8
com.github.ben-manes.caffeine
jcache
- 2.9.3
+ 3.1.8
org.springdoc
- springdoc-openapi-ui
- 1.7.0
+ springdoc-openapi-starter-webmvc-ui
+ 2.5.0
org.modelmapper
modelmapper
- 3.1.1
+ 3.2.0
com.github.java-json-tools
@@ -148,7 +149,7 @@
com.google.guava
guava
- 32.0.0-jre
+ 33.2.1-jre
@@ -157,13 +158,6 @@
spring-boot-starter-validation
-
-
- com.vladmihalcea
- hibernate-types-52
- 2.21.1
-
-
org.postgresql
@@ -232,4 +226,29 @@
+
+
+ maven_central
+ Maven Central
+ https://repo.maven.apache.org/maven2/
+
+
+ spring-milestones
+ Spring Milestones
+ https://repo.spring.io/milestone
+
+ false
+
+
+
+
+
+ spring-milestones
+ Spring Milestones
+ https://repo.spring.io/milestone
+
+ false
+
+
+
diff --git a/src/main/java/com/lucasjosino/hawapi/configs/security/SecurityConfig.java b/src/main/java/com/lucasjosino/hawapi/configs/security/SecurityConfig.java
index c11785d..9da49fc 100644
--- a/src/main/java/com/lucasjosino/hawapi/configs/security/SecurityConfig.java
+++ b/src/main/java/com/lucasjosino/hawapi/configs/security/SecurityConfig.java
@@ -3,8 +3,10 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
+import org.springframework.security.config.Customizer;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
-import org.springframework.security.config.annotation.web.configurers.oauth2.server.resource.OAuth2ResourceServerConfigurer;
+import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
+import org.springframework.security.config.annotation.web.configurers.HeadersConfigurer;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
@@ -36,31 +38,27 @@ public class SecurityConfig {
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
return http
- .headers(req ->
- req.frameOptions().sameOrigin()
+ .headers(req -> req
+ .frameOptions((HeadersConfigurer.FrameOptionsConfig::sameOrigin))
)
- .cors()
- .and()
- .csrf().disable()
- .sessionManagement()
- .sessionCreationPolicy(SessionCreationPolicy.STATELESS)
- .and()
- .authorizeRequests(req -> req
+ .csrf((AbstractHttpConfigurer::disable))
+ .sessionManagement((session) -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
+ .authorizeHttpRequests(req -> req
// API Docs
- .antMatchers(HttpMethod.GET, "/v3/api-docs", "/v3/api-docs/**").permitAll()
+ .requestMatchers(HttpMethod.GET, "/v3/api-docs", "/v3/api-docs/**").permitAll()
// Errors
- .antMatchers(HttpMethod.GET, "/error").permitAll()
+ .requestMatchers(HttpMethod.GET, "/error").permitAll()
// Auth
- .antMatchers(HttpMethod.POST, "/api/v1/auth/**").permitAll()
+ .requestMatchers(HttpMethod.POST, "/api/v1/auth/**").permitAll()
// API
- .antMatchers(HttpMethod.GET, "/api/**").permitAll()
- .antMatchers(HttpMethod.PATCH, "/api/**").hasAnyRole("ADMIN", "MAINTAINER")
- .antMatchers(HttpMethod.POST, "/api/**").hasAnyRole("ADMIN", "MAINTAINER")
- .antMatchers(HttpMethod.DELETE, "/api/**").hasAnyRole("ADMIN", "MAINTAINER")
+ .requestMatchers(HttpMethod.GET, "/api/**").permitAll()
+ .requestMatchers(HttpMethod.PATCH, "/api/**").hasAnyRole("ADMIN", "MAINTAINER")
+ .requestMatchers(HttpMethod.POST, "/api/**").hasAnyRole("ADMIN", "MAINTAINER")
+ .requestMatchers(HttpMethod.DELETE, "/api/**").hasAnyRole("ADMIN", "MAINTAINER")
// Others endpoints
.anyRequest().permitAll()
)
- .oauth2ResourceServer(OAuth2ResourceServerConfigurer::jwt)
+ .oauth2ResourceServer((oauth2) -> oauth2.jwt(Customizer.withDefaults()))
.build();
}
diff --git a/src/main/java/com/lucasjosino/hawapi/controllers/advisor/ControllerAdvisor.java b/src/main/java/com/lucasjosino/hawapi/controllers/advisor/ControllerAdvisor.java
index 311417e..5ef3b9d 100644
--- a/src/main/java/com/lucasjosino/hawapi/controllers/advisor/ControllerAdvisor.java
+++ b/src/main/java/com/lucasjosino/hawapi/controllers/advisor/ControllerAdvisor.java
@@ -10,8 +10,10 @@
import com.lucasjosino.hawapi.exceptions.auth.UserUnauthorizedException;
import com.lucasjosino.hawapi.exceptions.specification.OperatorNotFoundException;
import com.lucasjosino.hawapi.models.http.ExceptionResponse;
+import jakarta.servlet.http.HttpServletRequest;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
+import org.springframework.http.HttpStatusCode;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.ObjectError;
import org.springframework.web.bind.MethodArgumentNotValidException;
@@ -23,7 +25,6 @@
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
-import javax.servlet.http.HttpServletRequest;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.Map;
@@ -75,7 +76,7 @@ public ResponseEntity