diff --git a/src/main/kotlin/no/nav/syfo/api/auth/tokenX/TokenXUtil.kt b/src/main/kotlin/no/nav/syfo/api/auth/tokenX/TokenXUtil.kt index 9b733772..4588b6e1 100644 --- a/src/main/kotlin/no/nav/syfo/api/auth/tokenX/TokenXUtil.kt +++ b/src/main/kotlin/no/nav/syfo/api/auth/tokenX/TokenXUtil.kt @@ -1,6 +1,6 @@ package no.nav.syfo.api.auth.tokenX -import javax.ws.rs.ForbiddenException +import jakarta.ws.rs.ForbiddenException import no.nav.security.token.support.core.context.TokenValidationContextHolder import no.nav.security.token.support.core.jwt.JwtTokenClaims diff --git a/src/main/kotlin/no/nav/syfo/api/exception/ConflictException.kt b/src/main/kotlin/no/nav/syfo/api/exception/ConflictException.kt index ab538bdb..5f6edd2c 100644 --- a/src/main/kotlin/no/nav/syfo/api/exception/ConflictException.kt +++ b/src/main/kotlin/no/nav/syfo/api/exception/ConflictException.kt @@ -1,5 +1,5 @@ package no.nav.syfo.api.exception -import javax.ws.rs.WebApplicationException +import jakarta.ws.rs.WebApplicationException class ConflictException : WebApplicationException(409) diff --git a/src/main/kotlin/no/nav/syfo/api/exception/ControllerExceptionHandler.kt b/src/main/kotlin/no/nav/syfo/api/exception/ControllerExceptionHandler.kt index fc410dd6..991ca39f 100644 --- a/src/main/kotlin/no/nav/syfo/api/exception/ControllerExceptionHandler.kt +++ b/src/main/kotlin/no/nav/syfo/api/exception/ControllerExceptionHandler.kt @@ -1,5 +1,6 @@ package no.nav.syfo.api.exception +import jakarta.ws.rs.ForbiddenException import no.nav.security.token.support.spring.validation.interceptor.JwtTokenUnauthorizedException import no.nav.syfo.consumer.brukertilgang.RequestUnauthorizedException import no.nav.syfo.metric.Metric @@ -13,7 +14,6 @@ import org.springframework.web.context.request.WebRequest import org.springframework.web.util.WebUtils import javax.inject.Inject import javax.validation.ConstraintViolationException -import javax.ws.rs.ForbiddenException @ControllerAdvice class ControllerExceptionHandler @Inject constructor( diff --git a/src/main/kotlin/no/nav/syfo/config/ApplicationConfig.kt b/src/main/kotlin/no/nav/syfo/config/ApplicationConfig.kt index 0e3b8b25..094aa760 100644 --- a/src/main/kotlin/no/nav/syfo/config/ApplicationConfig.kt +++ b/src/main/kotlin/no/nav/syfo/config/ApplicationConfig.kt @@ -1,5 +1,6 @@ package no.nav.syfo.config +import org.springframework.boot.autoconfigure.AutoConfiguration import org.springframework.context.annotation.* import org.springframework.scheduling.TaskScheduler import org.springframework.scheduling.annotation.EnableScheduling @@ -8,7 +9,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement import org.springframework.web.client.RestTemplate import org.springframework.web.reactive.function.client.WebClient -@Configuration +@AutoConfiguration @EnableTransactionManagement @EnableScheduling class ApplicationConfig { diff --git a/src/main/kotlin/no/nav/syfo/consumer/azuread/NaisProxyCustomizer.kt b/src/main/kotlin/no/nav/syfo/consumer/azuread/NaisProxyCustomizer.kt index 11b8e3bc..6b40cb4b 100644 --- a/src/main/kotlin/no/nav/syfo/consumer/azuread/NaisProxyCustomizer.kt +++ b/src/main/kotlin/no/nav/syfo/consumer/azuread/NaisProxyCustomizer.kt @@ -1,10 +1,11 @@ package no.nav.syfo.consumer.azuread -import org.apache.http.* -import org.apache.http.client.HttpClient -import org.apache.http.impl.client.HttpClientBuilder -import org.apache.http.impl.conn.DefaultProxyRoutePlanner -import org.apache.http.protocol.HttpContext +import org.apache.hc.client5.http.classic.HttpClient +import org.apache.hc.client5.http.impl.classic.HttpClientBuilder +import org.apache.hc.client5.http.impl.routing.DefaultProxyRoutePlanner +import org.apache.hc.core5.http.HttpException +import org.apache.hc.core5.http.HttpHost +import org.apache.hc.core5.http.protocol.HttpContext import org.springframework.boot.web.client.RestTemplateCustomizer import org.springframework.http.client.HttpComponentsClientHttpRequestFactory import org.springframework.web.client.RestTemplate @@ -18,11 +19,10 @@ class NaisProxyCustomizer : RestTemplateCustomizer { @Throws(HttpException::class) public override fun determineProxy( target: HttpHost, - request: HttpRequest, context: HttpContext ): HttpHost? { return if (target.hostName.contains("microsoft")) { - super.determineProxy(target, request, context) + super.determineProxy(target, context) } else null } } diff --git a/src/main/kotlin/no/nav/syfo/consumer/brukertilgang/BrukertilgangConsumer.kt b/src/main/kotlin/no/nav/syfo/consumer/brukertilgang/BrukertilgangConsumer.kt index 682c1374..c08a3114 100644 --- a/src/main/kotlin/no/nav/syfo/consumer/brukertilgang/BrukertilgangConsumer.kt +++ b/src/main/kotlin/no/nav/syfo/consumer/brukertilgang/BrukertilgangConsumer.kt @@ -12,7 +12,7 @@ import no.nav.syfo.util.createCallId import org.slf4j.LoggerFactory import org.springframework.beans.factory.annotation.Value import org.springframework.http.HttpHeaders -import org.springframework.http.HttpStatus +import org.springframework.http.HttpStatusCode import org.springframework.http.MediaType import org.springframework.stereotype.Service import org.springframework.web.reactive.function.client.ClientResponse @@ -41,15 +41,15 @@ class BrukertilgangConsumer( .header(NAV_CONSUMER_ID_HEADER, APP_CONSUMER_ID) .accept(MediaType.APPLICATION_JSON) .retrieve() - .onStatus({ obj: HttpStatus -> obj.value() == 401 }) { response -> + .onStatus({ obj: HttpStatusCode -> obj.value() == 401 }) { response -> metric.countOutgoingReponses(METRIC_CALL_BRUKERTILGANG, response.rawStatusCode()) Mono.error(RequestUnauthorizedException("Unauthorized request to get access to Ansatt from Syfobrukertilgang")) } - .onStatus({ obj: HttpStatus -> obj.is4xxClientError }) { response -> + .onStatus({ obj: HttpStatusCode -> obj.is4xxClientError }) { response -> logError(response, callId) Mono.error(RuntimeException("4xx")) } - .onStatus({ obj: HttpStatus -> obj.is5xxServerError }) { response -> + .onStatus({ obj: HttpStatusCode -> obj.is5xxServerError }) { response -> logError(response, callId) Mono.error(RuntimeException("5xx")) } diff --git a/src/main/kotlin/no/nav/syfo/consumer/brukertilgang/BrukertilgangService.kt b/src/main/kotlin/no/nav/syfo/consumer/brukertilgang/BrukertilgangService.kt index 1582bcdd..01946637 100644 --- a/src/main/kotlin/no/nav/syfo/consumer/brukertilgang/BrukertilgangService.kt +++ b/src/main/kotlin/no/nav/syfo/consumer/brukertilgang/BrukertilgangService.kt @@ -1,12 +1,12 @@ package no.nav.syfo.consumer.brukertilgang +import jakarta.ws.rs.ForbiddenException import no.nav.security.token.support.core.context.TokenValidationContextHolder import no.nav.syfo.api.auth.tokenX.TokenXUtil import no.nav.syfo.cache.CacheConfig import org.springframework.cache.annotation.Cacheable import org.springframework.stereotype.Service import javax.inject.Inject -import javax.ws.rs.ForbiddenException @Service class BrukertilgangService @Inject constructor( diff --git a/src/main/kotlin/no/nav/syfo/consumer/sts/StsConsumer.kt b/src/main/kotlin/no/nav/syfo/consumer/sts/StsConsumer.kt index 253c805e..07860fcc 100644 --- a/src/main/kotlin/no/nav/syfo/consumer/sts/StsConsumer.kt +++ b/src/main/kotlin/no/nav/syfo/consumer/sts/StsConsumer.kt @@ -33,11 +33,11 @@ class StsConsumer( .uri(getStsTokenUrl()) .accept(MediaType.APPLICATION_JSON) .retrieve() - .onStatus({ obj: HttpStatus -> obj.is4xxClientError }) { response -> + .onStatus({ obj: HttpStatusCode -> obj.is4xxClientError }) { response -> logError(response) Mono.error(RuntimeException("4xx")) } - .onStatus({ obj: HttpStatus -> obj.is5xxServerError }) { response -> + .onStatus({ obj: HttpStatusCode -> obj.is5xxServerError }) { response -> logError(response) Mono.error(RuntimeException("5xx")) } diff --git a/src/main/kotlin/no/nav/syfo/motebehov/api/internad/v2/MotebehovVeilederADControllerV2.kt b/src/main/kotlin/no/nav/syfo/motebehov/api/internad/v2/MotebehovVeilederADControllerV2.kt index cd939f3a..005852a5 100644 --- a/src/main/kotlin/no/nav/syfo/motebehov/api/internad/v2/MotebehovVeilederADControllerV2.kt +++ b/src/main/kotlin/no/nav/syfo/motebehov/api/internad/v2/MotebehovVeilederADControllerV2.kt @@ -1,5 +1,8 @@ package no.nav.syfo.motebehov.api.internad.v2 +import jakarta.ws.rs.BadRequestException +import jakarta.ws.rs.ForbiddenException +import jakarta.ws.rs.NotFoundException import no.nav.security.token.support.core.api.ProtectedWithClaims import no.nav.security.token.support.core.context.TokenValidationContextHolder import no.nav.syfo.api.auth.OIDCIssuer.INTERN_AZUREAD_V2 @@ -21,9 +24,6 @@ import org.springframework.web.bind.annotation.* import javax.inject.Inject import javax.validation.Valid import javax.validation.constraints.Pattern -import javax.ws.rs.BadRequestException -import javax.ws.rs.ForbiddenException -import javax.ws.rs.NotFoundException @RestController @ProtectedWithClaims(issuer = INTERN_AZUREAD_V2) diff --git a/src/test/kotlin/no/nav/syfo/LocalApplicationConfig.kt b/src/test/kotlin/no/nav/syfo/LocalApplicationConfig.kt index 27480668..97c4ad0f 100644 --- a/src/test/kotlin/no/nav/syfo/LocalApplicationConfig.kt +++ b/src/test/kotlin/no/nav/syfo/LocalApplicationConfig.kt @@ -7,15 +7,15 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule import no.nav.security.token.support.test.spring.TokenGeneratorConfiguration import no.nav.syfo.config.kafka.FunctionSerializer import org.apache.kafka.common.serialization.StringSerializer +import org.springframework.boot.autoconfigure.AutoConfiguration import org.springframework.boot.autoconfigure.kafka.KafkaProperties import org.springframework.context.annotation.Bean -import org.springframework.context.annotation.Configuration import org.springframework.context.annotation.Import import org.springframework.kafka.core.DefaultKafkaProducerFactory import org.springframework.kafka.core.KafkaTemplate import org.springframework.kafka.core.ProducerFactory -@Configuration +@AutoConfiguration @Import(TokenGeneratorConfiguration::class) class LocalApplicationConfig { @Bean diff --git a/src/test/kotlin/no/nav/syfo/motebehov/api/internad/v2/MotebehovVeilederADTilgangV2Test.kt b/src/test/kotlin/no/nav/syfo/motebehov/api/internad/v2/MotebehovVeilederADTilgangV2Test.kt index b0c810c5..880ca260 100644 --- a/src/test/kotlin/no/nav/syfo/motebehov/api/internad/v2/MotebehovVeilederADTilgangV2Test.kt +++ b/src/test/kotlin/no/nav/syfo/motebehov/api/internad/v2/MotebehovVeilederADTilgangV2Test.kt @@ -1,5 +1,6 @@ package no.nav.syfo.motebehov.api.internad.v2 +import jakarta.ws.rs.ForbiddenException import no.nav.security.token.support.core.context.TokenValidationContextHolder import no.nav.syfo.LocalApplication import no.nav.syfo.testhelper.OidcTestHelper.loggInnVeilederADV2 @@ -19,7 +20,6 @@ import org.springframework.test.web.client.MockRestServiceServer import org.springframework.web.client.* import java.text.ParseException import javax.inject.Inject -import javax.ws.rs.ForbiddenException @ExtendWith(SpringExtension::class) @SpringBootTest(classes = [LocalApplication::class]) diff --git a/src/test/resources/logback-test.xml b/src/test/resources/logback-test.xml deleted file mode 100644 index a7cd0294..00000000 --- a/src/test/resources/logback-test.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - [%t, %d, %-5p, %C:%L] - %.-100000m%n - - - - - - - - - - - - \ No newline at end of file