[BAEL-6694] Secure Kubernetes Secrets with Vault (#14762)

* [BAEL-4849] Article code

* [BAEL-4968] Article code

* [BAEL-4968] Article code

* [BAEL-4968] Article code

* [BAEL-4968] Remove extra comments

* [BAEL-5258] Article Code

* [BAEL-2765] PKCE Support for Secret Clients

* [BAEL-5698] Article code

* [BAEL-5698] Article code

* [BAEL-5905] Initial code

* [BAEL-5905] Article code

* [BAEL-5905] Relocate article code to new module

* [BAEL-6275] PostgreSQL NOTIFY/LISTEN

* [BAEL-6275] Minor correction

* BAEL-6138

* [BAEL-6138] WIP - LiveTest

* [BAEL-6138] Tutorial Code

* [BAEL-6138] Tutorial Code

* [BAEL-6694] Article Code

---------

Co-authored-by: Philippe Sevestre <psevestre@gmail.com>
This commit is contained in:
psevestre
2023-09-14 18:31:24 -03:00
committed by GitHub
parent 8c400720c0
commit 12ba505cb4
10 changed files with 308 additions and 1 deletions
@@ -0,0 +1,26 @@
package com.baeldung.springcloudvault;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.core.env.Environment;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@ActiveProfiles("vault")
@SpringBootTest(classes = SpringCloudVaultTestApplication.class)
public class SpringCloudVaultApplicationLiveTest {
@Autowired
Environment env;
@Test
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
assertNotNull(env.getProperty("foo"));
}
}
@@ -0,0 +1,15 @@
# Vault Properties
spring.config.import: vault://
spring.cloud.vault.uri=http://localhost:8200
spring.cloud.vault.authentication=KUBERNETES
spring.cloud.vault.kubernetes.role=baeldung-test-role
#
spring.cloud.vault.kv.backend=secrets
spring.cloud.vault.kv.application-name=baeldung-test
#
# NOTICE: the following property is only necessary when running the application
# outside Kubernetes
# Please refer to the article for instructions on how to create this file
spring.cloud.vault.kubernetes.service-account-token-file=sa-token.txt