Skip to content

Commit 083a26a

Browse files
Merge pull request #76 from navikt/dev
[PROD][KAIZEN-0] release
2 parents fbd59f7 + 95c3a54 commit 083a26a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+2101
-1415
lines changed

.editorconfig

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1-
[*.kt]
2-
ktlint_disabled_rules=no-wildcard-imports,filename
3-
ij_kotlin_allow_trailing_comma=true
1+
[/src/**.kt]
2+
ktlint_standard_no-wildcard-imports = disabled
3+
ktlint_standard_filename=disabled
4+
ij_kotlin_allow_trailing_comma=true
5+
6+
[/build/**.kt]
7+
ktlint_standard=disabled
8+
9+
[*.kts]
10+
ktlint_standard_property-naming=disabled

.github/workflows/main.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ jobs:
1313
if: github.ref != 'refs/heads/dev' && github.ref != 'refs/heads/master'
1414
steps:
1515
- uses: actions/checkout@v3
16-
- name: Set up JDK 11
16+
- name: Set up JDK 17
1717
uses: actions/setup-java@v3
1818
with:
1919
distribution: 'temurin'
20-
java-version: 11
20+
java-version: 17
2121
cache: 'gradle'
2222
- name: Install ktlint
2323
uses: nbadal/action-ktlint-setup@v1
2424
with:
25-
ktlint_version: '0.47.1'
25+
ktlint_version: '1.0.0'
2626
- name: Ktlint
2727
run: ktlint src/**/*.kt
2828
shell: bash
@@ -33,13 +33,15 @@ jobs:
3333
name: Build and push Docker container
3434
if: github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/master'
3535
runs-on: ubuntu-latest
36+
permissions:
37+
packages: write
3638
steps:
3739
- uses: actions/checkout@v3
38-
- name: Set up JDK 11
40+
- name: Set up JDK 17
3941
uses: actions/setup-java@v3
4042
with:
4143
distribution: 'temurin'
42-
java-version: 11
44+
java-version: 17
4345
cache: 'gradle'
4446
continue-on-error: true
4547
- name: Build

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM navikt/java:11-appdynamics
1+
FROM navikt/java:17-appdynamics
22
ENV APPD_ENABLED=true
33

44
COPY java-debug.sh /init-scripts/08-java-debug.sh

build.gradle.kts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@ val graphql_kotlin_version: String by project
2020

2121
plugins {
2222
application
23-
kotlin("jvm") version "1.7.0"
24-
id("org.jetbrains.kotlin.plugin.serialization") version "1.7.0"
23+
kotlin("jvm") version "1.8.0"
24+
id("org.jetbrains.kotlin.plugin.serialization") version "1.8.0"
2525
id("com.github.johnrengelman.shadow") version "7.1.2"
26-
id("com.expediagroup.graphql") version "5.5.0"
26+
id("com.expediagroup.graphql") version "6.4.0"
2727
}
2828

2929
group = "no.nav"
3030
version = "0.0.1"
31+
3132
application {
3233
mainClass.set("no.nav.ApplicationKt")
3334

@@ -57,24 +58,21 @@ repositories {
5758
}
5859

5960
dependencies {
61+
implementation("io.ktor:ktor-server:$ktor_version")
6062
implementation("io.ktor:ktor-server-core:$ktor_version")
61-
implementation("io.ktor:ktor-auth:$ktor_version")
62-
implementation("io.ktor:ktor-auth-jwt:$ktor_version")
63-
implementation("io.ktor:ktor-metrics-micrometer:$ktor_version")
63+
implementation("io.ktor:ktor-server-auth:$ktor_version")
64+
implementation("io.ktor:ktor-server-auth-jwt:$ktor_version")
6465
implementation("io.ktor:ktor-serialization:$ktor_version")
6566
implementation("io.ktor:ktor-server-netty:$ktor_version")
6667
implementation("io.ktor:ktor-client-core:$ktor_version")
6768
implementation("io.ktor:ktor-client-okhttp:$ktor_version")
68-
implementation("io.ktor:ktor-client-serialization:$ktor_version")
69+
implementation("io.ktor:ktor-serialization-kotlinx-json:$ktor_version")
6970
implementation("org.jetbrains.kotlinx:kotlinx-datetime:$kotlinx_datetime_version")
7071
implementation("io.bkbn:kompendium-core:$kompendium_version")
71-
implementation("io.bkbn:kompendium-auth:$kompendium_version")
72-
implementation("io.bkbn:kompendium-swagger-ui:$kompendium_version")
73-
implementation("org.webjars:webjars-locator-core:0.50")
7472
implementation("no.nav.tjenestespesifikasjoner:person-v3-tjenestespesifikasjon:$tjenestespec_version")
7573
implementation("no.nav.tjenestespesifikasjoner:utbetaling-tjenestespesifikasjon:$tjenestespec_version")
76-
implementation("no.nav.personoversikt:kotlin-utils:$modia_common_utils_version")
77-
74+
implementation("com.github.navikt.modia-common-utils:kotlin-utils:$modia_common_utils_version")
75+
implementation("com.github.navikt.modia-common-utils:ktor-utils:$modia_common_utils_version")
7876
implementation("no.nav.common:token-client:$nav_common_version")
7977
implementation("no.nav.common:cxf:$nav_common_version")
8078
implementation("no.nav.common:client:$nav_common_version")
@@ -85,18 +83,20 @@ dependencies {
8583
implementation("ch.qos.logback:logback-classic:$logback_version")
8684
implementation("net.logstash.logback:logstash-logback-encoder:$logstash_version")
8785
implementation("com.expediagroup:graphql-kotlin-ktor-client:$graphql_kotlin_version")
88-
86+
implementation("io.ktor:ktor-client-okhttp-jvm:2.3.0")
87+
implementation("io.ktor:ktor-server-core-jvm:2.3.0")
88+
implementation("io.ktor:ktor-server-swagger-jvm:2.3.0")
8989

9090
testImplementation("io.mockk:mockk:1.12.4")
91-
testImplementation("io.ktor:ktor-server-tests:$ktor_version")
91+
testImplementation("io.ktor:ktor-server-tests:2.3.0")
9292
testImplementation("io.ktor:ktor-client-mock:$ktor_version")
9393
testImplementation("org.junit.jupiter:junit-jupiter:$junit_version")
9494
}
9595

9696
tasks.withType<Test> {
9797
useJUnitPlatform()
9898

99-
testLogging { // This is for logging and can be removed.
99+
testLogging { // This is for logging and can be removed.
100100
events("passed", "skipped", "failed")
101101
}
102102
}
@@ -137,22 +137,22 @@ val generatePDLClient by tasks.creating(GraphQLGenerateClientTask::class) {
137137
GraphQLScalar(
138138
"Long",
139139
"no.nav.api.pdl.converters.PdlLong",
140-
"no.nav.api.pdl.converters.LongScalarConverter"
141-
)
140+
"no.nav.api.pdl.converters.LongScalarConverter",
141+
),
142142
)
143143
customScalars.add(
144144
GraphQLScalar(
145145
"Date",
146146
"kotlinx.datetime.LocalDate",
147-
"no.nav.api.pdl.converters.DateScalarConverter"
148-
)
147+
"no.nav.api.pdl.converters.DateScalarConverter",
148+
),
149149
)
150150
customScalars.add(
151151
GraphQLScalar(
152152
"DateTime",
153153
"kotlinx.datetime.LocalDateTime",
154-
"no.nav.api.pdl.converters.DateTimeScalarConverter"
155-
)
154+
"no.nav.api.pdl.converters.DateTimeScalarConverter",
155+
),
156156
)
157157
dependsOn("downloadPDLSchema")
158-
}
158+
}

