'Best way to connect spring boot application to VAULT using LDAP authentication method

I am trying to connect my Java application to Enterprise Vault using LDAP authentication method.

spring won't provide a direct way to connect with like it provide for TOKEN

spring.cloud.vault.uri=https:8080/vault/uri
spring.cloud.vault.namespace=admin
spring.cloud.vault.authentication=TOKEN
spring.cloud.vault.token=some-token

and APPROLE

spring.cloud.vault.uri=https:8080/vault/uri
spring.cloud.vault.namespace=admin
spring.cloud.vault.authentication=APPROLE
spring.cloud.vault.app-role.role-id=
spring.cloud.vault.app-role.secret-id=
spring.cloud.vault.app-role.role=
spring.cloud.vault.app-role.app-role-path=

Can somebody help me to connect with Enterprise Vault using LDAP method



Solution 1:[1]

Hi @Pramendra Raghuwanshi, Hope this helps. https://www.vaultproject.io/docs/auth/ldap As per this link, there are 2 options

  1. Use Vault CLI to authenticate using a LDAP account and set the environment variable VAULT_TOKEN
  2. Use the API, to do LDAP authentication and get the token and then set the environment variable VAULT_TOKEN

So, if you use VAULT_TOKEN variable in your Spring boot config, it should work. The authentication and setting the VAULT_TOKEN shall be a pre-requisite task before staring the Spring boot app. Something which can be automated as part of your app start up process?

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Vipin Reyroth