From ddd1c24f8df5d22915eb60ceb554b93aa06f1cee Mon Sep 17 00:00:00 2001 From: "Robert.McCormack" Date: Fri, 31 May 2024 15:09:11 +0100 Subject: [PATCH] Springboot 3.3.0, initial --- build.gradle | 4 +-- .../bconline/ndelius/UserManagementAPI.java | 4 +-- .../bconline/ndelius/advice/AuditHandler.java | 2 +- .../advice/ControllerExceptionHandler.java | 8 +++--- .../ndelius/config/data/LdapConfig.java | 5 ++-- .../ndelius/config/data/LdapExportConfig.java | 5 ++-- .../data/embedded/EmbeddedLdapServer.java | 2 +- .../data/embedded/EmbeddedRedisServer.java | 4 +-- .../security/AuthorizationServerConfig.java | 19 ++++++++----- .../config/security/ResourceServerConfig.java | 21 +------------- .../config/security/WebSecurityConfig.java | 28 ++++++++----------- .../ndelius/controller/UserController.java | 6 ++-- .../uk/co/bconline/ndelius/model/Dataset.java | 2 +- .../uk/co/bconline/ndelius/model/Group.java | 2 +- .../bconline/ndelius/model/ReferenceData.java | 2 +- .../uk/co/bconline/ndelius/model/Role.java | 2 +- .../uk/co/bconline/ndelius/model/Team.java | 2 +- .../uk/co/bconline/ndelius/model/User.java | 6 ++-- .../model/entity/ChangeNoteEntity.java | 2 +- .../model/entity/OrganisationEntity.java | 2 +- .../model/entity/ProbationAreaEntity.java | 2 +- .../model/entity/ProbationAreaUserEntity.java | 2 +- .../model/entity/ProbationAreaUserId.java | 6 ++-- .../model/entity/ReferenceDataEntity.java | 2 +- .../entity/ReferenceDataMasterEntity.java | 2 +- .../model/entity/SearchResultEntity.java | 12 ++++---- .../ndelius/model/entity/StaffEntity.java | 9 +++--- .../ndelius/model/entity/StaffTeamEntity.java | 2 +- .../ndelius/model/entity/StaffTeamId.java | 6 ++-- .../entity/SubContractedProviderEntity.java | 6 ++-- .../ndelius/model/entity/TeamEntity.java | 7 ++--- .../ndelius/model/entity/UserEntity.java | 8 +++--- .../model/entity/converter/YNConverter.java | 4 +-- .../export/ProbationAreaExportEntity.java | 2 +- .../export/ReferenceDataExportEntity.java | 2 +- .../entity/export/StaffExportEntity.java | 7 ++--- .../model/entity/export/TeamExportEntity.java | 2 +- .../model/entity/export/UserExportEntity.java | 6 ++-- .../bconline/ndelius/service/UserService.java | 2 +- .../ndelius/service/impl/RoleServiceImpl.java | 2 +- .../ndelius/util/EncryptionUtils.java | 4 +-- .../co/bconline/ndelius/util/LdapUtils.java | 4 +-- .../ndelius/validator/AssignableDatasets.java | 4 +-- .../AssignableDatasetsValidator.java | 4 +-- .../ndelius/validator/AssignableGroups.java | 4 +-- .../validator/AssignableGroupsValidator.java | 4 +-- .../ndelius/validator/AssignableRoles.java | 4 +-- .../validator/AssignableRolesValidator.java | 4 +-- .../validator/ConditionallyRequired.java | 4 +-- .../ConditionallyRequiredValidator.java | 4 +-- .../bconline/ndelius/validator/DateRange.java | 4 +-- .../ndelius/validator/DateRangeValidator.java | 4 +-- .../NewUsernameMustNotAlreadyExist.java | 4 +-- ...wUsernameMustNotAlreadyExistValidator.java | 8 +++--- .../validator/PrefixMatchesProviderCode.java | 4 +-- .../PrefixMatchesProviderCodeValidator.java | 4 +-- .../validator/RestrictNationalUsers.java | 4 +-- .../RestrictNationalUsersValidator.java | 4 +-- .../UsernameMustNotAlreadyExist.java | 4 +-- .../UsernameMustNotAlreadyExistValidator.java | 8 +++--- .../ndelius/validator/ValidDates.java | 4 +-- .../validator/ValidDatesValidator.java | 4 +-- .../ndelius/model/UserValidationTest.java | 2 +- 63 files changed, 149 insertions(+), 168 deletions(-) diff --git a/build.gradle b/build.gradle index 45bba6c3..6a580e52 100644 --- a/build.gradle +++ b/build.gradle @@ -3,8 +3,8 @@ plugins { id 'java' id 'idea' id 'jacoco' - id 'org.springframework.boot' version '2.7.1' - id 'io.spring.dependency-management' version '1.1.0' + id 'org.springframework.boot' version '3.3.0' + id 'io.spring.dependency-management' version '1.1.5' id 'com.github.node-gradle.node' version '3.5.1' id 'io.gatling.gradle' version '3.9.0.1' id 'org.sonarqube' version '3.5.0.2730' diff --git a/src/main/java/uk/co/bconline/ndelius/UserManagementAPI.java b/src/main/java/uk/co/bconline/ndelius/UserManagementAPI.java index 727c10a0..55b779b9 100644 --- a/src/main/java/uk/co/bconline/ndelius/UserManagementAPI.java +++ b/src/main/java/uk/co/bconline/ndelius/UserManagementAPI.java @@ -7,7 +7,7 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.ldap.embedded.EmbeddedLdapAutoConfiguration; -import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity; @OpenAPIDefinition( info = @Info( @@ -15,7 +15,7 @@ description = "REST API to enable NPS-ICT to effectively create and maintain user accounts in the National Delius application, and to allow external services to securely authenticate Probation staff.", contact = @Contact(name = "Unilink", url = "https://unilink.com")), externalDocs = @ExternalDocumentation(description = "GitHub", url = "https://github.com/ministryofjustice/ndelius-um")) -@EnableGlobalMethodSecurity(prePostEnabled = true) +@EnableMethodSecurity(prePostEnabled = true) @SpringBootApplication(exclude = {EmbeddedLdapAutoConfiguration.class}) public class UserManagementAPI { public static void main(String[] args) { diff --git a/src/main/java/uk/co/bconline/ndelius/advice/AuditHandler.java b/src/main/java/uk/co/bconline/ndelius/advice/AuditHandler.java index e4e9d5c9..a0b44320 100644 --- a/src/main/java/uk/co/bconline/ndelius/advice/AuditHandler.java +++ b/src/main/java/uk/co/bconline/ndelius/advice/AuditHandler.java @@ -14,7 +14,7 @@ import org.springframework.web.method.HandlerMethod; import uk.co.bconline.ndelius.util.AuthUtils; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import static java.util.Optional.ofNullable; import static org.springframework.web.servlet.HandlerMapping.BEST_MATCHING_HANDLER_ATTRIBUTE; diff --git a/src/main/java/uk/co/bconline/ndelius/advice/ControllerExceptionHandler.java b/src/main/java/uk/co/bconline/ndelius/advice/ControllerExceptionHandler.java index 3c43caa6..58cb6f74 100644 --- a/src/main/java/uk/co/bconline/ndelius/advice/ControllerExceptionHandler.java +++ b/src/main/java/uk/co/bconline/ndelius/advice/ControllerExceptionHandler.java @@ -16,10 +16,10 @@ import uk.co.bconline.ndelius.model.ErrorResponse; import uk.co.bconline.ndelius.model.ForbiddenResponse; -import javax.servlet.http.HttpServletRequest; -import javax.validation.ConstraintViolationException; -import javax.validation.ElementKind; -import javax.validation.Path; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.validation.ConstraintViolationException; +import jakarta.validation.ElementKind; +import jakarta.validation.Path; import java.util.Iterator; import static java.util.stream.Collectors.toList; diff --git a/src/main/java/uk/co/bconline/ndelius/config/data/LdapConfig.java b/src/main/java/uk/co/bconline/ndelius/config/data/LdapConfig.java index d19fa45f..99843501 100644 --- a/src/main/java/uk/co/bconline/ndelius/config/data/LdapConfig.java +++ b/src/main/java/uk/co/bconline/ndelius/config/data/LdapConfig.java @@ -5,6 +5,7 @@ import org.springframework.beans.factory.ObjectProvider; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration; +import org.springframework.boot.autoconfigure.ldap.LdapConnectionDetails; import org.springframework.boot.autoconfigure.ldap.LdapProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -38,9 +39,9 @@ public LdapConfig(Environment environment) { @Bean @Primary @Override - public LdapContextSource ldapContextSource(LdapProperties properties, Environment environment, + public LdapContextSource ldapContextSource(LdapConnectionDetails connectionDetails, LdapProperties properties, ObjectProvider dirContextAuthenticationStrategy) { - val ctxSource = super.ldapContextSource(properties, environment, dirContextAuthenticationStrategy); + val ctxSource = super.ldapContextSource(connectionDetails, properties, dirContextAuthenticationStrategy); val pooled = Boolean.parseBoolean(properties.getBaseEnvironment().getOrDefault("com.sun.jndi.ldap.connect.pool", "false")); ctxSource.setPooled(pooled); return ctxSource; diff --git a/src/main/java/uk/co/bconline/ndelius/config/data/LdapExportConfig.java b/src/main/java/uk/co/bconline/ndelius/config/data/LdapExportConfig.java index ce7a01a8..a3016ed2 100644 --- a/src/main/java/uk/co/bconline/ndelius/config/data/LdapExportConfig.java +++ b/src/main/java/uk/co/bconline/ndelius/config/data/LdapExportConfig.java @@ -6,6 +6,7 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration; +import org.springframework.boot.autoconfigure.ldap.LdapConnectionDetails; import org.springframework.boot.autoconfigure.ldap.LdapProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -23,10 +24,10 @@ public class LdapExportConfig extends LdapAutoConfiguration { @Override @Bean("exportLdapContextSource") - public LdapContextSource ldapContextSource(LdapProperties properties, Environment environment, + public LdapContextSource ldapContextSource(LdapConnectionDetails connectionDetails, LdapProperties properties, ObjectProvider dirContextAuthenticationStrategy) { properties.setUsername(exportUser); - val ctxSource = super.ldapContextSource(properties, environment, dirContextAuthenticationStrategy); + val ctxSource = super.ldapContextSource(connectionDetails, properties, dirContextAuthenticationStrategy); val pooled = Boolean.parseBoolean(properties.getBaseEnvironment().getOrDefault("com.sun.jndi.ldap.connect.pool", "false")); ctxSource.setPooled(pooled); return ctxSource; diff --git a/src/main/java/uk/co/bconline/ndelius/config/data/embedded/EmbeddedLdapServer.java b/src/main/java/uk/co/bconline/ndelius/config/data/embedded/EmbeddedLdapServer.java index 00e9c3ac..dbb7abaa 100644 --- a/src/main/java/uk/co/bconline/ndelius/config/data/embedded/EmbeddedLdapServer.java +++ b/src/main/java/uk/co/bconline/ndelius/config/data/embedded/EmbeddedLdapServer.java @@ -33,7 +33,7 @@ import uk.co.bconline.ndelius.config.data.embedded.interceptor.AliasInterceptor; import uk.co.bconline.ndelius.config.data.embedded.interceptor.MemberOfInterceptor; -import javax.annotation.PreDestroy; +import jakarta.annotation.PreDestroy; import java.io.InputStream; import java.util.Collections; import java.util.HashMap; diff --git a/src/main/java/uk/co/bconline/ndelius/config/data/embedded/EmbeddedRedisServer.java b/src/main/java/uk/co/bconline/ndelius/config/data/embedded/EmbeddedRedisServer.java index 75c57826..6935782e 100644 --- a/src/main/java/uk/co/bconline/ndelius/config/data/embedded/EmbeddedRedisServer.java +++ b/src/main/java/uk/co/bconline/ndelius/config/data/embedded/EmbeddedRedisServer.java @@ -5,8 +5,8 @@ import org.springframework.stereotype.Component; import redis.embedded.RedisServer; -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; +import jakarta.annotation.PostConstruct; +import jakarta.annotation.PreDestroy; import java.io.IOException; @Component diff --git a/src/main/java/uk/co/bconline/ndelius/config/security/AuthorizationServerConfig.java b/src/main/java/uk/co/bconline/ndelius/config/security/AuthorizationServerConfig.java index 4abea816..34d386f0 100644 --- a/src/main/java/uk/co/bconline/ndelius/config/security/AuthorizationServerConfig.java +++ b/src/main/java/uk/co/bconline/ndelius/config/security/AuthorizationServerConfig.java @@ -8,6 +8,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer; @@ -28,15 +29,14 @@ import org.springframework.web.filter.CorsFilter; import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.ModelAndView; -import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; import org.springframework.web.servlet.view.RedirectView; import uk.co.bconline.ndelius.config.security.provider.endpoint.PathMatchRedirectResolver; import uk.co.bconline.ndelius.config.security.provider.token.PreAuthenticatedTokenGranter; import uk.co.bconline.ndelius.config.security.provider.token.store.redis.SaferRedisTokenStore; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpSession; import static java.util.Arrays.asList; @@ -87,8 +87,8 @@ public void configure(AuthorizationServerSecurityConfigurer security) { security.realm("ndelius-clients") .passwordEncoder(passwordEncoder) .tokenKeyAccess("permitAll()") - .checkTokenAccess("isAuthenticated()") - .addTokenEndpointAuthenticationFilter(new CorsFilter(corsConfigurationSource())); + .checkTokenAccess("isAuthenticated()"); +// .addTokenEndpointAuthenticationFilter((Filter) new CorsFilter(corsConfigurationSource())); } @Override @@ -135,7 +135,7 @@ public static ConfigureRedisAction configureRedisAction() { */ @Bean public HandlerInterceptor invalidateSessionInterceptor() { - return new HandlerInterceptorAdapter() { + return new HandlerInterceptor() { @Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, @@ -153,6 +153,11 @@ public void postHandle(HttpServletRequest request, }; } + @Bean + public AuthenticationManager authenticationManager(AuthenticationConfiguration authenticationConfiguration) throws Exception { + return authenticationConfiguration.getAuthenticationManager(); + } + private TokenGranter tokenGranter(final AuthorizationServerEndpointsConfigurer endpoints) { // Append the token granter for the 'preauthenticated' grant_type to the list of oauth token granters return new CompositeTokenGranter(asList(endpoints.getTokenGranter(), diff --git a/src/main/java/uk/co/bconline/ndelius/config/security/ResourceServerConfig.java b/src/main/java/uk/co/bconline/ndelius/config/security/ResourceServerConfig.java index fdd0a050..ad4f206e 100644 --- a/src/main/java/uk/co/bconline/ndelius/config/security/ResourceServerConfig.java +++ b/src/main/java/uk/co/bconline/ndelius/config/security/ResourceServerConfig.java @@ -2,12 +2,8 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.crypto.password.LdapShaPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; -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.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import uk.co.bconline.ndelius.util.LdapUtils; @@ -15,17 +11,7 @@ import static org.springframework.web.cors.CorsConfiguration.ALL; @Configuration -@EnableResourceServer -public class ResourceServerConfig extends ResourceServerConfigurerAdapter { - - @Override - public void configure(HttpSecurity http) throws Exception { - http.authorizeRequests() - .mvcMatchers("/api/**").authenticated() - .and().cors() - .and().headers().frameOptions().disable() - .and().csrf().disable(); - } +public class ResourceServerConfig { @Bean public WebMvcConfigurer corsConfigurer() { @@ -37,11 +23,6 @@ public void addCorsMappings(CorsRegistry registry) { }; } - @Override - public void configure(ResourceServerSecurityConfigurer resources) throws Exception { - resources.resourceId("NDelius"); - } - @Bean public PasswordEncoder passwordEncoder() { return new LdapShaPasswordEncoder() diff --git a/src/main/java/uk/co/bconline/ndelius/config/security/WebSecurityConfig.java b/src/main/java/uk/co/bconline/ndelius/config/security/WebSecurityConfig.java index 2f539d2b..c41b626e 100644 --- a/src/main/java/uk/co/bconline/ndelius/config/security/WebSecurityConfig.java +++ b/src/main/java/uk/co/bconline/ndelius/config/security/WebSecurityConfig.java @@ -3,29 +3,25 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.annotation.Order; -import org.springframework.security.authentication.AuthenticationManager; 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.annotation.web.configurers.HeadersConfigurer; +import org.springframework.security.web.SecurityFilterChain; @Order(1) @Configuration @EnableWebSecurity -public class WebSecurityConfig extends WebSecurityConfigurerAdapter { +public class WebSecurityConfig { + @Bean - @Override - public AuthenticationManager authenticationManager() throws Exception { - return super.authenticationManager(); - } + public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { + http.authorizeHttpRequests(auth -> auth + .requestMatchers("/login", "/oauth/authorize") + .permitAll() + .anyRequest().authenticated()).formLogin(form -> form.loginPage("/login").permitAll()) + .httpBasic(basic -> basic.realmName("ndelius-users")) + .headers(options -> options.frameOptions(HeadersConfigurer.FrameOptionsConfig::disable)); - @Override - protected void configure(HttpSecurity httpSecurity) throws Exception { - httpSecurity.requestMatchers() - .antMatchers("/login", "/oauth/authorize") - .and().authorizeRequests() - .anyRequest().authenticated() - .and().formLogin().loginPage("/login").permitAll() - .and().httpBasic().realmName("ndelius-users") - .and().headers().frameOptions().disable(); + return http.build(); } } diff --git a/src/main/java/uk/co/bconline/ndelius/controller/UserController.java b/src/main/java/uk/co/bconline/ndelius/controller/UserController.java index a4c367c7..db87f8bd 100644 --- a/src/main/java/uk/co/bconline/ndelius/controller/UserController.java +++ b/src/main/java/uk/co/bconline/ndelius/controller/UserController.java @@ -20,9 +20,9 @@ import uk.co.bconline.ndelius.validator.NewUsernameMustNotAlreadyExist; import uk.co.bconline.ndelius.validator.UsernameMustNotAlreadyExist; -import javax.servlet.http.HttpServletResponse; -import javax.validation.constraints.Max; -import javax.validation.constraints.Min; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.Max; +import jakarta.validation.constraints.Min; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; diff --git a/src/main/java/uk/co/bconline/ndelius/model/Dataset.java b/src/main/java/uk/co/bconline/ndelius/model/Dataset.java index d4995381..d9932347 100644 --- a/src/main/java/uk/co/bconline/ndelius/model/Dataset.java +++ b/src/main/java/uk/co/bconline/ndelius/model/Dataset.java @@ -2,7 +2,7 @@ import lombok.*; -import javax.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotBlank; @Getter @Builder diff --git a/src/main/java/uk/co/bconline/ndelius/model/Group.java b/src/main/java/uk/co/bconline/ndelius/model/Group.java index 1eefe4a3..de32351d 100644 --- a/src/main/java/uk/co/bconline/ndelius/model/Group.java +++ b/src/main/java/uk/co/bconline/ndelius/model/Group.java @@ -3,7 +3,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import lombok.*; -import javax.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotBlank; import java.util.List; import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; diff --git a/src/main/java/uk/co/bconline/ndelius/model/ReferenceData.java b/src/main/java/uk/co/bconline/ndelius/model/ReferenceData.java index 06ef6a8c..767a53ac 100644 --- a/src/main/java/uk/co/bconline/ndelius/model/ReferenceData.java +++ b/src/main/java/uk/co/bconline/ndelius/model/ReferenceData.java @@ -1,6 +1,6 @@ package uk.co.bconline.ndelius.model; -import javax.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotBlank; import lombok.*; diff --git a/src/main/java/uk/co/bconline/ndelius/model/Role.java b/src/main/java/uk/co/bconline/ndelius/model/Role.java index 4a7d1d3c..a899f2dc 100644 --- a/src/main/java/uk/co/bconline/ndelius/model/Role.java +++ b/src/main/java/uk/co/bconline/ndelius/model/Role.java @@ -3,7 +3,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import lombok.*; -import javax.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotBlank; import java.util.List; import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; diff --git a/src/main/java/uk/co/bconline/ndelius/model/Team.java b/src/main/java/uk/co/bconline/ndelius/model/Team.java index 0c1f795d..29dd0836 100644 --- a/src/main/java/uk/co/bconline/ndelius/model/Team.java +++ b/src/main/java/uk/co/bconline/ndelius/model/Team.java @@ -2,7 +2,7 @@ import lombok.*; -import javax.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotBlank; @Getter @Builder diff --git a/src/main/java/uk/co/bconline/ndelius/model/User.java b/src/main/java/uk/co/bconline/ndelius/model/User.java index 453c925c..565fb0dd 100644 --- a/src/main/java/uk/co/bconline/ndelius/model/User.java +++ b/src/main/java/uk/co/bconline/ndelius/model/User.java @@ -6,9 +6,9 @@ import lombok.*; import uk.co.bconline.ndelius.validator.*; -import javax.persistence.Transient; -import javax.validation.Valid; -import javax.validation.constraints.*; +import jakarta.persistence.Transient; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; import java.time.LocalDate; import java.util.List; import java.util.Map; diff --git a/src/main/java/uk/co/bconline/ndelius/model/entity/ChangeNoteEntity.java b/src/main/java/uk/co/bconline/ndelius/model/entity/ChangeNoteEntity.java index 64628b06..cf774c24 100644 --- a/src/main/java/uk/co/bconline/ndelius/model/entity/ChangeNoteEntity.java +++ b/src/main/java/uk/co/bconline/ndelius/model/entity/ChangeNoteEntity.java @@ -2,7 +2,7 @@ import lombok.*; -import javax.persistence.*; +import jakarta.persistence.*; import java.io.Serializable; import java.time.LocalDateTime; diff --git a/src/main/java/uk/co/bconline/ndelius/model/entity/OrganisationEntity.java b/src/main/java/uk/co/bconline/ndelius/model/entity/OrganisationEntity.java index d9ba72f8..47d4bf23 100644 --- a/src/main/java/uk/co/bconline/ndelius/model/entity/OrganisationEntity.java +++ b/src/main/java/uk/co/bconline/ndelius/model/entity/OrganisationEntity.java @@ -6,7 +6,7 @@ import lombok.NoArgsConstructor; import org.hibernate.annotations.Cache; -import javax.persistence.*; +import jakarta.persistence.*; import java.io.Serializable; import static org.hibernate.annotations.CacheConcurrencyStrategy.READ_ONLY; diff --git a/src/main/java/uk/co/bconline/ndelius/model/entity/ProbationAreaEntity.java b/src/main/java/uk/co/bconline/ndelius/model/entity/ProbationAreaEntity.java index f0701a20..8997d712 100644 --- a/src/main/java/uk/co/bconline/ndelius/model/entity/ProbationAreaEntity.java +++ b/src/main/java/uk/co/bconline/ndelius/model/entity/ProbationAreaEntity.java @@ -7,7 +7,7 @@ import org.hibernate.annotations.Cache; import uk.co.bconline.ndelius.model.entity.converter.YNConverter; -import javax.persistence.*; +import jakarta.persistence.*; import java.io.Serializable; import java.util.Set; diff --git a/src/main/java/uk/co/bconline/ndelius/model/entity/ProbationAreaUserEntity.java b/src/main/java/uk/co/bconline/ndelius/model/entity/ProbationAreaUserEntity.java index f84bdad3..4c1535a7 100644 --- a/src/main/java/uk/co/bconline/ndelius/model/entity/ProbationAreaUserEntity.java +++ b/src/main/java/uk/co/bconline/ndelius/model/entity/ProbationAreaUserEntity.java @@ -5,7 +5,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; -import javax.persistence.*; +import jakarta.persistence.*; import java.io.Serializable; import java.time.LocalDateTime; diff --git a/src/main/java/uk/co/bconline/ndelius/model/entity/ProbationAreaUserId.java b/src/main/java/uk/co/bconline/ndelius/model/entity/ProbationAreaUserId.java index 46d31e18..381aa7dc 100644 --- a/src/main/java/uk/co/bconline/ndelius/model/entity/ProbationAreaUserId.java +++ b/src/main/java/uk/co/bconline/ndelius/model/entity/ProbationAreaUserId.java @@ -4,9 +4,9 @@ import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; -import javax.persistence.Embeddable; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; +import jakarta.persistence.Embeddable; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; import java.io.Serializable; @Embeddable diff --git a/src/main/java/uk/co/bconline/ndelius/model/entity/ReferenceDataEntity.java b/src/main/java/uk/co/bconline/ndelius/model/entity/ReferenceDataEntity.java index 969cef6c..b7f8f3ad 100644 --- a/src/main/java/uk/co/bconline/ndelius/model/entity/ReferenceDataEntity.java +++ b/src/main/java/uk/co/bconline/ndelius/model/entity/ReferenceDataEntity.java @@ -6,7 +6,7 @@ import lombok.NoArgsConstructor; import org.hibernate.annotations.Cache; -import javax.persistence.*; +import jakarta.persistence.*; import java.io.Serializable; import static org.hibernate.annotations.CacheConcurrencyStrategy.READ_ONLY; diff --git a/src/main/java/uk/co/bconline/ndelius/model/entity/ReferenceDataMasterEntity.java b/src/main/java/uk/co/bconline/ndelius/model/entity/ReferenceDataMasterEntity.java index 8d1e54cc..1bb90b90 100644 --- a/src/main/java/uk/co/bconline/ndelius/model/entity/ReferenceDataMasterEntity.java +++ b/src/main/java/uk/co/bconline/ndelius/model/entity/ReferenceDataMasterEntity.java @@ -3,7 +3,7 @@ import lombok.Getter; import org.hibernate.annotations.Cache; -import javax.persistence.*; +import jakarta.persistence.*; import java.io.Serializable; import static org.hibernate.annotations.CacheConcurrencyStrategy.READ_ONLY; diff --git a/src/main/java/uk/co/bconline/ndelius/model/entity/SearchResultEntity.java b/src/main/java/uk/co/bconline/ndelius/model/entity/SearchResultEntity.java index b3b66271..1fa17349 100644 --- a/src/main/java/uk/co/bconline/ndelius/model/entity/SearchResultEntity.java +++ b/src/main/java/uk/co/bconline/ndelius/model/entity/SearchResultEntity.java @@ -4,12 +4,13 @@ import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; -import org.hibernate.annotations.Type; +import org.hibernate.type.YesNoConverter; +import jakarta.persistence.Convert; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Transient; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Transient; import java.time.LocalDate; import java.util.HashSet; import java.util.Set; @@ -37,7 +38,6 @@ public class SearchResultEntity private String surname; @Column(name = "END_DATE") - @Type(type = "java.time.LocalDate") private LocalDate endDate; @Column(name = "STAFF_CODE") diff --git a/src/main/java/uk/co/bconline/ndelius/model/entity/StaffEntity.java b/src/main/java/uk/co/bconline/ndelius/model/entity/StaffEntity.java index 3eb38490..a2fb710f 100644 --- a/src/main/java/uk/co/bconline/ndelius/model/entity/StaffEntity.java +++ b/src/main/java/uk/co/bconline/ndelius/model/entity/StaffEntity.java @@ -2,9 +2,10 @@ import lombok.*; import org.hibernate.annotations.NotFound; -import org.hibernate.annotations.Type; +import org.hibernate.type.YesNoConverter; +import jakarta.persistence.Convert; -import javax.persistence.*; +import jakarta.persistence.*; import java.io.Serializable; import java.time.LocalDate; import java.time.LocalDateTime; @@ -14,7 +15,7 @@ import static java.util.Collections.emptySet; import static java.util.Optional.ofNullable; -import static javax.persistence.FetchType.EAGER; +import static jakarta.persistence.FetchType.EAGER; import static org.hibernate.annotations.NotFoundAction.IGNORE; @Getter @@ -53,11 +54,9 @@ public class StaffEntity implements Serializable private Boolean privateStaff; @Column(name = "START_DATE") - @Type(type = "java.time.LocalDate") private LocalDate startDate; @Column(name = "END_DATE") - @Type(type = "java.time.LocalDate") private LocalDate endDate; @Column(name = "PROBATION_AREA_ID") diff --git a/src/main/java/uk/co/bconline/ndelius/model/entity/StaffTeamEntity.java b/src/main/java/uk/co/bconline/ndelius/model/entity/StaffTeamEntity.java index 9dcfb889..efb31d72 100644 --- a/src/main/java/uk/co/bconline/ndelius/model/entity/StaffTeamEntity.java +++ b/src/main/java/uk/co/bconline/ndelius/model/entity/StaffTeamEntity.java @@ -5,7 +5,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; -import javax.persistence.*; +import jakarta.persistence.*; import java.io.Serializable; import java.time.LocalDateTime; diff --git a/src/main/java/uk/co/bconline/ndelius/model/entity/StaffTeamId.java b/src/main/java/uk/co/bconline/ndelius/model/entity/StaffTeamId.java index 746251e3..3948ae98 100644 --- a/src/main/java/uk/co/bconline/ndelius/model/entity/StaffTeamId.java +++ b/src/main/java/uk/co/bconline/ndelius/model/entity/StaffTeamId.java @@ -5,9 +5,9 @@ import lombok.NoArgsConstructor; import lombok.Setter; -import javax.persistence.Embeddable; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; +import jakarta.persistence.Embeddable; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; import java.io.Serializable; @Embeddable diff --git a/src/main/java/uk/co/bconline/ndelius/model/entity/SubContractedProviderEntity.java b/src/main/java/uk/co/bconline/ndelius/model/entity/SubContractedProviderEntity.java index a7951326..ff29b53f 100644 --- a/src/main/java/uk/co/bconline/ndelius/model/entity/SubContractedProviderEntity.java +++ b/src/main/java/uk/co/bconline/ndelius/model/entity/SubContractedProviderEntity.java @@ -4,9 +4,10 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import org.hibernate.annotations.Type; +import org.hibernate.type.YesNoConverter; +import jakarta.persistence.Convert; -import javax.persistence.*; +import jakarta.persistence.*; import java.io.Serializable; import java.time.LocalDate; @@ -39,7 +40,6 @@ public SubContractedProviderEntity(Long id) private Boolean active; @Column(name = "END_DATE") - @Type(type = "java.time.LocalDate") private LocalDate endDate; @ManyToOne diff --git a/src/main/java/uk/co/bconline/ndelius/model/entity/TeamEntity.java b/src/main/java/uk/co/bconline/ndelius/model/entity/TeamEntity.java index 7caa2058..21899f0c 100644 --- a/src/main/java/uk/co/bconline/ndelius/model/entity/TeamEntity.java +++ b/src/main/java/uk/co/bconline/ndelius/model/entity/TeamEntity.java @@ -2,9 +2,10 @@ import lombok.*; import org.hibernate.annotations.Cache; -import org.hibernate.annotations.Type; +import org.hibernate.type.YesNoConverter; +import jakarta.persistence.Convert; -import javax.persistence.*; +import jakarta.persistence.*; import java.io.Serializable; import java.time.LocalDate; import java.util.List; @@ -39,11 +40,9 @@ public TeamEntity(Long id) private String description; @Column(name = "START_DATE") - @Type(type = "java.time.LocalDate") private LocalDate startDate; @Column(name = "END_DATE") - @Type(type = "java.time.LocalDate") private LocalDate endDate; @ManyToOne diff --git a/src/main/java/uk/co/bconline/ndelius/model/entity/UserEntity.java b/src/main/java/uk/co/bconline/ndelius/model/entity/UserEntity.java index 466e6565..a929cbf2 100644 --- a/src/main/java/uk/co/bconline/ndelius/model/entity/UserEntity.java +++ b/src/main/java/uk/co/bconline/ndelius/model/entity/UserEntity.java @@ -2,9 +2,10 @@ import lombok.*; import org.hibernate.annotations.NotFound; -import org.hibernate.annotations.Type; +import org.hibernate.type.YesNoConverter; +import jakarta.persistence.Convert; -import javax.persistence.*; +import jakarta.persistence.*; import java.io.Serializable; import java.time.LocalDate; import java.time.LocalDateTime; @@ -14,7 +15,7 @@ import static java.util.Collections.emptySet; import static java.util.Optional.ofNullable; -import static javax.persistence.FetchType.EAGER; +import static jakarta.persistence.FetchType.EAGER; import static org.hibernate.annotations.NotFoundAction.IGNORE; @Getter @@ -52,7 +53,6 @@ public class UserEntity implements Serializable private Boolean privateUser; @Column(name = "END_DATE") - @Type(type = "java.time.LocalDate") private LocalDate endDate; @ManyToOne diff --git a/src/main/java/uk/co/bconline/ndelius/model/entity/converter/YNConverter.java b/src/main/java/uk/co/bconline/ndelius/model/entity/converter/YNConverter.java index 921eaac7..f55be68a 100644 --- a/src/main/java/uk/co/bconline/ndelius/model/entity/converter/YNConverter.java +++ b/src/main/java/uk/co/bconline/ndelius/model/entity/converter/YNConverter.java @@ -1,7 +1,7 @@ package uk.co.bconline.ndelius.model.entity.converter; -import javax.persistence.AttributeConverter; -import javax.persistence.Converter; +import jakarta.persistence.AttributeConverter; +import jakarta.persistence.Converter; @Converter public class YNConverter implements AttributeConverter { diff --git a/src/main/java/uk/co/bconline/ndelius/model/entity/export/ProbationAreaExportEntity.java b/src/main/java/uk/co/bconline/ndelius/model/entity/export/ProbationAreaExportEntity.java index 1c83fdf1..b25c35cc 100644 --- a/src/main/java/uk/co/bconline/ndelius/model/entity/export/ProbationAreaExportEntity.java +++ b/src/main/java/uk/co/bconline/ndelius/model/entity/export/ProbationAreaExportEntity.java @@ -5,7 +5,7 @@ import lombok.NoArgsConstructor; import org.hibernate.annotations.Cache; -import javax.persistence.*; +import jakarta.persistence.*; import java.io.Serializable; import static org.hibernate.annotations.CacheConcurrencyStrategy.READ_ONLY; diff --git a/src/main/java/uk/co/bconline/ndelius/model/entity/export/ReferenceDataExportEntity.java b/src/main/java/uk/co/bconline/ndelius/model/entity/export/ReferenceDataExportEntity.java index 770466f5..9ac41e64 100644 --- a/src/main/java/uk/co/bconline/ndelius/model/entity/export/ReferenceDataExportEntity.java +++ b/src/main/java/uk/co/bconline/ndelius/model/entity/export/ReferenceDataExportEntity.java @@ -5,7 +5,7 @@ import lombok.NoArgsConstructor; import org.hibernate.annotations.Cache; -import javax.persistence.*; +import jakarta.persistence.*; import java.io.Serializable; import static org.hibernate.annotations.CacheConcurrencyStrategy.READ_ONLY; diff --git a/src/main/java/uk/co/bconline/ndelius/model/entity/export/StaffExportEntity.java b/src/main/java/uk/co/bconline/ndelius/model/entity/export/StaffExportEntity.java index 3b2acc42..022f2efe 100644 --- a/src/main/java/uk/co/bconline/ndelius/model/entity/export/StaffExportEntity.java +++ b/src/main/java/uk/co/bconline/ndelius/model/entity/export/StaffExportEntity.java @@ -4,9 +4,10 @@ import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; -import org.hibernate.annotations.Type; +import org.hibernate.type.YesNoConverter; +import jakarta.persistence.Convert; -import javax.persistence.*; +import jakarta.persistence.*; import java.io.Serializable; import java.time.LocalDate; import java.util.Set; @@ -45,11 +46,9 @@ public class StaffExportEntity implements Serializable private Boolean privateStaff; @Column(name = "START_DATE") - @Type(type = "java.time.LocalDate") private LocalDate startDate; @Column(name = "END_DATE") - @Type(type = "java.time.LocalDate") private LocalDate endDate; @ManyToOne diff --git a/src/main/java/uk/co/bconline/ndelius/model/entity/export/TeamExportEntity.java b/src/main/java/uk/co/bconline/ndelius/model/entity/export/TeamExportEntity.java index 80b978cd..22afb5f7 100644 --- a/src/main/java/uk/co/bconline/ndelius/model/entity/export/TeamExportEntity.java +++ b/src/main/java/uk/co/bconline/ndelius/model/entity/export/TeamExportEntity.java @@ -5,7 +5,7 @@ import lombok.NoArgsConstructor; import org.hibernate.annotations.Cache; -import javax.persistence.*; +import jakarta.persistence.*; import java.io.Serializable; import static org.hibernate.annotations.CacheConcurrencyStrategy.READ_ONLY; diff --git a/src/main/java/uk/co/bconline/ndelius/model/entity/export/UserExportEntity.java b/src/main/java/uk/co/bconline/ndelius/model/entity/export/UserExportEntity.java index ae88ab48..110356a8 100644 --- a/src/main/java/uk/co/bconline/ndelius/model/entity/export/UserExportEntity.java +++ b/src/main/java/uk/co/bconline/ndelius/model/entity/export/UserExportEntity.java @@ -1,9 +1,10 @@ package uk.co.bconline.ndelius.model.entity.export; import lombok.*; -import org.hibernate.annotations.Type; +import org.hibernate.type.YesNoConverter; +import jakarta.persistence.Convert; -import javax.persistence.*; +import jakarta.persistence.*; import java.io.Serializable; import java.time.LocalDate; import java.util.List; @@ -43,7 +44,6 @@ public class UserExportEntity implements Serializable private Boolean privateUser; @Column(name = "END_DATE") - @Type(type = "java.time.LocalDate") private LocalDate endDate; @ManyToOne diff --git a/src/main/java/uk/co/bconline/ndelius/service/UserService.java b/src/main/java/uk/co/bconline/ndelius/service/UserService.java index 036167ff..3d6b44cf 100644 --- a/src/main/java/uk/co/bconline/ndelius/service/UserService.java +++ b/src/main/java/uk/co/bconline/ndelius/service/UserService.java @@ -5,7 +5,7 @@ import uk.co.bconline.ndelius.model.SearchResult; import uk.co.bconline.ndelius.model.User; -import javax.validation.Valid; +import jakarta.validation.Valid; import java.io.OutputStream; import java.util.List; import java.util.Map; diff --git a/src/main/java/uk/co/bconline/ndelius/service/impl/RoleServiceImpl.java b/src/main/java/uk/co/bconline/ndelius/service/impl/RoleServiceImpl.java index f33de1a6..397fabd2 100644 --- a/src/main/java/uk/co/bconline/ndelius/service/impl/RoleServiceImpl.java +++ b/src/main/java/uk/co/bconline/ndelius/service/impl/RoleServiceImpl.java @@ -15,7 +15,7 @@ import uk.co.bconline.ndelius.repository.ldap.RoleRepository; import uk.co.bconline.ndelius.service.RoleService; -import javax.annotation.Resource; +import jakarta.annotation.Resource; import javax.naming.Name; import java.util.Optional; import java.util.Set; diff --git a/src/main/java/uk/co/bconline/ndelius/util/EncryptionUtils.java b/src/main/java/uk/co/bconline/ndelius/util/EncryptionUtils.java index e23a7e89..8d72d52e 100644 --- a/src/main/java/uk/co/bconline/ndelius/util/EncryptionUtils.java +++ b/src/main/java/uk/co/bconline/ndelius/util/EncryptionUtils.java @@ -25,7 +25,7 @@ public static String encrypt(String plainText, String secret) try { final Cipher cipher = cipherFromSecret(Cipher.ENCRYPT_MODE, secret); - return cipher != null ? new String(Base64.encodeBase64(cipher.doFinal(plainText.getBytes()))) : null; + return cipher != null ? new String(Base64.encodeBase64(cipher.doFinal(plainText.getBytes()), true)) : null; } catch (IllegalBlockSizeException | BadPaddingException ex) { @@ -38,7 +38,7 @@ public static String decrypt(String encrypted, String secret) try { final Cipher cipher = cipherFromSecret(Cipher.DECRYPT_MODE, secret); - return cipher != null ? new String(cipher.doFinal(Base64.decodeBase64(encrypted.getBytes()))) : null; + return cipher != null ? new String(cipher.doFinal(Base64.decodeBase64(Arrays.toString(encrypted.getBytes())))) : null; } catch (IllegalBlockSizeException | BadPaddingException ex) { diff --git a/src/main/java/uk/co/bconline/ndelius/util/LdapUtils.java b/src/main/java/uk/co/bconline/ndelius/util/LdapUtils.java index 39e47ac8..dda8b9d3 100644 --- a/src/main/java/uk/co/bconline/ndelius/util/LdapUtils.java +++ b/src/main/java/uk/co/bconline/ndelius/util/LdapUtils.java @@ -3,7 +3,7 @@ import lombok.experimental.UtilityClass; import lombok.extern.slf4j.Slf4j; import lombok.val; -import net.bytebuddy.utility.RandomString; +import org.apache.commons.lang3.RandomStringUtils; import org.springframework.security.crypto.password.LdapShaPasswordEncoder; import java.time.LocalDate; @@ -38,7 +38,7 @@ public static String fixPassword(String password) } public static String randomPassword() { - val password = RandomString.make(32); + val password = RandomStringUtils.random(32); if (log.isDebugEnabled()) log.debug("Generating randomized password: {}", password); return new LdapShaPasswordEncoder().encode(password); } diff --git a/src/main/java/uk/co/bconline/ndelius/validator/AssignableDatasets.java b/src/main/java/uk/co/bconline/ndelius/validator/AssignableDatasets.java index 183bea0a..d9d2585f 100644 --- a/src/main/java/uk/co/bconline/ndelius/validator/AssignableDatasets.java +++ b/src/main/java/uk/co/bconline/ndelius/validator/AssignableDatasets.java @@ -1,7 +1,7 @@ package uk.co.bconline.ndelius.validator; -import javax.validation.Constraint; -import javax.validation.Payload; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; import java.lang.annotation.Retention; import java.lang.annotation.Target; diff --git a/src/main/java/uk/co/bconline/ndelius/validator/AssignableDatasetsValidator.java b/src/main/java/uk/co/bconline/ndelius/validator/AssignableDatasetsValidator.java index 45ebfe2f..008c9523 100644 --- a/src/main/java/uk/co/bconline/ndelius/validator/AssignableDatasetsValidator.java +++ b/src/main/java/uk/co/bconline/ndelius/validator/AssignableDatasetsValidator.java @@ -10,8 +10,8 @@ import uk.co.bconline.ndelius.service.UserEntityService; import uk.co.bconline.ndelius.service.UserEntryService; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import java.util.Objects; import static java.util.Collections.emptyList; diff --git a/src/main/java/uk/co/bconline/ndelius/validator/AssignableGroups.java b/src/main/java/uk/co/bconline/ndelius/validator/AssignableGroups.java index 6c569a7f..4ccdca87 100644 --- a/src/main/java/uk/co/bconline/ndelius/validator/AssignableGroups.java +++ b/src/main/java/uk/co/bconline/ndelius/validator/AssignableGroups.java @@ -1,7 +1,7 @@ package uk.co.bconline.ndelius.validator; -import javax.validation.Constraint; -import javax.validation.Payload; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; import java.lang.annotation.Retention; import java.lang.annotation.Target; diff --git a/src/main/java/uk/co/bconline/ndelius/validator/AssignableGroupsValidator.java b/src/main/java/uk/co/bconline/ndelius/validator/AssignableGroupsValidator.java index a9d9eab3..80c06a6d 100644 --- a/src/main/java/uk/co/bconline/ndelius/validator/AssignableGroupsValidator.java +++ b/src/main/java/uk/co/bconline/ndelius/validator/AssignableGroupsValidator.java @@ -8,8 +8,8 @@ import uk.co.bconline.ndelius.service.UserEntryService; import uk.co.bconline.ndelius.transformer.GroupTransformer; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import java.util.List; import static java.util.Collections.emptyMap; diff --git a/src/main/java/uk/co/bconline/ndelius/validator/AssignableRoles.java b/src/main/java/uk/co/bconline/ndelius/validator/AssignableRoles.java index a7a29c4d..4137f588 100644 --- a/src/main/java/uk/co/bconline/ndelius/validator/AssignableRoles.java +++ b/src/main/java/uk/co/bconline/ndelius/validator/AssignableRoles.java @@ -6,8 +6,8 @@ import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.validation.Constraint; -import javax.validation.Payload; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; @Target(TYPE) @Retention(RUNTIME) diff --git a/src/main/java/uk/co/bconline/ndelius/validator/AssignableRolesValidator.java b/src/main/java/uk/co/bconline/ndelius/validator/AssignableRolesValidator.java index d96810d4..feacdeb9 100644 --- a/src/main/java/uk/co/bconline/ndelius/validator/AssignableRolesValidator.java +++ b/src/main/java/uk/co/bconline/ndelius/validator/AssignableRolesValidator.java @@ -9,8 +9,8 @@ import uk.co.bconline.ndelius.service.UserEntryService; import uk.co.bconline.ndelius.service.UserRoleService; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import static java.util.Collections.emptyList; import static java.util.Optional.ofNullable; diff --git a/src/main/java/uk/co/bconline/ndelius/validator/ConditionallyRequired.java b/src/main/java/uk/co/bconline/ndelius/validator/ConditionallyRequired.java index 5cdbea5c..a0f91ec9 100644 --- a/src/main/java/uk/co/bconline/ndelius/validator/ConditionallyRequired.java +++ b/src/main/java/uk/co/bconline/ndelius/validator/ConditionallyRequired.java @@ -7,8 +7,8 @@ import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.validation.Constraint; -import javax.validation.Payload; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; @Target(TYPE) @Retention(RUNTIME) diff --git a/src/main/java/uk/co/bconline/ndelius/validator/ConditionallyRequiredValidator.java b/src/main/java/uk/co/bconline/ndelius/validator/ConditionallyRequiredValidator.java index e8c4fd17..53582519 100644 --- a/src/main/java/uk/co/bconline/ndelius/validator/ConditionallyRequiredValidator.java +++ b/src/main/java/uk/co/bconline/ndelius/validator/ConditionallyRequiredValidator.java @@ -4,8 +4,8 @@ import org.springframework.beans.BeanWrapperImpl; import uk.co.bconline.ndelius.model.User; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import static org.springframework.util.ObjectUtils.isEmpty; import static uk.co.bconline.ndelius.util.NameUtils.camelCaseToTitleCase; diff --git a/src/main/java/uk/co/bconline/ndelius/validator/DateRange.java b/src/main/java/uk/co/bconline/ndelius/validator/DateRange.java index 0dc50139..e094ee4b 100644 --- a/src/main/java/uk/co/bconline/ndelius/validator/DateRange.java +++ b/src/main/java/uk/co/bconline/ndelius/validator/DateRange.java @@ -6,8 +6,8 @@ import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.validation.Constraint; -import javax.validation.Payload; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; @Target(FIELD) @Retention(RUNTIME) diff --git a/src/main/java/uk/co/bconline/ndelius/validator/DateRangeValidator.java b/src/main/java/uk/co/bconline/ndelius/validator/DateRangeValidator.java index 35a11c16..e6513456 100644 --- a/src/main/java/uk/co/bconline/ndelius/validator/DateRangeValidator.java +++ b/src/main/java/uk/co/bconline/ndelius/validator/DateRangeValidator.java @@ -2,8 +2,8 @@ import lombok.val; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import java.time.LocalDate; import java.time.format.DateTimeFormatter; diff --git a/src/main/java/uk/co/bconline/ndelius/validator/NewUsernameMustNotAlreadyExist.java b/src/main/java/uk/co/bconline/ndelius/validator/NewUsernameMustNotAlreadyExist.java index b0ee4018..63c554b6 100644 --- a/src/main/java/uk/co/bconline/ndelius/validator/NewUsernameMustNotAlreadyExist.java +++ b/src/main/java/uk/co/bconline/ndelius/validator/NewUsernameMustNotAlreadyExist.java @@ -1,7 +1,7 @@ package uk.co.bconline.ndelius.validator; -import javax.validation.Constraint; -import javax.validation.Payload; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; import java.lang.annotation.Retention; import java.lang.annotation.Target; diff --git a/src/main/java/uk/co/bconline/ndelius/validator/NewUsernameMustNotAlreadyExistValidator.java b/src/main/java/uk/co/bconline/ndelius/validator/NewUsernameMustNotAlreadyExistValidator.java index 4df775d1..b9988e32 100644 --- a/src/main/java/uk/co/bconline/ndelius/validator/NewUsernameMustNotAlreadyExistValidator.java +++ b/src/main/java/uk/co/bconline/ndelius/validator/NewUsernameMustNotAlreadyExistValidator.java @@ -4,10 +4,10 @@ import uk.co.bconline.ndelius.model.User; import uk.co.bconline.ndelius.service.UserService; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; -import javax.validation.constraintvalidation.SupportedValidationTarget; -import javax.validation.constraintvalidation.ValidationTarget; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; +import jakarta.validation.constraintvalidation.SupportedValidationTarget; +import jakarta.validation.constraintvalidation.ValidationTarget; @SupportedValidationTarget(ValidationTarget.PARAMETERS) public class NewUsernameMustNotAlreadyExistValidator implements ConstraintValidator diff --git a/src/main/java/uk/co/bconline/ndelius/validator/PrefixMatchesProviderCode.java b/src/main/java/uk/co/bconline/ndelius/validator/PrefixMatchesProviderCode.java index 4b0b03d2..7508cdfd 100644 --- a/src/main/java/uk/co/bconline/ndelius/validator/PrefixMatchesProviderCode.java +++ b/src/main/java/uk/co/bconline/ndelius/validator/PrefixMatchesProviderCode.java @@ -1,7 +1,7 @@ package uk.co.bconline.ndelius.validator; -import javax.validation.Constraint; -import javax.validation.Payload; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; import java.lang.annotation.Retention; import java.lang.annotation.Target; diff --git a/src/main/java/uk/co/bconline/ndelius/validator/PrefixMatchesProviderCodeValidator.java b/src/main/java/uk/co/bconline/ndelius/validator/PrefixMatchesProviderCodeValidator.java index 0b2b4464..11047905 100644 --- a/src/main/java/uk/co/bconline/ndelius/validator/PrefixMatchesProviderCodeValidator.java +++ b/src/main/java/uk/co/bconline/ndelius/validator/PrefixMatchesProviderCodeValidator.java @@ -4,8 +4,8 @@ import org.springframework.beans.factory.annotation.Autowired; import uk.co.bconline.ndelius.service.DatasetService; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import static org.springframework.util.StringUtils.hasLength; diff --git a/src/main/java/uk/co/bconline/ndelius/validator/RestrictNationalUsers.java b/src/main/java/uk/co/bconline/ndelius/validator/RestrictNationalUsers.java index 87d59a84..50482b2b 100644 --- a/src/main/java/uk/co/bconline/ndelius/validator/RestrictNationalUsers.java +++ b/src/main/java/uk/co/bconline/ndelius/validator/RestrictNationalUsers.java @@ -1,7 +1,7 @@ package uk.co.bconline.ndelius.validator; -import javax.validation.Constraint; -import javax.validation.Payload; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; import java.lang.annotation.Retention; import java.lang.annotation.Target; diff --git a/src/main/java/uk/co/bconline/ndelius/validator/RestrictNationalUsersValidator.java b/src/main/java/uk/co/bconline/ndelius/validator/RestrictNationalUsersValidator.java index 24f11fb8..32628e39 100644 --- a/src/main/java/uk/co/bconline/ndelius/validator/RestrictNationalUsersValidator.java +++ b/src/main/java/uk/co/bconline/ndelius/validator/RestrictNationalUsersValidator.java @@ -7,8 +7,8 @@ import uk.co.bconline.ndelius.model.User; import uk.co.bconline.ndelius.service.UserRoleService; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import static java.util.Optional.ofNullable; import static uk.co.bconline.ndelius.util.AuthUtils.isNational; diff --git a/src/main/java/uk/co/bconline/ndelius/validator/UsernameMustNotAlreadyExist.java b/src/main/java/uk/co/bconline/ndelius/validator/UsernameMustNotAlreadyExist.java index a9433764..e5afac85 100644 --- a/src/main/java/uk/co/bconline/ndelius/validator/UsernameMustNotAlreadyExist.java +++ b/src/main/java/uk/co/bconline/ndelius/validator/UsernameMustNotAlreadyExist.java @@ -1,7 +1,7 @@ package uk.co.bconline.ndelius.validator; -import javax.validation.Constraint; -import javax.validation.Payload; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; import java.lang.annotation.Retention; import java.lang.annotation.Target; diff --git a/src/main/java/uk/co/bconline/ndelius/validator/UsernameMustNotAlreadyExistValidator.java b/src/main/java/uk/co/bconline/ndelius/validator/UsernameMustNotAlreadyExistValidator.java index 959978dc..edd348af 100644 --- a/src/main/java/uk/co/bconline/ndelius/validator/UsernameMustNotAlreadyExistValidator.java +++ b/src/main/java/uk/co/bconline/ndelius/validator/UsernameMustNotAlreadyExistValidator.java @@ -4,10 +4,10 @@ import uk.co.bconline.ndelius.model.User; import uk.co.bconline.ndelius.service.UserService; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; -import javax.validation.constraintvalidation.SupportedValidationTarget; -import javax.validation.constraintvalidation.ValidationTarget; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; +import jakarta.validation.constraintvalidation.SupportedValidationTarget; +import jakarta.validation.constraintvalidation.ValidationTarget; @SupportedValidationTarget(ValidationTarget.PARAMETERS) public class UsernameMustNotAlreadyExistValidator implements ConstraintValidator diff --git a/src/main/java/uk/co/bconline/ndelius/validator/ValidDates.java b/src/main/java/uk/co/bconline/ndelius/validator/ValidDates.java index 6e81660a..e7601c50 100644 --- a/src/main/java/uk/co/bconline/ndelius/validator/ValidDates.java +++ b/src/main/java/uk/co/bconline/ndelius/validator/ValidDates.java @@ -6,8 +6,8 @@ import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.validation.Constraint; -import javax.validation.Payload; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; @Target(TYPE) @Retention(RUNTIME) diff --git a/src/main/java/uk/co/bconline/ndelius/validator/ValidDatesValidator.java b/src/main/java/uk/co/bconline/ndelius/validator/ValidDatesValidator.java index 62f2c5a2..982066f5 100644 --- a/src/main/java/uk/co/bconline/ndelius/validator/ValidDatesValidator.java +++ b/src/main/java/uk/co/bconline/ndelius/validator/ValidDatesValidator.java @@ -2,8 +2,8 @@ import java.time.LocalDate; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import uk.co.bconline.ndelius.model.User; diff --git a/src/test/java/uk/co/bconline/ndelius/model/UserValidationTest.java b/src/test/java/uk/co/bconline/ndelius/model/UserValidationTest.java index 1854b698..db932673 100644 --- a/src/test/java/uk/co/bconline/ndelius/model/UserValidationTest.java +++ b/src/test/java/uk/co/bconline/ndelius/model/UserValidationTest.java @@ -12,7 +12,7 @@ import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; import uk.co.bconline.ndelius.model.auth.UserInteraction; -import javax.validation.ConstraintViolation; +import jakarta.validation.ConstraintViolation; import java.time.LocalDate; import java.util.Set;