From e6e30df6e6b9a31f07e4d15917a799bd7ef3fb92 Mon Sep 17 00:00:00 2001
From: Damien Trouillet <4112390+dtrouillet@users.noreply.github.com>
Date: Wed, 31 Jul 2024 23:41:40 +0200
Subject: [PATCH 1/6] Feature/spring boot 3 (#347)
* feat(spring): upgrade
* feat(spring): delete javax
* build(jdk): remove jdk under 17
* build(jdk): remove jdk under 17
* feat(spring): migrate authenticationManager
* feat(spring): migrate oauth2 - in progress
* feat(oauth): enable new oauth
* feat(readme): add keycloak info
* build(ut): fix some ut
* fix(auth): add workaround to get csrf on cookie
* fix(auth): add oauth2 converter
* fix(LocalDate): Change Jsr310JpaConverters.LocalDateConverter.class for Jsr310JpaConverters.LocalDateTimeConverter.class
* fix(jobrunr): change default poll interval to 10s
---
.github/workflows/maven.yml | 2 +-
README.md | 6 +
pom.xml | 41 +++---
settings.xml | 8 +-
.../java/fr/icdc/ebad/EbadApplication.java | 7 +-
.../ebad/config/JobRunrConfiguration.java | 40 ++++++
.../java/fr/icdc/ebad/config/MailConfig.java | 2 +-
.../ebad/config/apikey/ApiSecurityConfig.java | 11 +-
.../ebad/config/jwt/JwtConfiguration.java | 107 +++++++++-------
.../CustomJwtAuthenticationConverter.java | 102 +++++++++++++++
.../oauth/EbadAuthoritiesExtractor.java | 32 -----
.../config/oauth/EbadPrincipalExtractor.java | 72 -----------
.../config/oauth/Oauth2Configuration.java | 118 ++++++++++--------
.../config/properties/EbadProperties.java | 5 +-
.../config/websocket/WebsocketConfig.java | 12 +-
.../ebad/domain/AbstractAuditingEntity.java | 8 +-
.../ebad/domain/AccreditationRequest.java | 23 ++--
.../java/fr/icdc/ebad/domain/Actualite.java | 17 ++-
.../java/fr/icdc/ebad/domain/ApiToken.java | 15 ++-
.../java/fr/icdc/ebad/domain/Application.java | 24 ++--
.../java/fr/icdc/ebad/domain/Authority.java | 18 +--
src/main/java/fr/icdc/ebad/domain/Batch.java | 30 ++---
src/main/java/fr/icdc/ebad/domain/Chaine.java | 26 ++--
.../icdc/ebad/domain/ChaineAssociation.java | 17 ++-
.../icdc/ebad/domain/ChaineAssociationId.java | 3 +-
.../java/fr/icdc/ebad/domain/Directory.java | 21 ++--
.../fr/icdc/ebad/domain/Environnement.java | 36 ++++--
.../fr/icdc/ebad/domain/GlobalSetting.java | 9 +-
.../java/fr/icdc/ebad/domain/Identity.java | 21 +++-
.../java/fr/icdc/ebad/domain/LogBatch.java | 15 ++-
src/main/java/fr/icdc/ebad/domain/Norme.java | 17 ++-
.../fr/icdc/ebad/domain/Notification.java | 23 ++--
.../java/fr/icdc/ebad/domain/Scheduling.java | 19 ++-
.../java/fr/icdc/ebad/domain/Terminal.java | 18 +--
.../java/fr/icdc/ebad/domain/TypeFichier.java | 21 ++--
.../fr/icdc/ebad/domain/UsageApplication.java | 15 ++-
.../icdc/ebad/domain/UsageApplicationId.java | 4 +-
src/main/java/fr/icdc/ebad/domain/User.java | 32 ++---
.../icdc/ebad/repository/UserRepository.java | 4 +-
.../fr/icdc/ebad/security/SecurityUtils.java | 4 +
.../fr/icdc/ebad/security/jwt/JWTFilter.java | 10 +-
.../icdc/ebad/security/jwt/TokenProvider.java | 2 +-
.../service/AccreditationRequestService.java | 8 +-
.../fr/icdc/ebad/service/ChaineService.java | 3 +-
.../ebad/service/EnvironnementService.java | 4 +-
.../fr/icdc/ebad/service/MailService.java | 6 +-
.../ebad/service/NotificationService.java | 4 +-
.../fr/icdc/ebad/service/PluginService.java | 3 +-
.../fr/icdc/ebad/service/UserService.java | 7 +-
.../java/fr/icdc/ebad/web/ResponseUtil.java | 1 -
.../web/filter/CachingHttpHeadersFilter.java | 16 +--
.../icdc/ebad/web/rest/AccountResource.java | 1 -
.../rest/AccreditationRequestResource.java | 12 +-
.../icdc/ebad/web/rest/ApiTokenResource.java | 13 +-
.../fr/icdc/ebad/web/rest/BatchResource.java | 12 +-
.../icdc/ebad/web/rest/DirectoryResource.java | 14 ++-
.../icdc/ebad/web/rest/IdentityResource.java | 13 +-
.../fr/icdc/ebad/web/rest/NormResource.java | 13 +-
.../ebad/web/rest/SchedulingResource.java | 12 +-
.../icdc/ebad/web/rest/UserJWTController.java | 3 +-
.../fr/icdc/ebad/web/rest/UserResource.java | 2 +-
.../web/rest/dto/AccreditationRequestDto.java | 4 +-
.../icdc/ebad/web/rest/dto/ApiTokenDto.java | 3 +-
.../fr/icdc/ebad/web/rest/dto/BatchDto.java | 6 +-
.../web/rest/dto/CompleteIdentityDto.java | 3 +-
.../dto/CreationAccreditationRequestDto.java | 3 +-
.../web/rest/dto/CreationSchedulingDto.java | 5 +-
.../fr/icdc/ebad/web/rest/dto/LoginDto.java | 5 +-
.../ebad/web/rest/dto/ManagedUserDto.java | 3 +-
.../fr/icdc/ebad/web/rest/dto/NormeDto.java | 3 +-
.../ebad/web/rest/dto/NotificationDto.java | 5 +-
.../ebad/web/rest/dto/PublicIdentityDto.java | 3 +-
.../dto/ResponseAccreditationRequestDto.java | 3 +-
.../ebad/web/rest/dto/UserAccountDto.java | 8 +-
.../icdc/ebad/web/rest/errors/ApiError.java | 3 +-
.../web/rest/errors/ExceptionTranslator.java | 33 +++--
.../AccreditationRequestValidator.java | 5 +-
.../validator/AccreditationValidator.java | 7 +-
.../resources/config/application-local.yml | 2 +-
.../resources/config/application-oauth.yaml | 6 +
src/main/resources/config/application.yml | 8 +-
.../permission/PermissionIdentityTest.java | 8 +-
.../AccreditationRequestServiceTest.java | 14 +--
.../icdc/ebad/service/ChaineServiceTest.java | 2 +-
.../ebad/service/DirectoryServiceTest.java | 5 +-
.../service/EnvironnementServiceTest.java | 17 ++-
.../fr/icdc/ebad/service/MailServiceTest.java | 23 ++--
.../ebad/service/jpa/BatchServiceJpaTest.java | 14 ++-
.../web/rest/ExceptionTranslatorTest.java | 15 +--
.../web/rest/NotificationResourceTest.java | 10 +-
.../fr/icdc/ebad/web/rest/WebsocketTest.java | 15 ---
.../resources/config/application-test.yml | 1 +
92 files changed, 799 insertions(+), 607 deletions(-)
create mode 100644 src/main/java/fr/icdc/ebad/config/JobRunrConfiguration.java
create mode 100644 src/main/java/fr/icdc/ebad/config/oauth/CustomJwtAuthenticationConverter.java
delete mode 100644 src/main/java/fr/icdc/ebad/config/oauth/EbadAuthoritiesExtractor.java
delete mode 100644 src/main/java/fr/icdc/ebad/config/oauth/EbadPrincipalExtractor.java
create mode 100644 src/main/resources/config/application-oauth.yaml
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index de4b6159..035a0053 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
- java: [15, 16, 17 ]
+ java: [ 17, 19 ]
steps:
- uses: actions/checkout@v1
- name: Cache Maven Repo
diff --git a/README.md b/README.md
index 8330298e..79f44a26 100644
--- a/README.md
+++ b/README.md
@@ -147,6 +147,12 @@ We use cypress for end to end tests with other ebad-front project
Add additional notes about how to deploy this on a live system
+### Keycloak
+helm install keycloak -f values.yaml oci://registry-1.docker.io/bitnamicharts/keycloak
+ingress:
+ enabled: true
+ hostname: idp.local
+
## Built With
diff --git a/pom.xml b/pom.xml
index 0b90608e..5fccf74c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
spring-boot-starter-parent
org.springframework.boot
- 2.7.5
+ 3.0.0
@@ -61,8 +61,8 @@
7.0.0.CR1
${project.build.directory}/test-results
0.8.0
+ 5.3.1
3.9.0
- 4.0.10
@@ -71,7 +71,12 @@
org.bouncycastle
- bcprov-jdk15on
+ bcprov-jdk15to18
+ 1.73
+
+
+ org.bouncycastle
+ bcpkix-jdk15on
1.70
@@ -131,11 +136,6 @@
com.fasterxml.jackson.datatype
jackson-datatype-json-org
-
- com.fasterxml.jackson.datatype
- jackson-datatype-joda
- 2.15.3
-
com.google.code.findbugs
jsr305
@@ -217,26 +217,32 @@
org.ehcache
ehcache
+ 3.10.6
- org.hibernate
+ org.hibernate.orm
hibernate-jcache
+ 6.1.5.Final
org.ehcache
ehcache-transactions
+ 3.10.6
- org.hibernate
+ org.hibernate.orm
hibernate-envers
+ 6.1.5.Final
org.hibernate.validator
hibernate-validator
+ 8.0.0.Final
org.hibernate
hibernate-entitymanager
+ 5.6.12.Final
@@ -311,11 +317,12 @@
spring-security-messaging
- org.springframework.security.oauth.boot
- spring-security-oauth2-autoconfigure
- 2.6.8
+ org.springframework.boot
+ spring-boot-starter-oauth2-resource-server
+ 3.0.6
+
org.springframework.security
spring-security-core
@@ -383,17 +390,20 @@
com.querydsl
querydsl-apt
+ jakarta
5.0.0
com.querydsl
querydsl-jpa
+ jakarta
5.0.0
+
org.springframework.data
spring-data-commons
- 2.7.5
+ 3.0.0
org.springdoc
@@ -468,7 +478,7 @@
org.liquibase
liquibase-core
- 4.12.0
+ 4.17.2
@@ -485,6 +495,7 @@
mapstruct
1.5.5.Final
+
diff --git a/settings.xml b/settings.xml
index b4358e63..c6447689 100644
--- a/settings.xml
+++ b/settings.xml
@@ -21,13 +21,13 @@
github-public
- ${env.USERNAME}
- ${env.PASSWORD}
+ ${env.GITHUB_USERNAME}
+ ${env.GITHUB_pASSWORD}
github
- ${env.USERNAME}
- ${env.PASSWORD}
+ ${env.GITHUB_USERNAME}
+ ${env.GITHUB_PASSWORD}
diff --git a/src/main/java/fr/icdc/ebad/EbadApplication.java b/src/main/java/fr/icdc/ebad/EbadApplication.java
index 17460d0c..30989da9 100644
--- a/src/main/java/fr/icdc/ebad/EbadApplication.java
+++ b/src/main/java/fr/icdc/ebad/EbadApplication.java
@@ -2,6 +2,7 @@
import fr.icdc.ebad.config.properties.EbadProperties;
import fr.icdc.ebad.domain.Application;
+import jakarta.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springdoc.data.rest.SpringDocDataRestConfiguration;
@@ -9,16 +10,18 @@
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.FilterType;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
-import javax.annotation.PostConstruct;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;
-@SpringBootApplication(exclude = SpringDocDataRestConfiguration.class)
+@SpringBootApplication
+@ComponentScan(excludeFilters={@ComponentScan.Filter(type= FilterType.ASSIGNABLE_TYPE, value=SpringDocDataRestConfiguration.class)})
@EnableConfigurationProperties(EbadProperties.class)
@EnableAsync
@EnableScheduling
diff --git a/src/main/java/fr/icdc/ebad/config/JobRunrConfiguration.java b/src/main/java/fr/icdc/ebad/config/JobRunrConfiguration.java
new file mode 100644
index 00000000..d8f7e50c
--- /dev/null
+++ b/src/main/java/fr/icdc/ebad/config/JobRunrConfiguration.java
@@ -0,0 +1,40 @@
+package fr.icdc.ebad.config;
+
+import org.jobrunr.jobs.mappers.JobMapper;
+import org.jobrunr.spring.autoconfigure.JobRunrAutoConfiguration;
+import org.jobrunr.spring.autoconfigure.storage.JobRunrSqlStorageAutoConfiguration;
+import org.jobrunr.storage.StorageProvider;
+import org.jobrunr.storage.StorageProviderUtils;
+import org.jobrunr.storage.sql.common.DefaultSqlStorageProvider;
+import org.jobrunr.storage.sql.h2.H2StorageProvider;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Import;
+
+import javax.sql.DataSource;
+
+@Configuration
+@Import({JobRunrSqlStorageAutoConfiguration.class, JobRunrAutoConfiguration.class})
+public class JobRunrConfiguration {
+
+ private final DataSource dataSource;
+
+ public JobRunrConfiguration(DataSource dataSource) {
+ this.dataSource = dataSource;
+ }
+// @Bean
+// public StorageProvider storageProvider(JobMapper jobMapper) {
+//
+// DefaultSqlStorageProvider storageProvider = new DefaultSqlStorageProvider(dataSource, new AnsiDialect(), StorageProviderUtils.DatabaseOptions.CREATE);
+// storageProvider.setJobMapper(jobMapper);
+// return storageProvider;
+// }
+
+ @Bean
+ public StorageProvider storageProvider2(JobMapper jobMapper) {
+
+ DefaultSqlStorageProvider storageProvider = new H2StorageProvider(dataSource, StorageProviderUtils.DatabaseOptions.CREATE);
+ storageProvider.setJobMapper(jobMapper);
+ return storageProvider;
+ }
+}
diff --git a/src/main/java/fr/icdc/ebad/config/MailConfig.java b/src/main/java/fr/icdc/ebad/config/MailConfig.java
index e2883536..0c58bb87 100644
--- a/src/main/java/fr/icdc/ebad/config/MailConfig.java
+++ b/src/main/java/fr/icdc/ebad/config/MailConfig.java
@@ -3,7 +3,7 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ResourceBundleMessageSource;
-import org.thymeleaf.spring5.SpringTemplateEngine;
+import org.thymeleaf.spring6.SpringTemplateEngine;
import org.thymeleaf.templateresolver.ITemplateResolver;
@Configuration
diff --git a/src/main/java/fr/icdc/ebad/config/apikey/ApiSecurityConfig.java b/src/main/java/fr/icdc/ebad/config/apikey/ApiSecurityConfig.java
index c614fd6c..492d8f5a 100644
--- a/src/main/java/fr/icdc/ebad/config/apikey/ApiSecurityConfig.java
+++ b/src/main/java/fr/icdc/ebad/config/apikey/ApiSecurityConfig.java
@@ -7,14 +7,14 @@
import org.springframework.core.annotation.Order;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
-import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
+import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.authentication.preauth.RequestHeaderAuthenticationFilter;
@Configuration
@EnableWebSecurity
@Order(2)
-public class ApiSecurityConfig extends WebSecurityConfigurerAdapter {
+public class ApiSecurityConfig {
private final ApiKeyAuthenticationManager apiKeyAuthenticationManager;
private final EbadProperties ebadProperties;
@@ -35,11 +35,11 @@ public RequestHeaderAuthenticationFilter requestHeaderAuthenticationFilter() {
return requestHeaderAuthenticationFilter;
}
- @Override
- protected void configure(HttpSecurity http) throws Exception {
+ @Bean
+ public SecurityFilterChain configure(HttpSecurity http) throws Exception {
// @formatter:off
http
- .requestMatcher(request -> {
+ .securityMatcher(request -> {
String auth = request.getHeader(ebadProperties.getSecurity().getApiKeyHeaderName());
return (auth != null);
})
@@ -51,5 +51,6 @@ protected void configure(HttpSecurity http) throws Exception {
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS);
// @formatter:on
+ return http.build();
}
}
diff --git a/src/main/java/fr/icdc/ebad/config/jwt/JwtConfiguration.java b/src/main/java/fr/icdc/ebad/config/jwt/JwtConfiguration.java
index 42dda381..27f723d6 100644
--- a/src/main/java/fr/icdc/ebad/config/jwt/JwtConfiguration.java
+++ b/src/main/java/fr/icdc/ebad/config/jwt/JwtConfiguration.java
@@ -4,116 +4,135 @@
import fr.icdc.ebad.security.jwt.JWTConfigurer;
import fr.icdc.ebad.security.jwt.TokenProvider;
import org.apache.commons.compress.utils.Lists;
-import org.springframework.beans.factory.BeanInitializationException;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Profile;
import org.springframework.core.annotation.Order;
import org.springframework.core.env.Environment;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
-import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
+import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
-import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.password.PasswordEncoder;
+import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.csrf.CookieCsrfTokenRepository;
+import org.springframework.security.web.csrf.CsrfTokenRequestAttributeHandler;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.CorsConfigurationSource;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
-import org.zalando.problem.spring.web.advice.security.SecurityProblemSupport;
-import javax.annotation.PostConstruct;
import java.util.Arrays;
+
@Profile(Constants.SPRING_PROFILE_JWT)
@Configuration
-@Import(SecurityProblemSupport.class)
+//@Import(SecurityProblemSupport.class)
@EnableWebSecurity
-@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
+@EnableMethodSecurity(prePostEnabled = true, securedEnabled = true)
@Order(3)
-public class JwtConfiguration extends WebSecurityConfigurerAdapter {
+public class JwtConfiguration {
private final AuthenticationManagerBuilder authenticationManagerBuilder;
private final UserDetailsService userDetailsService;
private final TokenProvider tokenProvider;
- private final SecurityProblemSupport problemSupport;
+// private final SecurityProblemSupport problemSupport;
private final Environment environment;
private final PasswordEncoder passwordEncoder;
- public JwtConfiguration(AuthenticationManagerBuilder authenticationManagerBuilder, UserDetailsService userDetailsService, TokenProvider tokenProvider, SecurityProblemSupport problemSupport, Environment environment, PasswordEncoder passwordEncoder) {
+ public JwtConfiguration(AuthenticationManagerBuilder authenticationManagerBuilder, UserDetailsService userDetailsService, TokenProvider tokenProvider,
+// SecurityProblemSupport problemSupport,
+ Environment environment, PasswordEncoder passwordEncoder) {
this.authenticationManagerBuilder = authenticationManagerBuilder;
this.userDetailsService = userDetailsService;
this.tokenProvider = tokenProvider;
- this.problemSupport = problemSupport;
+// this.problemSupport = problemSupport;
this.environment = environment;
this.passwordEncoder = passwordEncoder;
}
- @PostConstruct
- public void init() {
- try {
- authenticationManagerBuilder
- .userDetailsService(userDetailsService)
- .passwordEncoder(passwordEncoder);
- } catch (Exception e) {
- throw new BeanInitializationException("Security configuration failed", e);
- }
- }
+// @PostConstruct
+// public void init() {
+// try {
+// authenticationManagerBuilder
+// .userDetailsService(userDetailsService)
+// .passwordEncoder(passwordEncoder);
+// } catch (Exception e) {
+// throw new BeanInitializationException("Security configuration failed", e);
+// }
+// }
+
+// @Bean
+// public AuthenticationManager customAuthenticationManager() throws Exception {
+// return new AuthenticationManager();
+// }
@Bean
- public AuthenticationManager customAuthenticationManager() throws Exception {
- return authenticationManager();
+ public AuthenticationManager customAuthenticationManager(HttpSecurity http) throws Exception {
+ // Configure AuthenticationManagerBuilder
+ AuthenticationManagerBuilder authenticationManagerBuilder = http.getSharedObject(AuthenticationManagerBuilder.class);
+ authenticationManagerBuilder.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder);
+ // Get AuthenticationManager
+ return authenticationManagerBuilder.build();
}
- @Override
- protected void configure(HttpSecurity http) throws Exception {
+ @Bean
+ public SecurityFilterChain configure(HttpSecurity http) throws Exception {
CookieCsrfTokenRepository cookieCsrfTokenRepository = CookieCsrfTokenRepository.withHttpOnlyFalse();
cookieCsrfTokenRepository.setCookiePath("/");
cookieCsrfTokenRepository.setHeaderName("X-XSRF-TOKEN");
cookieCsrfTokenRepository.setCookieName("XSRF-TOKEN");
cookieCsrfTokenRepository.setCookieHttpOnly(false);
+ CsrfTokenRequestAttributeHandler requestHandler = new CsrfTokenRequestAttributeHandler();
+ requestHandler.setCsrfRequestAttributeName(null);
+
+
http
.exceptionHandling()
- .authenticationEntryPoint(problemSupport)
- .accessDeniedHandler(problemSupport)
+// .authenticationEntryPoint(problemSupport)
+// .accessDeniedHandler(problemSupport)
.and()
- .csrf().csrfTokenRepository(cookieCsrfTokenRepository)
+ .csrf()
+ .csrfTokenRepository(cookieCsrfTokenRepository)
+ .csrfTokenRequestHandler(requestHandler)
.and()
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
- .authorizeRequests()
- .antMatchers("/register").permitAll()
- .antMatchers("/ws").permitAll()
- .antMatchers("/news/public").permitAll()
- .antMatchers("/activate").permitAll()
- .antMatchers("/authenticate").permitAll()
- .antMatchers("/account/reset-password/init").permitAll()
- .antMatchers("/account/reset-password/finish").permitAll()
- .antMatchers("/csrf").permitAll()
- .antMatchers("/actuator/**").permitAll()
- .antMatchers("/swagger-ui.html").permitAll()
- .antMatchers("/v3/api-docs/**").permitAll()
- .antMatchers("/v3/api-docs**").permitAll()
- .antMatchers("/swagger-resources/configuration/ui").permitAll()
- .antMatchers("/swagger-ui/**").permitAll()
+ .authorizeHttpRequests()
+ .requestMatchers("/register").permitAll()
+ .requestMatchers("/ws").permitAll()
+ .requestMatchers("/news/public").permitAll()
+ .requestMatchers("/activate").permitAll()
+ .requestMatchers("/authenticate").permitAll()
+ .requestMatchers("/account/reset-password/init").permitAll()
+ .requestMatchers("/account/reset-password/finish").permitAll()
+ .requestMatchers("/csrf").permitAll()
+ .requestMatchers("/actuator/**").permitAll()
+ .requestMatchers("/swagger-ui.html").permitAll()
+ .requestMatchers("/v3/api-docs/**").permitAll()
+ .requestMatchers("/v3/api-docs**").permitAll()
+ .requestMatchers("/swagger-resources/configuration/ui").permitAll()
+ .requestMatchers("/swagger-ui/**").permitAll()
.anyRequest().authenticated()
.and()
.cors()
.and()
+// .addFilter(new AuthorizationFilter(authenticationManager, userRepository))
+ .authenticationManager(customAuthenticationManager(http))
.apply(securityConfigurerAdapter());
if(Arrays.stream(environment.getActiveProfiles()).anyMatch("disable-csrf"::equalsIgnoreCase)){
http.csrf().disable();
}
+
+ return http.build();
}
diff --git a/src/main/java/fr/icdc/ebad/config/oauth/CustomJwtAuthenticationConverter.java b/src/main/java/fr/icdc/ebad/config/oauth/CustomJwtAuthenticationConverter.java
new file mode 100644
index 00000000..7ddff2fb
--- /dev/null
+++ b/src/main/java/fr/icdc/ebad/config/oauth/CustomJwtAuthenticationConverter.java
@@ -0,0 +1,102 @@
+package fr.icdc.ebad.config.oauth;
+
+import fr.icdc.ebad.config.properties.EbadProperties;
+import fr.icdc.ebad.domain.Authority;
+import fr.icdc.ebad.domain.User;
+import fr.icdc.ebad.repository.AuthorityRepository;
+import fr.icdc.ebad.repository.UserRepository;
+import fr.icdc.ebad.security.EbadUserDetailsService;
+import org.springframework.core.convert.converter.Converter;
+import org.springframework.security.authentication.AbstractAuthenticationToken;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.authority.SimpleGrantedAuthority;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.oauth2.jwt.Jwt;
+import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationToken;
+import org.springframework.security.oauth2.server.resource.authentication.JwtGrantedAuthoritiesConverter;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+public class CustomJwtAuthenticationConverter implements Converter {
+
+ private final JwtGrantedAuthoritiesConverter grantedAuthoritiesConverter = new JwtGrantedAuthoritiesConverter();
+ private final EbadUserDetailsService userDetailsService;
+ private final UserRepository userRepository;
+ private final AuthorityRepository authorityRepository;
+ private final EbadProperties ebadProperties;
+
+ public CustomJwtAuthenticationConverter(EbadUserDetailsService userDetailsService, UserRepository userRepository, AuthorityRepository authorityRepository, EbadProperties ebadProperties) {
+ this.userDetailsService = userDetailsService;
+ this.userRepository = userRepository;
+ this.authorityRepository = authorityRepository;
+ this.ebadProperties = ebadProperties;
+ }
+
+
+ @Override
+ public AbstractAuthenticationToken convert(Jwt jwt) {
+ Collection authorities = extractAuthorities(jwt);
+ String principalClaimName = "preferred_username"; // Changez selon vos besoins
+ String principal = jwt.getClaimAsString(principalClaimName);
+
+// String authoritiesString = jwt.getClaim(ebadProperties.getSecurity().getMappingUser().getAuthorities());
+ String login = jwt.getClaim(ebadProperties.getSecurity().getMappingUser().getLogin());
+ String firstname = jwt.getClaim(ebadProperties.getSecurity().getMappingUser().getFirstname());
+ String lastname = jwt.getClaim(ebadProperties.getSecurity().getMappingUser().getLastname());
+ String email = jwt.getClaim(ebadProperties.getSecurity().getMappingUser().getEmail());
+ Optional userOptional = userRepository.findOneByLogin(login);
+
+ Set authoritiesSet = new HashSet<>();
+
+ for (GrantedAuthority authority : authorities) {
+ Optional authority1 = authorityRepository.findById(authority.getAuthority());
+ authority1.ifPresent(authoritiesSet::add);
+ }
+
+
+ if (userOptional.isPresent()) {
+ User user = userOptional.get();
+ user.setAuthorities(authoritiesSet);
+ user.setFirstName(firstname);
+ user.setLastName(lastname);
+ user.setEmail(email);
+ userRepository.save(user);
+ } else {
+ User newUser = new User();
+ newUser.setAuthorities(authoritiesSet);
+ newUser.setLogin(login);
+ newUser.setPassword("NOPASSWORD");
+ newUser.setFirstName(firstname);
+ newUser.setLastName(lastname);
+ newUser.setEmail(email);
+ newUser.setLangKey("FR_fr");
+ newUser.setActivated(true);
+ newUser.setCreatedBy("OAUTH2");
+ userRepository.save(newUser);
+ }
+
+// userDetailsService.loadUserByUsername(login);
+ // Créez un principal personnalisé si nécessaire
+ UserDetails customUserPrincipal = userDetailsService.loadUserByUsername(login);
+
+// return new JwtAuthenticationToken(jwt, authorities, customUserPrincipal.getUsername());
+ return new UsernamePasswordAuthenticationToken(customUserPrincipal, jwt, authorities);
+ }
+
+ private Collection extractAuthorities(Jwt jwt) {
+ Collection authorities = grantedAuthoritiesConverter.convert(jwt);
+
+ List grantedAuthorities = new ArrayList<>();
+ List authoritiesList = jwt.getClaim(ebadProperties.getSecurity().getMappingUser().getAuthorities());
+
+ for (String authority : authoritiesList) {
+ grantedAuthorities.add(new SimpleGrantedAuthority("ROLE_" + authority));
+ }
+ authorities.addAll(grantedAuthorities);
+
+
+ return authorities;
+ }
+}
diff --git a/src/main/java/fr/icdc/ebad/config/oauth/EbadAuthoritiesExtractor.java b/src/main/java/fr/icdc/ebad/config/oauth/EbadAuthoritiesExtractor.java
deleted file mode 100644
index 057de582..00000000
--- a/src/main/java/fr/icdc/ebad/config/oauth/EbadAuthoritiesExtractor.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package fr.icdc.ebad.config.oauth;
-
-import fr.icdc.ebad.config.properties.EbadProperties;
-import org.springframework.boot.autoconfigure.security.oauth2.resource.AuthoritiesExtractor;
-import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.authority.SimpleGrantedAuthority;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-public class EbadAuthoritiesExtractor implements AuthoritiesExtractor {
- private final EbadProperties ebadProperties;
-
- public EbadAuthoritiesExtractor(EbadProperties ebadProperties) {
- this.ebadProperties = ebadProperties;
- }
-
- @Override
- public List extractAuthorities(Map map) {
- List grantedAuthorities = new ArrayList<>();
- String authoritiesString = (String) map.get(ebadProperties.getSecurity().getMappingUser().getAuthorities());
- authoritiesString = authoritiesString.replaceAll(" ", "");
- authoritiesString = authoritiesString.replace("[", "");
- authoritiesString = authoritiesString.replace("]", "");
- authoritiesString = authoritiesString.replace(ebadProperties.getApplicationIdentifier(), "");
- for (String authority : authoritiesString.split(",")) {
- grantedAuthorities.add(new SimpleGrantedAuthority("ROLE" + authority));
- }
- return grantedAuthorities;
- }
-}
diff --git a/src/main/java/fr/icdc/ebad/config/oauth/EbadPrincipalExtractor.java b/src/main/java/fr/icdc/ebad/config/oauth/EbadPrincipalExtractor.java
deleted file mode 100644
index 321bcf3b..00000000
--- a/src/main/java/fr/icdc/ebad/config/oauth/EbadPrincipalExtractor.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package fr.icdc.ebad.config.oauth;
-
-import fr.icdc.ebad.config.properties.EbadProperties;
-import fr.icdc.ebad.domain.Authority;
-import fr.icdc.ebad.domain.User;
-import fr.icdc.ebad.repository.AuthorityRepository;
-import fr.icdc.ebad.repository.UserRepository;
-import fr.icdc.ebad.security.EbadUserDetailsService;
-import org.springframework.boot.autoconfigure.security.oauth2.resource.PrincipalExtractor;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Set;
-
-public class EbadPrincipalExtractor implements PrincipalExtractor {
- private final EbadUserDetailsService userDetailsService;
- private final UserRepository userRepository;
- private final AuthorityRepository authorityRepository;
- private final EbadProperties ebadProperties;
-
- public EbadPrincipalExtractor(EbadUserDetailsService userDetailsService, UserRepository userRepository, AuthorityRepository authorityRepository, EbadProperties ebadProperties) {
- this.userDetailsService = userDetailsService;
- this.userRepository = userRepository;
- this.authorityRepository = authorityRepository;
- this.ebadProperties = ebadProperties;
- }
-
- @Override
- @Transactional
- public Object extractPrincipal(Map map) {
- String authoritiesString = (String) map.get(ebadProperties.getSecurity().getMappingUser().getAuthorities());
- String login = (String) map.get(ebadProperties.getSecurity().getMappingUser().getLogin());
- String firstname = (String) map.get(ebadProperties.getSecurity().getMappingUser().getFirstname());
- String lastname = (String) map.get(ebadProperties.getSecurity().getMappingUser().getLastname());
- String email = (String) map.get(ebadProperties.getSecurity().getMappingUser().getEmail());
- Optional userOptional = userRepository.findOneByLogin(login);
-
- Set authorities = new HashSet<>();
- authoritiesString = authoritiesString.replaceAll(" ", "");
- authoritiesString = authoritiesString.replace(ebadProperties.getApplicationIdentifier(), "");
-
- for (String authority : authoritiesString.split(",")) {
- Optional authority1 = authorityRepository.findById("ROLE" + authority);
- authority1.ifPresent(authorities::add);
- }
-
- if (userOptional.isPresent()) {
- User user = userOptional.get();
- user.setAuthorities(authorities);
- user.setFirstName(firstname);
- user.setLastName(lastname);
- user.setEmail(email);
- userRepository.save(user);
- } else {
- User newUser = new User();
- newUser.setAuthorities(authorities);
- newUser.setLogin(login);
- newUser.setPassword("NOPASSWORD");
- newUser.setFirstName(firstname);
- newUser.setLastName(lastname);
- newUser.setEmail(email);
- newUser.setLangKey("FR_fr");
- newUser.setActivated(true);
- newUser.setCreatedBy("OAUTH2");
- userRepository.save(newUser);
- }
-
- return userDetailsService.loadUserByUsername(login);
- }
-}
diff --git a/src/main/java/fr/icdc/ebad/config/oauth/Oauth2Configuration.java b/src/main/java/fr/icdc/ebad/config/oauth/Oauth2Configuration.java
index 607f72b4..f36c3ed5 100644
--- a/src/main/java/fr/icdc/ebad/config/oauth/Oauth2Configuration.java
+++ b/src/main/java/fr/icdc/ebad/config/oauth/Oauth2Configuration.java
@@ -4,50 +4,43 @@
import fr.icdc.ebad.repository.AuthorityRepository;
import fr.icdc.ebad.repository.UserRepository;
import fr.icdc.ebad.security.EbadUserDetailsService;
-import org.springframework.boot.autoconfigure.security.oauth2.resource.AuthoritiesExtractor;
-import org.springframework.boot.autoconfigure.security.oauth2.resource.PrincipalExtractor;
-import org.springframework.boot.autoconfigure.security.oauth2.resource.ResourceServerProperties;
-import org.springframework.boot.autoconfigure.security.oauth2.resource.UserInfoTokenServices;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Profile;
import org.springframework.core.annotation.Order;
-import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
+import org.springframework.core.convert.converter.Converter;
+import org.springframework.security.authentication.AbstractAuthenticationToken;
+import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
-import org.springframework.security.oauth2.config.annotation.web.configuration.EnableOAuth2Client;
-import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
-import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
-import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer;
-import org.springframework.security.oauth2.provider.token.ResourceServerTokenServices;
+import org.springframework.security.oauth2.jwt.Jwt;
+import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.csrf.CookieCsrfTokenRepository;
-import org.zalando.problem.spring.web.advice.security.SecurityProblemSupport;
+import org.springframework.security.web.csrf.CsrfTokenRequestAttributeHandler;
@Profile("!jwt")
@Order(3)
@Configuration
-@EnableOAuth2Client
-@EnableResourceServer
-@Import(SecurityProblemSupport.class)
+//@EnableOAuth2Client
+//@EnableResourceServer
+//@Import(SecurityProblemSupport.class)
@EnableWebSecurity
-@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
-public class Oauth2Configuration extends ResourceServerConfigurerAdapter {
- private final ResourceServerProperties resourceServerProperties;
+@EnableMethodSecurity(prePostEnabled = true, securedEnabled = true)
+public class Oauth2Configuration {
+
+// private final OauthJwtAuthConverter jwtAuthConverter;
private final EbadUserDetailsService userDetailsService;
private final UserRepository userRepository;
- private final SecurityProblemSupport problemSupport;
private final AuthorityRepository authorityRepository;
private final EbadProperties ebadProperties;
- public Oauth2Configuration(ResourceServerProperties resourceServerProperties, UserRepository userRepository, SecurityProblemSupport problemSupport, AuthorityRepository authorityRepository, EbadUserDetailsService userDetailsService, EbadProperties ebadProperties) {
- this.resourceServerProperties = resourceServerProperties;
+ public Oauth2Configuration(EbadUserDetailsService userDetailsService, UserRepository userRepository, AuthorityRepository authorityRepository, EbadProperties ebadProperties) {
this.userDetailsService = userDetailsService;
this.userRepository = userRepository;
- this.problemSupport = problemSupport;
this.authorityRepository = authorityRepository;
this.ebadProperties = ebadProperties;
}
@@ -57,13 +50,17 @@ public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
- @Override
- public void configure(ResourceServerSecurityConfigurer resources) {
- resources.tokenServices(this.resourceServerTokenServices());
- }
+// @Override
+// public void configure(ResourceServerSecurityConfigurer resources) {
+// resources.tokenServices(this.resourceServerTokenServices());
+// }
+
+// @Override
+ @Bean
+public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
+ CsrfTokenRequestAttributeHandler requestHandler = new CsrfTokenRequestAttributeHandler();
+ requestHandler.setCsrfRequestAttributeName(null);
- @Override
- public void configure(HttpSecurity http) throws Exception {
CookieCsrfTokenRepository cookieCsrfTokenRepository = CookieCsrfTokenRepository.withHttpOnlyFalse();
cookieCsrfTokenRepository.setCookiePath("/");
cookieCsrfTokenRepository.setHeaderName("X-XSRF-TOKEN");
@@ -72,45 +69,56 @@ public void configure(HttpSecurity http) throws Exception {
http
.exceptionHandling()
- .authenticationEntryPoint(problemSupport)
- .accessDeniedHandler(problemSupport)
+// .authenticationEntryPoint(problemSupport)
+// .accessDeniedHandler(problemSupport)
.and().csrf().csrfTokenRepository(cookieCsrfTokenRepository)
+ .csrfTokenRequestHandler(requestHandler)
.and()
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
- .authorizeRequests()
- .antMatchers("/csrf").permitAll()
- .antMatchers("/news/public").permitAll()
- .antMatchers("/ws").permitAll()
- .antMatchers("/actuator/**").permitAll()
- .antMatchers("/swagger-ui.html").permitAll()
- .antMatchers("/v3/api-docs/**").permitAll()
- .antMatchers("/v3/api-docs**").permitAll()
- .antMatchers("/swagger-resources/configuration/ui").permitAll()
- .antMatchers("/swagger-ui/**").permitAll()
- .anyRequest().authenticated()
- .and()
+ .authorizeHttpRequests((authorize) -> authorize
+ .requestMatchers("/csrf").permitAll()
+ .requestMatchers("/news/public").permitAll()
+ .requestMatchers("/ws").permitAll()
+ .requestMatchers("/actuator/**").permitAll()
+ .requestMatchers("/swagger-ui.html").permitAll()
+ .requestMatchers("/v3/api-docs/**").permitAll()
+ .requestMatchers("/v3/api-docs**").permitAll()
+ .requestMatchers("/swagger-resources/configuration/ui").permitAll()
+ .requestMatchers("/swagger-ui/**").permitAll()
+ .anyRequest().authenticated()
+ )
+ .oauth2ResourceServer(oauth2 -> oauth2.jwt().jwtAuthenticationConverter(jwtAuthenticationConverter()))
.cors();
+ return http.build();
}
- @Bean
- public PrincipalExtractor ebadPrincipalExtractor() {
- return new EbadPrincipalExtractor(userDetailsService, userRepository, authorityRepository, ebadProperties);
- }
- @Bean
- public AuthoritiesExtractor ebadAuthoritiesExtractor() {
- return new EbadAuthoritiesExtractor(ebadProperties);
- }
+
+
+// @Bean
+// public PrincipalExtractor ebadPrincipalExtractor() {
+// return new EbadPrincipalExtractor(userDetailsService, userRepository, authorityRepository, ebadProperties);
+// }
+//
+// @Bean
+// public AuthoritiesExtractor ebadAuthoritiesExtractor() {
+// return new EbadAuthoritiesExtractor(ebadProperties);
+// }
+//
+// @Bean
+// ResourceServerTokenServices resourceServerTokenServices() {
+// UserInfoTokenServices userInfoTokenServices = new UserInfoTokenServices(resourceServerProperties.getUserInfoUri(), resourceServerProperties.getClientId());
+// userInfoTokenServices.setAuthoritiesExtractor(ebadAuthoritiesExtractor());
+// userInfoTokenServices.setPrincipalExtractor(ebadPrincipalExtractor());
+// return userInfoTokenServices;
+// }
@Bean
- ResourceServerTokenServices resourceServerTokenServices() {
- UserInfoTokenServices userInfoTokenServices = new UserInfoTokenServices(resourceServerProperties.getUserInfoUri(), resourceServerProperties.getClientId());
- userInfoTokenServices.setAuthoritiesExtractor(ebadAuthoritiesExtractor());
- userInfoTokenServices.setPrincipalExtractor(ebadPrincipalExtractor());
- return userInfoTokenServices;
+ public Converter jwtAuthenticationConverter() {
+ return new CustomJwtAuthenticationConverter(userDetailsService, userRepository, authorityRepository, ebadProperties);
}
diff --git a/src/main/java/fr/icdc/ebad/config/properties/EbadProperties.java b/src/main/java/fr/icdc/ebad/config/properties/EbadProperties.java
index 29271ab3..ebef7916 100644
--- a/src/main/java/fr/icdc/ebad/config/properties/EbadProperties.java
+++ b/src/main/java/fr/icdc/ebad/config/properties/EbadProperties.java
@@ -1,11 +1,10 @@
package fr.icdc.ebad.config.properties;
-import lombok.Getter;
-import lombok.Setter;
+import jakarta.validation.constraints.NotNull;
+import lombok.*;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
-import javax.validation.constraints.NotNull;
import java.time.Duration;
@Getter
diff --git a/src/main/java/fr/icdc/ebad/config/websocket/WebsocketConfig.java b/src/main/java/fr/icdc/ebad/config/websocket/WebsocketConfig.java
index 9a5891c9..b4a72c15 100644
--- a/src/main/java/fr/icdc/ebad/config/websocket/WebsocketConfig.java
+++ b/src/main/java/fr/icdc/ebad/config/websocket/WebsocketConfig.java
@@ -10,11 +10,9 @@
import org.springframework.messaging.support.ChannelInterceptor;
import org.springframework.messaging.support.MessageHeaderAccessor;
import org.springframework.security.core.Authentication;
-import org.springframework.security.oauth2.provider.token.ResourceServerTokenServices;
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;
-import javax.annotation.Nullable;
import java.util.Arrays;
import java.util.List;
@@ -22,12 +20,10 @@
@EnableWebSocketMessageBroker
public class WebsocketConfig implements WebSocketMessageBrokerConfigurer {
private final TokenProvider tokenProvider;
- private final ResourceServerTokenServices resourceServerTokenServices;
private final Environment environment;
- public WebsocketConfig(TokenProvider tokenProvider, @Nullable ResourceServerTokenServices resourceServerTokenServices, Environment environment) {
+ public WebsocketConfig(TokenProvider tokenProvider, Environment environment) {
this.tokenProvider = tokenProvider;
- this.resourceServerTokenServices = resourceServerTokenServices;
this.environment = environment;
}
@@ -55,9 +51,11 @@ public org.springframework.messaging.Message> preSend(org.springframework.mess
Authentication authentication = null;
if (Arrays.stream(environment.getActiveProfiles()).anyMatch(env -> (env.equalsIgnoreCase("jwt")))) {
authentication = tokenProvider.getAuthentication(token);
- } else if (resourceServerTokenServices != null) {
- authentication = resourceServerTokenServices.loadAuthentication(token);
}
+ //FIXME DTROUILLET
+// else if (resourceServerTokenServices != null) {
+// authentication = resourceServerTokenServices.loadAuthentication(token);
+// }
accessor.setUser(authentication);
return message;
}
diff --git a/src/main/java/fr/icdc/ebad/domain/AbstractAuditingEntity.java b/src/main/java/fr/icdc/ebad/domain/AbstractAuditingEntity.java
index debcc20c..46efe2c0 100644
--- a/src/main/java/fr/icdc/ebad/domain/AbstractAuditingEntity.java
+++ b/src/main/java/fr/icdc/ebad/domain/AbstractAuditingEntity.java
@@ -1,5 +1,9 @@
package fr.icdc.ebad.domain;
+import jakarta.persistence.Column;
+import jakarta.persistence.EntityListeners;
+import jakarta.persistence.MappedSuperclass;
+import jakarta.validation.constraints.NotNull;
import org.hibernate.envers.Audited;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
@@ -7,10 +11,6 @@
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
-import javax.persistence.Column;
-import javax.persistence.EntityListeners;
-import javax.persistence.MappedSuperclass;
-import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
/**
diff --git a/src/main/java/fr/icdc/ebad/domain/AccreditationRequest.java b/src/main/java/fr/icdc/ebad/domain/AccreditationRequest.java
index cc509e38..2776769a 100644
--- a/src/main/java/fr/icdc/ebad/domain/AccreditationRequest.java
+++ b/src/main/java/fr/icdc/ebad/domain/AccreditationRequest.java
@@ -1,23 +1,22 @@
package fr.icdc.ebad.domain;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.EnumType;
+import jakarta.persistence.Enumerated;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.Table;
+import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-import javax.validation.constraints.NotNull;
-
@Data
@EqualsAndHashCode(callSuper = false)
@Entity
diff --git a/src/main/java/fr/icdc/ebad/domain/Actualite.java b/src/main/java/fr/icdc/ebad/domain/Actualite.java
index f21e1220..7177af3b 100644
--- a/src/main/java/fr/icdc/ebad/domain/Actualite.java
+++ b/src/main/java/fr/icdc/ebad/domain/Actualite.java
@@ -1,5 +1,13 @@
package fr.icdc.ebad.domain;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.Table;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -8,15 +16,6 @@
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
-
/**
* Entite des actualites permettant d'enregistrer des actualites a afficher sur
* la page d'accueil
diff --git a/src/main/java/fr/icdc/ebad/domain/ApiToken.java b/src/main/java/fr/icdc/ebad/domain/ApiToken.java
index 7ef075cb..e56052ba 100644
--- a/src/main/java/fr/icdc/ebad/domain/ApiToken.java
+++ b/src/main/java/fr/icdc/ebad/domain/ApiToken.java
@@ -1,5 +1,16 @@
package fr.icdc.ebad.domain;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -7,10 +18,6 @@
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
-import javax.persistence.*;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
-
@Entity
@Data
@Builder
diff --git a/src/main/java/fr/icdc/ebad/domain/Application.java b/src/main/java/fr/icdc/ebad/domain/Application.java
index 2ce9bb2b..f445839c 100644
--- a/src/main/java/fr/icdc/ebad/domain/Application.java
+++ b/src/main/java/fr/icdc/ebad/domain/Application.java
@@ -2,6 +2,18 @@
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonManagedReference;
+import jakarta.persistence.CascadeType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.OrderBy;
+import jakarta.persistence.Table;
+import jakarta.persistence.UniqueConstraint;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -11,18 +23,6 @@
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.OneToMany;
-import javax.persistence.OrderBy;
-import javax.persistence.Table;
-import javax.persistence.UniqueConstraint;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
import java.util.HashSet;
import java.util.Set;
diff --git a/src/main/java/fr/icdc/ebad/domain/Authority.java b/src/main/java/fr/icdc/ebad/domain/Authority.java
index 96a91d54..e72999c3 100644
--- a/src/main/java/fr/icdc/ebad/domain/Authority.java
+++ b/src/main/java/fr/icdc/ebad/domain/Authority.java
@@ -1,6 +1,15 @@
package fr.icdc.ebad.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.JoinTable;
+import jakarta.persistence.ManyToMany;
+import jakarta.persistence.Table;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -9,15 +18,6 @@
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.ManyToMany;
-import javax.persistence.Table;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
import java.util.HashSet;
import java.util.Set;
diff --git a/src/main/java/fr/icdc/ebad/domain/Batch.java b/src/main/java/fr/icdc/ebad/domain/Batch.java
index b12e0412..4a579eea 100644
--- a/src/main/java/fr/icdc/ebad/domain/Batch.java
+++ b/src/main/java/fr/icdc/ebad/domain/Batch.java
@@ -1,6 +1,21 @@
package fr.icdc.ebad.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
+import jakarta.annotation.Nullable;
+import jakarta.persistence.CascadeType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.JoinTable;
+import jakarta.persistence.ManyToMany;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.Table;
+import jakarta.persistence.Transient;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -10,21 +25,6 @@
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
-import javax.annotation.Nullable;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.ManyToMany;
-import javax.persistence.OneToMany;
-import javax.persistence.Table;
-import javax.persistence.Transient;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
diff --git a/src/main/java/fr/icdc/ebad/domain/Chaine.java b/src/main/java/fr/icdc/ebad/domain/Chaine.java
index 8ee3d734..66ac23cb 100644
--- a/src/main/java/fr/icdc/ebad/domain/Chaine.java
+++ b/src/main/java/fr/icdc/ebad/domain/Chaine.java
@@ -1,5 +1,18 @@
package fr.icdc.ebad.domain;
+import jakarta.persistence.CascadeType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.OrderBy;
+import jakarta.persistence.Table;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Size;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@@ -7,19 +20,6 @@
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Cascade;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.OneToMany;
-import javax.persistence.OrderBy;
-import javax.persistence.Table;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
import java.util.ArrayList;
import java.util.List;
diff --git a/src/main/java/fr/icdc/ebad/domain/ChaineAssociation.java b/src/main/java/fr/icdc/ebad/domain/ChaineAssociation.java
index 823d24a7..77c64a62 100644
--- a/src/main/java/fr/icdc/ebad/domain/ChaineAssociation.java
+++ b/src/main/java/fr/icdc/ebad/domain/ChaineAssociation.java
@@ -1,17 +1,16 @@
package fr.icdc.ebad.domain;
import com.fasterxml.jackson.annotation.JsonBackReference;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.Id;
+import jakarta.persistence.IdClass;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.Table;
import lombok.Data;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.Id;
-import javax.persistence.IdClass;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-
/**
* Created by dtrouillet on 13/06/2016.
*/
diff --git a/src/main/java/fr/icdc/ebad/domain/ChaineAssociationId.java b/src/main/java/fr/icdc/ebad/domain/ChaineAssociationId.java
index 194b3ca9..537d2b48 100644
--- a/src/main/java/fr/icdc/ebad/domain/ChaineAssociationId.java
+++ b/src/main/java/fr/icdc/ebad/domain/ChaineAssociationId.java
@@ -2,7 +2,6 @@
import lombok.Data;
-import java.io.Serial;
import java.io.Serializable;
/**
@@ -10,7 +9,7 @@
*/
@Data
public class ChaineAssociationId implements Serializable {
- @Serial
+// @Serial
private static final long serialVersionUID = 1L;
private int batchOrder;
diff --git a/src/main/java/fr/icdc/ebad/domain/Directory.java b/src/main/java/fr/icdc/ebad/domain/Directory.java
index 0b4155e0..af53797e 100644
--- a/src/main/java/fr/icdc/ebad/domain/Directory.java
+++ b/src/main/java/fr/icdc/ebad/domain/Directory.java
@@ -1,5 +1,15 @@
package fr.icdc.ebad.domain;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.Table;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -8,17 +18,6 @@
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
-
/**
* Directory
*/
diff --git a/src/main/java/fr/icdc/ebad/domain/Environnement.java b/src/main/java/fr/icdc/ebad/domain/Environnement.java
index 2fe46976..dad0a9b0 100644
--- a/src/main/java/fr/icdc/ebad/domain/Environnement.java
+++ b/src/main/java/fr/icdc/ebad/domain/Environnement.java
@@ -3,16 +3,34 @@
import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonIgnore;
-import lombok.*;
+import jakarta.annotation.Nullable;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.JoinTable;
+import jakarta.persistence.ManyToMany;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.Table;
+import jakarta.persistence.Transient;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Size;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
import org.hibernate.annotations.Cache;
-import org.hibernate.annotations.*;
-
-import javax.annotation.Nullable;
-import javax.persistence.Entity;
-import javax.persistence.Table;
-import javax.persistence.*;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
+import org.hibernate.annotations.Cascade;
+import org.hibernate.annotations.ColumnDefault;
+import org.hibernate.annotations.Fetch;
+import org.hibernate.annotations.FetchMode;
+
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
diff --git a/src/main/java/fr/icdc/ebad/domain/GlobalSetting.java b/src/main/java/fr/icdc/ebad/domain/GlobalSetting.java
index 6d584aa1..a0855eb2 100644
--- a/src/main/java/fr/icdc/ebad/domain/GlobalSetting.java
+++ b/src/main/java/fr/icdc/ebad/domain/GlobalSetting.java
@@ -1,5 +1,9 @@
package fr.icdc.ebad.domain;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.Id;
+import jakarta.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -9,11 +13,6 @@
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
@Entity
@Data
@Builder
diff --git a/src/main/java/fr/icdc/ebad/domain/Identity.java b/src/main/java/fr/icdc/ebad/domain/Identity.java
index 6913cc91..6fb4a238 100644
--- a/src/main/java/fr/icdc/ebad/domain/Identity.java
+++ b/src/main/java/fr/icdc/ebad/domain/Identity.java
@@ -1,14 +1,25 @@
package fr.icdc.ebad.domain;
import com.fasterxml.jackson.annotation.JsonBackReference;
-import lombok.*;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Size;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
-import javax.persistence.*;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
-
@Data
@EqualsAndHashCode(callSuper = false)
@Entity
diff --git a/src/main/java/fr/icdc/ebad/domain/LogBatch.java b/src/main/java/fr/icdc/ebad/domain/LogBatch.java
index e35cdd2a..e7016528 100644
--- a/src/main/java/fr/icdc/ebad/domain/LogBatch.java
+++ b/src/main/java/fr/icdc/ebad/domain/LogBatch.java
@@ -2,11 +2,20 @@
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+import jakarta.annotation.Nullable;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.Lob;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
-import javax.annotation.Nullable;
-import javax.persistence.*;
-import javax.validation.constraints.NotNull;
import java.util.Date;
/**
diff --git a/src/main/java/fr/icdc/ebad/domain/Norme.java b/src/main/java/fr/icdc/ebad/domain/Norme.java
index 7f03cadc..539df8bb 100644
--- a/src/main/java/fr/icdc/ebad/domain/Norme.java
+++ b/src/main/java/fr/icdc/ebad/domain/Norme.java
@@ -1,5 +1,13 @@
package fr.icdc.ebad.domain;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.Table;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -8,15 +16,6 @@
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
-
/**
* Entite de normes permettant de rendre parametrable les differentes normes, chemins et interpretteur
* de ligne de commande
diff --git a/src/main/java/fr/icdc/ebad/domain/Notification.java b/src/main/java/fr/icdc/ebad/domain/Notification.java
index 7f7f8834..b76c0e4a 100644
--- a/src/main/java/fr/icdc/ebad/domain/Notification.java
+++ b/src/main/java/fr/icdc/ebad/domain/Notification.java
@@ -1,15 +1,24 @@
package fr.icdc.ebad.domain;
+import jakarta.persistence.Column;
+import jakarta.persistence.Convert;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.Table;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Size;
import lombok.Data;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
-import org.hibernate.annotations.Type;
-import org.joda.time.DateTime;
+
import org.springframework.data.annotation.CreatedDate;
+import org.springframework.data.jpa.convert.threeten.Jsr310JpaConverters;
-import javax.persistence.*;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
+import java.time.LocalDateTime;
/**
* Entite des notifications permettant d'enregistrer des notications
@@ -29,10 +38,10 @@ public class Notification {
private String content;
@NotNull
- @Type(type = "org.jadira.usertype.dateandtime.joda.PersistentDateTime")
@CreatedDate
@Column(nullable = false, name = "created_date")
- private DateTime createdDate = DateTime.now();
+ @Convert(converter= Jsr310JpaConverters.LocalDateTimeConverter.class)
+ private LocalDateTime createdDate = LocalDateTime.now();
@NotNull
@Column(nullable = false, name = "is_read")
diff --git a/src/main/java/fr/icdc/ebad/domain/Scheduling.java b/src/main/java/fr/icdc/ebad/domain/Scheduling.java
index 450d3f2d..a6bb66e1 100644
--- a/src/main/java/fr/icdc/ebad/domain/Scheduling.java
+++ b/src/main/java/fr/icdc/ebad/domain/Scheduling.java
@@ -1,6 +1,15 @@
package fr.icdc.ebad.domain;
import com.fasterxml.jackson.annotation.JsonBackReference;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.Table;
+import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -10,16 +19,6 @@
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-import javax.validation.constraints.NotNull;
-
@EqualsAndHashCode(callSuper = true)
@Entity
diff --git a/src/main/java/fr/icdc/ebad/domain/Terminal.java b/src/main/java/fr/icdc/ebad/domain/Terminal.java
index 90dcabfe..1b1057a7 100644
--- a/src/main/java/fr/icdc/ebad/domain/Terminal.java
+++ b/src/main/java/fr/icdc/ebad/domain/Terminal.java
@@ -1,6 +1,15 @@
package fr.icdc.ebad.domain;
import com.fasterxml.jackson.annotation.JsonBackReference;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.Table;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -8,15 +17,6 @@
import lombok.NoArgsConstructor;
import org.hibernate.annotations.GenericGenerator;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
import java.util.UUID;
@Data
diff --git a/src/main/java/fr/icdc/ebad/domain/TypeFichier.java b/src/main/java/fr/icdc/ebad/domain/TypeFichier.java
index 0ec5a1b7..87faed4a 100644
--- a/src/main/java/fr/icdc/ebad/domain/TypeFichier.java
+++ b/src/main/java/fr/icdc/ebad/domain/TypeFichier.java
@@ -1,21 +1,20 @@
package fr.icdc.ebad.domain;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.Table;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Size;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
-
/**
* TypeFichier
*/
diff --git a/src/main/java/fr/icdc/ebad/domain/UsageApplication.java b/src/main/java/fr/icdc/ebad/domain/UsageApplication.java
index ba16d5b7..76609391 100644
--- a/src/main/java/fr/icdc/ebad/domain/UsageApplication.java
+++ b/src/main/java/fr/icdc/ebad/domain/UsageApplication.java
@@ -1,19 +1,18 @@
package fr.icdc.ebad.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
+import jakarta.persistence.Column;
+import jakarta.persistence.EmbeddedId;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.MapsId;
+import jakarta.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
-import javax.persistence.Column;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.ManyToOne;
-import javax.persistence.MapsId;
-import javax.persistence.Table;
-
@Entity
@AllArgsConstructor
@NoArgsConstructor
diff --git a/src/main/java/fr/icdc/ebad/domain/UsageApplicationId.java b/src/main/java/fr/icdc/ebad/domain/UsageApplicationId.java
index 99324213..2edcccff 100644
--- a/src/main/java/fr/icdc/ebad/domain/UsageApplicationId.java
+++ b/src/main/java/fr/icdc/ebad/domain/UsageApplicationId.java
@@ -1,11 +1,11 @@
package fr.icdc.ebad.domain;
+import jakarta.persistence.Column;
+import jakarta.persistence.Embeddable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
-import javax.persistence.Column;
-import javax.persistence.Embeddable;
import java.io.Serializable;
@Embeddable
diff --git a/src/main/java/fr/icdc/ebad/domain/User.java b/src/main/java/fr/icdc/ebad/domain/User.java
index 51d5432d..13ed132a 100644
--- a/src/main/java/fr/icdc/ebad/domain/User.java
+++ b/src/main/java/fr/icdc/ebad/domain/User.java
@@ -1,5 +1,21 @@
package fr.icdc.ebad.domain;
+import jakarta.persistence.CascadeType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.JoinTable;
+import jakarta.persistence.ManyToMany;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.Table;
+import jakarta.persistence.Transient;
+import jakarta.validation.constraints.Email;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Pattern;
+import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -9,22 +25,6 @@
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.ManyToMany;
-import javax.persistence.OneToMany;
-import javax.persistence.Table;
-import javax.persistence.Transient;
-import javax.validation.constraints.Email;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Pattern;
-import javax.validation.constraints.Size;
import java.util.HashSet;
import java.util.Set;
diff --git a/src/main/java/fr/icdc/ebad/repository/UserRepository.java b/src/main/java/fr/icdc/ebad/repository/UserRepository.java
index ec30fe90..472cc64f 100644
--- a/src/main/java/fr/icdc/ebad/repository/UserRepository.java
+++ b/src/main/java/fr/icdc/ebad/repository/UserRepository.java
@@ -5,7 +5,6 @@
import com.querydsl.core.types.dsl.StringPath;
import fr.icdc.ebad.domain.QUser;
import fr.icdc.ebad.domain.User;
-import org.joda.time.DateTime;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.EntityGraph;
@@ -17,6 +16,7 @@
import org.springframework.data.querydsl.binding.SingleValueBinding;
import org.springframework.data.repository.query.Param;
+import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;
@@ -40,7 +40,7 @@ default void customize(QuerydslBindings bindings, QUser root) {
Optional findOneByActivationKey(String activationKey);
- List findAllByActivatedIsFalseAndCreatedDateBefore(DateTime dateTime);
+ List findAllByActivatedIsFalseAndCreatedDateBefore(LocalDateTime dateTime);
Optional findOneByEmail(String email);
diff --git a/src/main/java/fr/icdc/ebad/security/SecurityUtils.java b/src/main/java/fr/icdc/ebad/security/SecurityUtils.java
index 459f1986..44834d78 100644
--- a/src/main/java/fr/icdc/ebad/security/SecurityUtils.java
+++ b/src/main/java/fr/icdc/ebad/security/SecurityUtils.java
@@ -5,6 +5,8 @@
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.oauth2.jwt.Jwt;
+import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationToken;
/**
* Utility class for Spring Security.
@@ -30,6 +32,8 @@ public static String getCurrentLogin() {
userName = springSecurityUser.getUsername();
} else if (authentication.getPrincipal() instanceof String) {
userName = (String) authentication.getPrincipal();
+ } else if (authentication.getPrincipal() instanceof Jwt){
+ userName = ((Jwt)authentication.getPrincipal()).getSubject();
}
}
return userName;
diff --git a/src/main/java/fr/icdc/ebad/security/jwt/JWTFilter.java b/src/main/java/fr/icdc/ebad/security/jwt/JWTFilter.java
index 66b43dd8..8578d380 100644
--- a/src/main/java/fr/icdc/ebad/security/jwt/JWTFilter.java
+++ b/src/main/java/fr/icdc/ebad/security/jwt/JWTFilter.java
@@ -1,15 +1,15 @@
package fr.icdc.ebad.security.jwt;
+import jakarta.servlet.FilterChain;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.ServletRequest;
+import jakarta.servlet.ServletResponse;
+import jakarta.servlet.http.HttpServletRequest;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.util.StringUtils;
import org.springframework.web.filter.GenericFilterBean;
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
/**
diff --git a/src/main/java/fr/icdc/ebad/security/jwt/TokenProvider.java b/src/main/java/fr/icdc/ebad/security/jwt/TokenProvider.java
index db81df55..3e2c47ab 100644
--- a/src/main/java/fr/icdc/ebad/security/jwt/TokenProvider.java
+++ b/src/main/java/fr/icdc/ebad/security/jwt/TokenProvider.java
@@ -8,6 +8,7 @@
import io.jsonwebtoken.SignatureAlgorithm;
import io.jsonwebtoken.SignatureException;
import io.jsonwebtoken.UnsupportedJwtException;
+import jakarta.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@@ -17,7 +18,6 @@
import org.springframework.security.core.userdetails.User;
import org.springframework.stereotype.Component;
-import javax.annotation.PostConstruct;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
diff --git a/src/main/java/fr/icdc/ebad/service/AccreditationRequestService.java b/src/main/java/fr/icdc/ebad/service/AccreditationRequestService.java
index d6a2d224..e6f528f4 100644
--- a/src/main/java/fr/icdc/ebad/service/AccreditationRequestService.java
+++ b/src/main/java/fr/icdc/ebad/service/AccreditationRequestService.java
@@ -14,6 +14,7 @@
import fr.icdc.ebad.service.util.EbadServiceException;
import fr.icdc.ebad.web.rest.dto.AccreditationRequestDto;
import fr.icdc.ebad.web.rest.dto.AuthorityApplicationDTO;
+import jakarta.mail.MessagingException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
@@ -23,7 +24,6 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
-import javax.mail.MessagingException;
@Service
@@ -60,7 +60,7 @@ public AccreditationRequest requestNewAccreditation(Long applicationId, boolean
.wantUse(isWantUse)
.build();
- AccreditationRequest result = accreditationRequestRepository.save(accreditationRequest);
+ AccreditationRequest result = accreditationRequestRepository.saveAndFlush(accreditationRequest);
AccreditationRequestDto[] sendNotif = {mapStructMapper.convert(result)};
application.getUsageApplications()
@@ -108,7 +108,7 @@ public void answerToRequest(Long idAccreditationRequest, boolean isAccepted) thr
AccreditationRequest accreditationRequest = accreditationRequestRepository.findByIdAndState(idAccreditationRequest, StateRequest.SENT).orElseThrow(EbadServiceException::new);
if (!isAccepted) {
accreditationRequest.setState(StateRequest.REJECTED);
- accreditationRequestRepository.save(accreditationRequest);
+ accreditationRequestRepository.saveAndFlush(accreditationRequest);
} else {
AuthorityApplicationDTO authorityApplicationDTO = new AuthorityApplicationDTO();
@@ -118,7 +118,7 @@ public void answerToRequest(Long idAccreditationRequest, boolean isAccepted) thr
authorityApplicationDTO.setAddUser(accreditationRequest.isWantUse());
if (null != userService.changeAutorisationApplication(authorityApplicationDTO)) {
accreditationRequest.setState(StateRequest.ACCEPTED);
- accreditationRequestRepository.save(accreditationRequest);
+ accreditationRequestRepository.saveAndFlush(accreditationRequest);
}
}
diff --git a/src/main/java/fr/icdc/ebad/service/ChaineService.java b/src/main/java/fr/icdc/ebad/service/ChaineService.java
index 85069344..485f6d21 100644
--- a/src/main/java/fr/icdc/ebad/service/ChaineService.java
+++ b/src/main/java/fr/icdc/ebad/service/ChaineService.java
@@ -37,7 +37,6 @@ public ChaineService(BatchService batchService, ChaineRepository chaineRepositor
}
@Job(name = "Chain %0, User %1", retries = 0)
- //@Transactional
public RetourBatch jobRunChaine(Long chaineId, String login) throws EbadServiceException {
Chaine chaine = getChaine(chaineId);
return runChaine(chaine, login);
@@ -86,7 +85,7 @@ public Chaine addChaine(Chaine chaine){
@Transactional(readOnly = true)
public Chaine getChaine(Long id) {
- return chaineRepository.getById(id);
+ return chaineRepository.getReferenceById(id);
}
@Transactional(readOnly = true)
diff --git a/src/main/java/fr/icdc/ebad/service/EnvironnementService.java b/src/main/java/fr/icdc/ebad/service/EnvironnementService.java
index af187c27..c2206eae 100644
--- a/src/main/java/fr/icdc/ebad/service/EnvironnementService.java
+++ b/src/main/java/fr/icdc/ebad/service/EnvironnementService.java
@@ -22,6 +22,8 @@
import fr.icdc.ebad.repository.NormeRepository;
import fr.icdc.ebad.repository.SchedulingRepository;
import fr.icdc.ebad.service.util.EbadServiceException;
+import jakarta.annotation.Nullable;
+import jakarta.validation.constraints.NotNull;
import org.jobrunr.scheduling.JobScheduler;
import org.pf4j.PluginRuntimeException;
import org.pf4j.PluginWrapper;
@@ -35,8 +37,6 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
-import javax.annotation.Nullable;
-import javax.validation.constraints.NotNull;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
diff --git a/src/main/java/fr/icdc/ebad/service/MailService.java b/src/main/java/fr/icdc/ebad/service/MailService.java
index 57b395a4..872d9e59 100644
--- a/src/main/java/fr/icdc/ebad/service/MailService.java
+++ b/src/main/java/fr/icdc/ebad/service/MailService.java
@@ -2,6 +2,8 @@
import fr.icdc.ebad.config.properties.EbadProperties;
+import jakarta.mail.MessagingException;
+import jakarta.mail.internet.MimeMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.ObjectProvider;
@@ -9,10 +11,8 @@
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.stereotype.Service;
import org.thymeleaf.context.Context;
-import org.thymeleaf.spring5.SpringTemplateEngine;
+import org.thymeleaf.spring6.SpringTemplateEngine;
-import javax.mail.MessagingException;
-import javax.mail.internet.MimeMessage;
import java.util.HashMap;
@Service
diff --git a/src/main/java/fr/icdc/ebad/service/NotificationService.java b/src/main/java/fr/icdc/ebad/service/NotificationService.java
index b88a53ce..f1a3dec0 100644
--- a/src/main/java/fr/icdc/ebad/service/NotificationService.java
+++ b/src/main/java/fr/icdc/ebad/service/NotificationService.java
@@ -4,12 +4,12 @@
import fr.icdc.ebad.domain.User;
import fr.icdc.ebad.repository.NotificationRepository;
import fr.icdc.ebad.security.SecurityUtils;
-import org.joda.time.DateTime;
import org.springframework.data.domain.Sort;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import java.time.LocalDateTime;
import java.util.List;
/**
@@ -32,7 +32,7 @@ public void createNotification(String message, User user, boolean isDanger) {
}
Notification notification = new Notification();
notification.setContent(message);
- notification.setCreatedDate(DateTime.now());
+ notification.setCreatedDate(LocalDateTime.now());
notification.setReceiver(user);
notification.setDanger(isDanger);
Notification result = notificationRepository.save(notification);
diff --git a/src/main/java/fr/icdc/ebad/service/PluginService.java b/src/main/java/fr/icdc/ebad/service/PluginService.java
index a43a0e72..1a3fad19 100644
--- a/src/main/java/fr/icdc/ebad/service/PluginService.java
+++ b/src/main/java/fr/icdc/ebad/service/PluginService.java
@@ -1,13 +1,12 @@
package fr.icdc.ebad.service;
+import jakarta.annotation.PostConstruct;
import org.pf4j.PluginWrapper;
import org.pf4j.spring.SpringPluginManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
-import javax.annotation.PostConstruct;
-
@Service
public class PluginService {
private static final Logger LOGGER = LoggerFactory.getLogger(PluginService.class);
diff --git a/src/main/java/fr/icdc/ebad/service/UserService.java b/src/main/java/fr/icdc/ebad/service/UserService.java
index 24ead86c..94656e71 100644
--- a/src/main/java/fr/icdc/ebad/service/UserService.java
+++ b/src/main/java/fr/icdc/ebad/service/UserService.java
@@ -12,7 +12,6 @@
import fr.icdc.ebad.service.util.EbadServiceException;
import fr.icdc.ebad.service.util.RandomUtil;
import fr.icdc.ebad.web.rest.dto.AuthorityApplicationDTO;
-import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
@@ -22,6 +21,10 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.temporal.ChronoUnit;
+import java.time.temporal.TemporalUnit;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
@@ -129,7 +132,7 @@ public User getUserWithAuthorities() throws EbadServiceException {
@Scheduled(cron = "0 0 1 * * ?")
@Transactional
public void removeNotActivatedUsers() {
- DateTime now = new DateTime();
+ LocalDateTime now = LocalDateTime.now();
List users = userRepository.findAllByActivatedIsFalseAndCreatedDateBefore(now.minusDays(NUMBERS_OF_DAY_KEEP_INACTIVATE_USERS));
for (User user : users) {
LOGGER.debug("Deleting not activated user {}", user.getLogin());
diff --git a/src/main/java/fr/icdc/ebad/web/ResponseUtil.java b/src/main/java/fr/icdc/ebad/web/ResponseUtil.java
index e16d2bd6..48ba5cb2 100644
--- a/src/main/java/fr/icdc/ebad/web/ResponseUtil.java
+++ b/src/main/java/fr/icdc/ebad/web/ResponseUtil.java
@@ -4,7 +4,6 @@
import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity;
-import javax.persistence.EntityNotFoundException;
import java.util.Optional;
public final class ResponseUtil {
diff --git a/src/main/java/fr/icdc/ebad/web/filter/CachingHttpHeadersFilter.java b/src/main/java/fr/icdc/ebad/web/filter/CachingHttpHeadersFilter.java
index 2a93745e..e303f2cc 100644
--- a/src/main/java/fr/icdc/ebad/web/filter/CachingHttpHeadersFilter.java
+++ b/src/main/java/fr/icdc/ebad/web/filter/CachingHttpHeadersFilter.java
@@ -1,12 +1,14 @@
package fr.icdc.ebad.web.filter;
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletResponse;
+
+import jakarta.servlet.Filter;
+import jakarta.servlet.FilterChain;
+import jakarta.servlet.FilterConfig;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.ServletRequest;
+import jakarta.servlet.ServletResponse;
+import jakarta.servlet.http.HttpServletResponse;
+
import java.io.IOException;
import java.util.concurrent.TimeUnit;
diff --git a/src/main/java/fr/icdc/ebad/web/rest/AccountResource.java b/src/main/java/fr/icdc/ebad/web/rest/AccountResource.java
index b57bdbf3..91b9a67b 100644
--- a/src/main/java/fr/icdc/ebad/web/rest/AccountResource.java
+++ b/src/main/java/fr/icdc/ebad/web/rest/AccountResource.java
@@ -20,7 +20,6 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
-import javax.servlet.http.HttpServletRequest;
import java.util.LinkedList;
import java.util.Optional;
import java.util.stream.Collectors;
diff --git a/src/main/java/fr/icdc/ebad/web/rest/AccreditationRequestResource.java b/src/main/java/fr/icdc/ebad/web/rest/AccreditationRequestResource.java
index e53eed37..7b430360 100644
--- a/src/main/java/fr/icdc/ebad/web/rest/AccreditationRequestResource.java
+++ b/src/main/java/fr/icdc/ebad/web/rest/AccreditationRequestResource.java
@@ -2,24 +2,28 @@
import fr.icdc.ebad.domain.AccreditationRequest;
+import fr.icdc.ebad.mapper.MapStructMapper;
import fr.icdc.ebad.service.AccreditationRequestService;
import fr.icdc.ebad.service.util.EbadServiceException;
import fr.icdc.ebad.web.rest.dto.AccreditationRequestDto;
import fr.icdc.ebad.web.rest.dto.CreationAccreditationRequestDto;
import fr.icdc.ebad.web.rest.dto.ResponseAccreditationRequestDto;
-import fr.icdc.ebad.mapper.MapStructMapper;
import fr.icdc.ebad.web.rest.util.PaginationUtil;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.validation.Valid;
import org.springdoc.core.converters.models.PageableAsQueryParam;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.BindingResult;
-import org.springframework.web.bind.annotation.*;
-
-import javax.validation.Valid;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/accreditation-requests")
diff --git a/src/main/java/fr/icdc/ebad/web/rest/ApiTokenResource.java b/src/main/java/fr/icdc/ebad/web/rest/ApiTokenResource.java
index 24ad5eaa..ba53865d 100644
--- a/src/main/java/fr/icdc/ebad/web/rest/ApiTokenResource.java
+++ b/src/main/java/fr/icdc/ebad/web/rest/ApiTokenResource.java
@@ -1,16 +1,17 @@
package fr.icdc.ebad.web.rest;
import fr.icdc.ebad.domain.ApiToken;
+import fr.icdc.ebad.mapper.MapStructMapper;
import fr.icdc.ebad.security.SecurityUtils;
import fr.icdc.ebad.service.ApiTokenService;
import fr.icdc.ebad.service.util.EbadServiceException;
import fr.icdc.ebad.web.rest.dto.ApiTokenDto;
import fr.icdc.ebad.web.rest.dto.ApiTokenWithKeyDto;
-import fr.icdc.ebad.mapper.MapStructMapper;
import fr.icdc.ebad.web.rest.util.PaginationUtil;
import io.micrometer.core.annotation.Timed;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springdoc.core.converters.models.PageableAsQueryParam;
@@ -19,9 +20,13 @@
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-import javax.validation.Valid;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api-tokens")
diff --git a/src/main/java/fr/icdc/ebad/web/rest/BatchResource.java b/src/main/java/fr/icdc/ebad/web/rest/BatchResource.java
index 8eb60151..5428e52b 100644
--- a/src/main/java/fr/icdc/ebad/web/rest/BatchResource.java
+++ b/src/main/java/fr/icdc/ebad/web/rest/BatchResource.java
@@ -12,6 +12,7 @@
import io.micrometer.core.annotation.Timed;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.validation.Valid;
import org.jobrunr.jobs.JobId;
import org.jobrunr.scheduling.JobScheduler;
import org.slf4j.Logger;
@@ -24,10 +25,17 @@
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PatchMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;
-import javax.validation.Valid;
import java.time.Duration;
import java.util.UUID;
diff --git a/src/main/java/fr/icdc/ebad/web/rest/DirectoryResource.java b/src/main/java/fr/icdc/ebad/web/rest/DirectoryResource.java
index b5b78093..3c0c7cf8 100644
--- a/src/main/java/fr/icdc/ebad/web/rest/DirectoryResource.java
+++ b/src/main/java/fr/icdc/ebad/web/rest/DirectoryResource.java
@@ -2,11 +2,11 @@
import com.querydsl.core.types.Predicate;
import fr.icdc.ebad.domain.Directory;
+import fr.icdc.ebad.mapper.MapStructMapper;
import fr.icdc.ebad.service.DirectoryService;
import fr.icdc.ebad.service.util.EbadServiceException;
import fr.icdc.ebad.web.rest.dto.DirectoryDto;
import fr.icdc.ebad.web.rest.dto.FilesDto;
-import fr.icdc.ebad.mapper.MapStructMapper;
import io.micrometer.core.annotation.Timed;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
@@ -14,6 +14,7 @@
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springdoc.core.converters.models.PageableAsQueryParam;
@@ -24,10 +25,17 @@
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PatchMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
-import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.net.URISyntaxException;
diff --git a/src/main/java/fr/icdc/ebad/web/rest/IdentityResource.java b/src/main/java/fr/icdc/ebad/web/rest/IdentityResource.java
index bc7f92c1..5feeb017 100644
--- a/src/main/java/fr/icdc/ebad/web/rest/IdentityResource.java
+++ b/src/main/java/fr/icdc/ebad/web/rest/IdentityResource.java
@@ -2,15 +2,16 @@
import com.querydsl.core.types.Predicate;
import fr.icdc.ebad.domain.Identity;
+import fr.icdc.ebad.mapper.MapStructMapper;
import fr.icdc.ebad.service.IdentityService;
import fr.icdc.ebad.web.ResponseUtil;
import fr.icdc.ebad.web.rest.dto.CompleteIdentityDto;
import fr.icdc.ebad.web.rest.dto.PublicIdentityDto;
-import fr.icdc.ebad.mapper.MapStructMapper;
import fr.icdc.ebad.web.rest.util.PaginationUtil;
import io.micrometer.core.annotation.Timed;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springdoc.core.converters.models.PageableAsQueryParam;
@@ -22,9 +23,15 @@
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PatchMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
-import javax.validation.Valid;
import java.util.Optional;
@RestController
diff --git a/src/main/java/fr/icdc/ebad/web/rest/NormResource.java b/src/main/java/fr/icdc/ebad/web/rest/NormResource.java
index abb1657b..5c6c22c8 100644
--- a/src/main/java/fr/icdc/ebad/web/rest/NormResource.java
+++ b/src/main/java/fr/icdc/ebad/web/rest/NormResource.java
@@ -2,15 +2,16 @@
import com.querydsl.core.types.Predicate;
import fr.icdc.ebad.domain.Norme;
+import fr.icdc.ebad.mapper.MapStructMapper;
import fr.icdc.ebad.service.NormeService;
import fr.icdc.ebad.web.ResponseUtil;
import fr.icdc.ebad.web.rest.dto.NormLabelIdDto;
import fr.icdc.ebad.web.rest.dto.NormeDto;
-import fr.icdc.ebad.mapper.MapStructMapper;
import fr.icdc.ebad.web.rest.util.PaginationUtil;
import io.micrometer.core.annotation.Timed;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springdoc.core.converters.models.PageableAsQueryParam;
@@ -21,9 +22,15 @@
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PatchMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
-import javax.validation.Valid;
import java.util.Optional;
@RestController
diff --git a/src/main/java/fr/icdc/ebad/web/rest/SchedulingResource.java b/src/main/java/fr/icdc/ebad/web/rest/SchedulingResource.java
index e9e89b12..7de729e5 100644
--- a/src/main/java/fr/icdc/ebad/web/rest/SchedulingResource.java
+++ b/src/main/java/fr/icdc/ebad/web/rest/SchedulingResource.java
@@ -2,22 +2,28 @@
import fr.icdc.ebad.domain.Scheduling;
+import fr.icdc.ebad.mapper.MapStructMapper;
import fr.icdc.ebad.service.SchedulingService;
import fr.icdc.ebad.service.util.EbadServiceException;
import fr.icdc.ebad.web.rest.dto.CreationSchedulingDto;
import fr.icdc.ebad.web.rest.dto.SchedulingDto;
-import fr.icdc.ebad.mapper.MapStructMapper;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.validation.Valid;
import org.springdoc.core.converters.models.PageableAsQueryParam;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
-import javax.validation.Valid;
import java.net.URI;
@RestController
diff --git a/src/main/java/fr/icdc/ebad/web/rest/UserJWTController.java b/src/main/java/fr/icdc/ebad/web/rest/UserJWTController.java
index b455438b..31336703 100644
--- a/src/main/java/fr/icdc/ebad/web/rest/UserJWTController.java
+++ b/src/main/java/fr/icdc/ebad/web/rest/UserJWTController.java
@@ -10,6 +10,7 @@
import fr.icdc.ebad.web.rest.dto.UserDto;
import io.micrometer.core.annotation.Timed;
import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.validation.Valid;
import org.springframework.context.annotation.Profile;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
@@ -22,8 +23,6 @@
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
-import javax.validation.Valid;
-
/**
* Controller to authenticate users.
*/
diff --git a/src/main/java/fr/icdc/ebad/web/rest/UserResource.java b/src/main/java/fr/icdc/ebad/web/rest/UserResource.java
index 8a4ffec2..41a38a6e 100644
--- a/src/main/java/fr/icdc/ebad/web/rest/UserResource.java
+++ b/src/main/java/fr/icdc/ebad/web/rest/UserResource.java
@@ -13,6 +13,7 @@
import io.micrometer.core.annotation.Timed;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springdoc.core.converters.models.PageableAsQueryParam;
@@ -32,7 +33,6 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
-import javax.validation.Valid;
import java.util.Optional;
/**
diff --git a/src/main/java/fr/icdc/ebad/web/rest/dto/AccreditationRequestDto.java b/src/main/java/fr/icdc/ebad/web/rest/dto/AccreditationRequestDto.java
index 2e268cd8..ca91afde 100644
--- a/src/main/java/fr/icdc/ebad/web/rest/dto/AccreditationRequestDto.java
+++ b/src/main/java/fr/icdc/ebad/web/rest/dto/AccreditationRequestDto.java
@@ -1,15 +1,13 @@
package fr.icdc.ebad.web.rest.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
-import fr.icdc.ebad.web.rest.validator.AccreditationValidator;
+import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
-import javax.validation.constraints.NotNull;
-
@Data
@Builder
@EqualsAndHashCode
diff --git a/src/main/java/fr/icdc/ebad/web/rest/dto/ApiTokenDto.java b/src/main/java/fr/icdc/ebad/web/rest/dto/ApiTokenDto.java
index 0807fc80..93171ce2 100644
--- a/src/main/java/fr/icdc/ebad/web/rest/dto/ApiTokenDto.java
+++ b/src/main/java/fr/icdc/ebad/web/rest/dto/ApiTokenDto.java
@@ -1,9 +1,8 @@
package fr.icdc.ebad.web.rest.dto;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
-import javax.validation.constraints.NotNull;
-
@Data
public class ApiTokenDto {
private Long id;
diff --git a/src/main/java/fr/icdc/ebad/web/rest/dto/BatchDto.java b/src/main/java/fr/icdc/ebad/web/rest/dto/BatchDto.java
index 11c621e3..2e4b1c5a 100644
--- a/src/main/java/fr/icdc/ebad/web/rest/dto/BatchDto.java
+++ b/src/main/java/fr/icdc/ebad/web/rest/dto/BatchDto.java
@@ -1,12 +1,12 @@
package fr.icdc.ebad.web.rest.dto;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotEmpty;
+import jakarta.validation.constraints.Size;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotEmpty;
-import javax.validation.constraints.Size;
import java.util.HashSet;
import java.util.Set;
diff --git a/src/main/java/fr/icdc/ebad/web/rest/dto/CompleteIdentityDto.java b/src/main/java/fr/icdc/ebad/web/rest/dto/CompleteIdentityDto.java
index 8d034954..3f8496dc 100644
--- a/src/main/java/fr/icdc/ebad/web/rest/dto/CompleteIdentityDto.java
+++ b/src/main/java/fr/icdc/ebad/web/rest/dto/CompleteIdentityDto.java
@@ -1,12 +1,11 @@
package fr.icdc.ebad.web.rest.dto;
+import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
-import javax.validation.constraints.NotNull;
-
@Data
@Builder
@NoArgsConstructor
diff --git a/src/main/java/fr/icdc/ebad/web/rest/dto/CreationAccreditationRequestDto.java b/src/main/java/fr/icdc/ebad/web/rest/dto/CreationAccreditationRequestDto.java
index 4522e333..7be02e20 100644
--- a/src/main/java/fr/icdc/ebad/web/rest/dto/CreationAccreditationRequestDto.java
+++ b/src/main/java/fr/icdc/ebad/web/rest/dto/CreationAccreditationRequestDto.java
@@ -1,14 +1,13 @@
package fr.icdc.ebad.web.rest.dto;
import fr.icdc.ebad.web.rest.validator.AccreditationValidator;
+import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
-import javax.validation.constraints.NotNull;
-
@Data
@Builder
@EqualsAndHashCode
diff --git a/src/main/java/fr/icdc/ebad/web/rest/dto/CreationSchedulingDto.java b/src/main/java/fr/icdc/ebad/web/rest/dto/CreationSchedulingDto.java
index 6dea55f5..67d20a07 100644
--- a/src/main/java/fr/icdc/ebad/web/rest/dto/CreationSchedulingDto.java
+++ b/src/main/java/fr/icdc/ebad/web/rest/dto/CreationSchedulingDto.java
@@ -1,14 +1,13 @@
package fr.icdc.ebad.web.rest.dto;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-
@Data
@ToString
@Builder
diff --git a/src/main/java/fr/icdc/ebad/web/rest/dto/LoginDto.java b/src/main/java/fr/icdc/ebad/web/rest/dto/LoginDto.java
index ad31d4b5..aa312901 100644
--- a/src/main/java/fr/icdc/ebad/web/rest/dto/LoginDto.java
+++ b/src/main/java/fr/icdc/ebad/web/rest/dto/LoginDto.java
@@ -1,10 +1,9 @@
package fr.icdc.ebad.web.rest.dto;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Size;
import lombok.Data;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
-
/**
* View Model object for storing a user's credentials.
*/
diff --git a/src/main/java/fr/icdc/ebad/web/rest/dto/ManagedUserDto.java b/src/main/java/fr/icdc/ebad/web/rest/dto/ManagedUserDto.java
index 028e4431..e7d4d03c 100644
--- a/src/main/java/fr/icdc/ebad/web/rest/dto/ManagedUserDto.java
+++ b/src/main/java/fr/icdc/ebad/web/rest/dto/ManagedUserDto.java
@@ -1,13 +1,12 @@
package fr.icdc.ebad.web.rest.dto;
+import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
-import javax.validation.constraints.Size;
-
/**
* View Model extending the UserAccountDto, which is meant to be used in the user management UI.
*/
diff --git a/src/main/java/fr/icdc/ebad/web/rest/dto/NormeDto.java b/src/main/java/fr/icdc/ebad/web/rest/dto/NormeDto.java
index 94056ffb..058c3413 100644
--- a/src/main/java/fr/icdc/ebad/web/rest/dto/NormeDto.java
+++ b/src/main/java/fr/icdc/ebad/web/rest/dto/NormeDto.java
@@ -1,13 +1,12 @@
package fr.icdc.ebad.web.rest.dto;
+import jakarta.validation.constraints.NotBlank;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
-import javax.validation.constraints.NotBlank;
-
@Data
@Builder
@AllArgsConstructor
diff --git a/src/main/java/fr/icdc/ebad/web/rest/dto/NotificationDto.java b/src/main/java/fr/icdc/ebad/web/rest/dto/NotificationDto.java
index be868352..526d0ecd 100644
--- a/src/main/java/fr/icdc/ebad/web/rest/dto/NotificationDto.java
+++ b/src/main/java/fr/icdc/ebad/web/rest/dto/NotificationDto.java
@@ -1,12 +1,13 @@
package fr.icdc.ebad.web.rest.dto;
import lombok.Data;
-import org.joda.time.DateTime;
+
+import java.time.LocalDateTime;
@Data
public class NotificationDto {
private Long id;
private String content;
- private DateTime createdDate = DateTime.now();
+ private LocalDateTime createdDate = LocalDateTime.now();
private boolean read = false;
}
diff --git a/src/main/java/fr/icdc/ebad/web/rest/dto/PublicIdentityDto.java b/src/main/java/fr/icdc/ebad/web/rest/dto/PublicIdentityDto.java
index 54fb24a5..611fbc04 100644
--- a/src/main/java/fr/icdc/ebad/web/rest/dto/PublicIdentityDto.java
+++ b/src/main/java/fr/icdc/ebad/web/rest/dto/PublicIdentityDto.java
@@ -1,9 +1,8 @@
package fr.icdc.ebad.web.rest.dto;
+import jakarta.validation.constraints.NotNull;
import lombok.Data;
-import javax.validation.constraints.NotNull;
-
@Data
public class PublicIdentityDto {
private Long id;
diff --git a/src/main/java/fr/icdc/ebad/web/rest/dto/ResponseAccreditationRequestDto.java b/src/main/java/fr/icdc/ebad/web/rest/dto/ResponseAccreditationRequestDto.java
index a97f280c..b05dd814 100644
--- a/src/main/java/fr/icdc/ebad/web/rest/dto/ResponseAccreditationRequestDto.java
+++ b/src/main/java/fr/icdc/ebad/web/rest/dto/ResponseAccreditationRequestDto.java
@@ -1,13 +1,12 @@
package fr.icdc.ebad.web.rest.dto;
+import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
-import javax.validation.constraints.NotNull;
-
@Data
@Builder
@EqualsAndHashCode
diff --git a/src/main/java/fr/icdc/ebad/web/rest/dto/UserAccountDto.java b/src/main/java/fr/icdc/ebad/web/rest/dto/UserAccountDto.java
index 4829707f..74e98c3a 100644
--- a/src/main/java/fr/icdc/ebad/web/rest/dto/UserAccountDto.java
+++ b/src/main/java/fr/icdc/ebad/web/rest/dto/UserAccountDto.java
@@ -1,12 +1,12 @@
package fr.icdc.ebad.web.rest.dto;
+import jakarta.validation.constraints.Email;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Pattern;
+import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.ToString;
-import javax.validation.constraints.Email;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Pattern;
-import javax.validation.constraints.Size;
import java.util.List;
@Getter
diff --git a/src/main/java/fr/icdc/ebad/web/rest/errors/ApiError.java b/src/main/java/fr/icdc/ebad/web/rest/errors/ApiError.java
index 1ea43a31..e2692623 100644
--- a/src/main/java/fr/icdc/ebad/web/rest/errors/ApiError.java
+++ b/src/main/java/fr/icdc/ebad/web/rest/errors/ApiError.java
@@ -93,9 +93,10 @@ public void addValidationError(List globalErrors) {
* @param cv the ConstraintViolation
*/
private void addValidationError(ConstraintViolation> cv) {
+ PathImpl path = PathImpl.createPathFromString(cv.getPropertyPath().toString());
this.addValidationError(
cv.getRootBeanClass().getSimpleName(),
- ((PathImpl) cv.getPropertyPath()).getLeafNode().asString(),
+ path.getLeafNode().asString(),
cv.getInvalidValue(),
cv.getMessage());
}
diff --git a/src/main/java/fr/icdc/ebad/web/rest/errors/ExceptionTranslator.java b/src/main/java/fr/icdc/ebad/web/rest/errors/ExceptionTranslator.java
index f61e8e15..2467eefb 100644
--- a/src/main/java/fr/icdc/ebad/web/rest/errors/ExceptionTranslator.java
+++ b/src/main/java/fr/icdc/ebad/web/rest/errors/ExceptionTranslator.java
@@ -4,11 +4,13 @@
import fr.icdc.ebad.security.UserNotActivatedException;
import fr.icdc.ebad.service.util.EbadNotFoundException;
import fr.icdc.ebad.service.util.EbadServiceException;
+import jakarta.validation.ConstraintViolationException;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
+import org.springframework.http.HttpStatusCode;
import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.http.converter.HttpMessageNotWritableException;
@@ -24,8 +26,6 @@
import org.springframework.web.servlet.NoHandlerFoundException;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
-import javax.validation.ConstraintViolationException;
-
import static org.springframework.http.HttpStatus.BAD_REQUEST;
/**
@@ -52,7 +52,7 @@ public ExceptionTranslator(MessageSource messageSource) {
@Override
protected ResponseEntity