Hashicorp Vault password access using Spring boot vault

221 Views Asked by At

In my application we are making two calls from my app for getting secrets from Vault, as shown below:

Test in Postman

Login to Vault : POST call to https::/v1/auth/approle/login -- It will take role_id and secret_id as payload and response will be client_token.

Fetch secrets : GET call to https::v1//utlfddfgddbs159.as.dev.net/static-creds/abc01view_appuser -- It will take headers as X-Vault-Token

{ "request_id": "....", "lease_id": "", "renewable": false, "lease_duration": 0, "data": { "last_vault_rotation": "....", "password": "BCNWXUK_z8fwdAchbPx5RTfHAasd32223", "rotation_period": 15552000, "ttl": 14949149, "username": "appuser" }, "wrap_info": null, "warnings": null, "auth": null }

Now I am use Spring Cloud Vault Dependency to integrate in my application.

Pls suggest if I am missing anything configuration

Dependency Used

<dependency>
  <groupId>org.springframework.cloud</groupId>
   <artifactId>spring-cloud-starter-vault-config</artifactId>
</dependency>

File: bootsrap.yml
cloud:
    vault:      
      enabled: true
      host: <host>
      port: 8200
      scheme: https
      namespace: ..
      order: 1
      kv-version: 1
      authentication: APPROLE      
      app-role:
        role-id: .....
        secret-id: .....    
        role: .....

I am unable to get password using spring-cloud-starter-vault-config but when I am executing using postman, able to get password from Hashicrop vault

1

There are 1 best solutions below

0
Rajesh Sharma On

Create customised jar using Environmentpostprocessor to get data from property file and called hashicrop vault to get respective details