1

I'm trying to resolve my vault stored credentials via a Spring Vault Repository. Unfortunately Spring assumes the wrong version number of the vault kv store (v1 instead of v2). I conclude this from the urls the repository fetches:

This is my @Secret entity:

@Secret("garmin-connect-credentials")
data class GarminConnectCredentials(
    @Id val id: String?,
    val fullName: String?,
    val email: String?,
    val password: String?,
)

This is my repository

@Repository
interface CredentialsRepository :
CrudRepository<GarminConnectCredentials, String>

and my properties:

spring:
  cloud:
    vault:
      host: vault
      scheme: http
      authentication: TOKEN
      token: xxx-my-token-xxx
      kv:
        backend: secret

So when I try to resolve credentials via credentialsRepository.findById("sullrich"), the repository will fetch http://vault:8200/v1/secret/garmin-connect-credentials/sullrich to resolve the secret. This is wrong since the correct url should be http://vault:8200/v1/secret/data/garmin-connect-credentials/sullrich. The same goes for credentialsRepository.findAll() which fetches from http://vault:8200/v1/secret/garmin-connect-credentials/?list=true instead of http://vault:8200/v1/secret/metadata/garmin-connect-credentials?list=true

Any ideas on how to change this behaviour?

Sebastian Ullrich
  • 1,007
  • 11
  • 21

0 Answers0