gradle.properties

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
ktor_version=1.6.8
1+
ktor_version=2.3.0
22
kotlin_version=1.7.0
33
kotlinx_datetime_version=0.4.0
4-
kompendium_version=2.3.5
4+
kompendium_version=3.14.4
55
logback_version=1.2.11
66
logstash_version=7.2
77
kotlin.code.style=official
88
prometeus_version=1.6.3
9-
nav_common_version=2.2022.06.20_04.34-44e077dc9a78
9+
nav_common_version=2.2023.01.10_13.49-81ddc732df3a
1010
tjenestespec_version=1.2020.06.16-14.51-3b45df54f90a
11-
modia_common_utils_version=1.2022.08.01-11.26-97308e41bb8d
11+
modia_common_utils_version=1.2023.07.20-13.43-64707e48b53b
1212
junit_version=5.8.2
13-
graphql_kotlin_version=5.5.0
13+
graphql_kotlin_version=6.4.0

src/main/kotlin/no/nav/Application.kt

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
package no.nav
22

3-
import io.bkbn.kompendium.auth.Notarized.notarizedAuthenticate
4-
import io.ktor.routing.*
3+
import io.ktor.server.auth.*
54
import io.ktor.server.engine.*
65
import io.ktor.server.netty.*
6+
import io.ktor.server.routing.*
77
import no.nav.api.debug.configureDebugRoutes
88
import no.nav.api.dialog.configureDialogRoutes
9+
import no.nav.api.dialog.configureDialogRoutesV2
910
import no.nav.api.digdir.configureDigdirRoutes
11+
import no.nav.api.digdir.configureDigdirRoutesV2
1012
import no.nav.api.oppfolging.configureOppfolgingRoutes
13+
import no.nav.api.oppfolging.configureOppfolgingRoutesV2
1114
import no.nav.api.pdl.configurePdlRoutes
15+
import no.nav.api.pdl.configurePdlRoutesV2
1216
import no.nav.api.skrivestotte.configureSkrivestotteRoutes
1317
import no.nav.api.tps.configureTpsRoutes
18+
import no.nav.api.tps.configureTpsRoutesV2
1419
import no.nav.api.utbetalinger.configureUtbetalingerRoutes
20+
import no.nav.api.utbetalinger.configureUtbetalingerRoutesV2
1521
import no.nav.plugins.*
1622

