From 194d562e401baa9b02dcb2e187e0c5303b03bc10 Mon Sep 17 00:00:00 2001 From: Cato Olsen Date: Mon, 21 Oct 2024 16:18:07 +0200 Subject: [PATCH] From Vault to SM for reactive-rest-example. --- examples/reactive-rest-example/README.md | 5 ++--- examples/reactive-rest-example/build.gradle | 3 --- examples/reactive-rest-example/settings.gradle | 1 - .../reactiverestexample/config/LocalVaultConfig.java | 12 ------------ .../src/main/resources/application-local.yml | 9 ++++++++- .../src/main/resources/bootstrap.yml | 4 ---- 6 files changed, 10 insertions(+), 24 deletions(-) delete mode 100644 examples/reactive-rest-example/src/main/java/no/nav/testnav/examples/reactiverestexample/config/LocalVaultConfig.java delete mode 100644 examples/reactive-rest-example/src/main/resources/bootstrap.yml diff --git a/examples/reactive-rest-example/README.md b/examples/reactive-rest-example/README.md index f4b8d8d2c1a..482f46b2696 100644 --- a/examples/reactive-rest-example/README.md +++ b/examples/reactive-rest-example/README.md @@ -8,8 +8,7 @@ Alle på teamet er ansvarlig for at vi sammen er enig om en standard. ## lokal kjøring -Start `ReactiveRestExampleApplicationStarter` med følgenede props: - +Start `ReactiveRestExampleApplicationStarter` med: ``` --Dspring.profiles.active=local -Dspring.cloud.vault.token=<> +-Dspring.profiles.active=local ``` diff --git a/examples/reactive-rest-example/build.gradle b/examples/reactive-rest-example/build.gradle index 4435bd50eb9..3024fe57d2f 100644 --- a/examples/reactive-rest-example/build.gradle +++ b/examples/reactive-rest-example/build.gradle @@ -12,15 +12,12 @@ sonarqube { dependencies { implementation "no.nav.testnav.libs:reactive-core" implementation "no.nav.testnav.libs:reactive-security" - implementation "no.nav.testnav.libs:vault" implementation "org.springframework.boot:spring-boot-starter-webflux" implementation "org.springframework.boot:spring-boot-starter-oauth2-resource-server" implementation "org.springframework.boot:spring-boot-starter-data-r2dbc" implementation "org.springframework.cloud:spring-cloud-starter-bootstrap" // TODO remove legacy bootstrap config - implementation "org.springframework.cloud:spring-cloud-starter-vault-config" - implementation "io.r2dbc:r2dbc-h2" implementation "org.postgresql:r2dbc-postgresql" diff --git a/examples/reactive-rest-example/settings.gradle b/examples/reactive-rest-example/settings.gradle index 7526f2828e8..4b0053dd8f8 100644 --- a/examples/reactive-rest-example/settings.gradle +++ b/examples/reactive-rest-example/settings.gradle @@ -8,7 +8,6 @@ includeBuild "../../plugins/java" includeBuild '../../libs/reactive-core' includeBuild '../../libs/reactive-security' -includeBuild '../../libs/vault' develocity { buildScan { diff --git a/examples/reactive-rest-example/src/main/java/no/nav/testnav/examples/reactiverestexample/config/LocalVaultConfig.java b/examples/reactive-rest-example/src/main/java/no/nav/testnav/examples/reactiverestexample/config/LocalVaultConfig.java deleted file mode 100644 index afcd86c9291..00000000000 --- a/examples/reactive-rest-example/src/main/java/no/nav/testnav/examples/reactiverestexample/config/LocalVaultConfig.java +++ /dev/null @@ -1,12 +0,0 @@ -package no.nav.testnav.examples.reactiverestexample.config; - -import no.nav.testnav.libs.vault.AbstractLocalVaultConfiguration; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Profile; -import org.springframework.vault.annotation.VaultPropertySource; - -@Configuration -@Profile("local") -@VaultPropertySource(value = "azuread/prod/creds/team-dolly-lokal-app", ignoreSecretNotFound = false) -public class LocalVaultConfig extends AbstractLocalVaultConfiguration { -} \ No newline at end of file diff --git a/examples/reactive-rest-example/src/main/resources/application-local.yml b/examples/reactive-rest-example/src/main/resources/application-local.yml index 94f1ea3900a..7ab2b8d9dd8 100644 --- a/examples/reactive-rest-example/src/main/resources/application-local.yml +++ b/examples/reactive-rest-example/src/main/resources/application-local.yml @@ -3,8 +3,15 @@ spring: application: # Override name name: reactive-rest-example-local + config: + import: "sm://" flyway: # InMemmory database url: jdbc:h2:mem:testdb username: sa - password: \ No newline at end of file + password: + security: + oauth2: + resourceserver: + aad: + accepted-audience: ${sm://azure-app-client-id}, api://${sm://azure-app-client-id} \ No newline at end of file diff --git a/examples/reactive-rest-example/src/main/resources/bootstrap.yml b/examples/reactive-rest-example/src/main/resources/bootstrap.yml deleted file mode 100644 index 0451449ca23..00000000000 --- a/examples/reactive-rest-example/src/main/resources/bootstrap.yml +++ /dev/null @@ -1,4 +0,0 @@ -spring: - cloud: - vault: - enabled: false \ No newline at end of file