1723
fun startApplication(
@@ -29,16 +35,22 @@ fun startApplication(
2935
configureExceptionHandling()
3036

3137
routing {
32-
notarizedAuthenticate(securityScheme) {
38+
authenticate(SECURITY_SCHEME_NAME) {
3339
route("api") {
3440
configureDebugRoutes(consumers.tokenclient)
3541
configureOppfolgingRoutes(services.oppfolgingService)
42+
configureOppfolgingRoutesV2(services.oppfolgingService)
3643
configurePdlRoutes(services.pdlService)
44+
configurePdlRoutesV2(services.pdlService)
3745
configureTpsRoutes(services.tpsService)
46+
configureTpsRoutesV2(services.tpsService)
3847
configureDialogRoutes(services.dialogService)
48+
configureDialogRoutesV2(services.dialogService)
3949
configureDigdirRoutes(services.digdirService)
50+
configureDigdirRoutesV2(services.digdirService)
4051
configureSkrivestotteRoutes(services.skrivestotteService)
4152
configureUtbetalingerRoutes(services.utbetalingerService)
53+
configureUtbetalingerRoutesV2(services.utbetalingerService)
4254
}
4355
}
4456
}

src/main/kotlin/no/nav/Consumers.kt

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -34,33 +34,39 @@ interface Consumers {
3434

3535
class ConsumersImpl(env: Env) : Consumers {
3636
private val modiaUser = NaisUtils.getCredentials("service_user")
37-
private val stsConfig: StsConfig = StsConfig
38-
.builder()
39-
.url(env.soapStsUrl)
40-
.username(modiaUser.username)
41-
.password(modiaUser.password)
42-
.build()
37+
private val stsConfig: StsConfig =
38+
StsConfig
39+
.builder()
40+
.url(env.soapStsUrl)
41+
.username(modiaUser.username)
42+
.password(modiaUser.password)
43+
.build()
4344

44-
override val oboTokenClient: OnBehalfOfTokenClient = AzureAdTokenClientBuilder
45-
.builder()
46-
.withNaisDefaults()
47-
.buildOnBehalfOfTokenClient()
45+
override val oboTokenClient: OnBehalfOfTokenClient =
46+
AzureAdTokenClientBuilder
47+
.builder()
48+
.withNaisDefaults()
49+
.buildOnBehalfOfTokenClient()
4850

49-
override val tokenclient: MachineToMachineTokenClient = AzureAdTokenClientBuilder
50-
.builder()
51-
.withNaisDefaults()
52-
.buildMachineToMachineTokenClient()
51+
override val tokenclient: MachineToMachineTokenClient =
52+
AzureAdTokenClientBuilder
53+
.builder()
54+
.withNaisDefaults()
55+
.buildMachineToMachineTokenClient()
5356

5457
override val oppfolgingClient: OppfolgingClient = OppfolgingClient(env.oppfolgingUrl, oboTokenClient.bindTo(env.oppfolgingScope))
55-
override val tps: PersonV3 = CXFClient<PersonV3>()
56-
.address(env.tpsPersonV3Url)
57-
.configureStsForSystemUser(stsConfig)
58-
.build()
58+
override val tps: PersonV3 =
59+
CXFClient<PersonV3>()
60+
.address(env.tpsPersonV3Url)
61+
.configureStsForSystemUser(stsConfig)
62+
.build()
5963
override val nom: NomClient = Nom(env.nomUrl, tokenclient.bindTo(env.nomScope)).client
6064
override val skrivestotteClient: SkrivestotteClient = SkrivestotteClient(env.skrivestotteUrl)
6165
override val pdlClient: PdlClient = PdlClient(env.pdlUrl, oboTokenClient.bindTo(env.pdlScope))
6266
override val safClient: SafClient = SafClient(env.safUrl, oboTokenClient.bindTo(env.safScope))
63-
override val digdirClient: DigdirClient = DigdirClient(env.digdirUrl, tokenclient.bindTo(env.digdirScope), oboTokenClient.bindTo(env.digdirScope))
64-
override val utbetalingerClient: UtbetalingerClient = UtbetalingerClient(env.utbetalingSokosUrl, oboTokenClient.bindTo(env.utbetalingSokosScope))
67+
override val digdirClient: DigdirClient =
68+
DigdirClient(env.digdirUrl, tokenclient.bindTo(env.digdirScope), oboTokenClient.bindTo(env.digdirScope))
69+
override val utbetalingerClient: UtbetalingerClient =
70+
UtbetalingerClient(env.utbetalingSokosUrl, oboTokenClient.bindTo(env.utbetalingSokosScope))
6571
override val sfClient: SFClient = SFClient(env.sfUrl, oboTokenClient.bindTo(env.sfScope))
6672
}

src/main/kotlin/no/nav/Env.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
package no.nav
22

3-
import no.nav.personoversikt.utils.EnvUtils.getRequiredConfig
3+
import no.nav.personoversikt.common.utils.EnvUtils.getRequiredConfig
44
import no.nav.utils.DownstreamApi
55
import no.nav.utils.parse
66

77
interface Env {
88
companion object {
99
operator fun invoke(): Env = EnvImpl()
1010
}
11+
1112
val soapStsUrl: String
1213
val jwksUrl: String
1314
val tpsPersonV3Url: String

src/main/kotlin/no/nav/Services.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ interface Services {
2121
val dialogService: DialogService
2222
val utbetalingerService: UtbetalingerService
2323
}
24+
2425
class ServicesImpl(consumers: Consumers) : Services {
25-
override val oppfolgingService = OppfolgingService(
26-
consumers.oppfolgingClient,
27-
consumers.nom
28-
)
26+
override val oppfolgingService =
27+
OppfolgingService(
28+
consumers.oppfolgingClient,
29+
consumers.nom,
30+
)
2931
override val tpsService = TpsService(consumers.tps)
3032
override val skrivestotteService = SkrivestotteService(consumers.skrivestotteClient)
3133
override val digdirService = DigdirService(consumers.digdirClient)

src/main/kotlin/no/nav/Vault.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,9 @@ object Vault {
1717
}
1818

1919
fun readVaultfile(file: Path): String = file.readText()
20-
fun fromVaultfile(file: Path, block: (String) -> Unit) = block(readVaultfile(file))
20+
21+
fun fromVaultfile(
22+
file: Path,
23+
block: (String) -> Unit,
24+
) = block(readVaultfile(file))
2125
}

0 commit comments

Comments
 (0)