4

I have zuul proxy which uses the property to validate tokens as a resource server

security.oauth2.resource.jwt.key-value

I have public key as part of the key value, however my application is dynamically fetching the public key from a vault. I am looking for a way to dynamically update this value in application.yml or application.properties file at runtime. If i understand correctly updating the property value should not reload the application.

How do i do this dynamically, below is my attempt to update the proprety.

Properties properties = new Properties();
properties.put("security.oauth2.resource.jwt.key-value", publicKey);
application.setDefaultProperties(properties);        
application.run(args);
Sudheej
  • 1,873
  • 6
  • 30
  • 57

1 Answers1

-1

If you use the "Spring Cloud Vault" project, you configure a bootstrap.yml config under your resources folder, this will have your spring.cloud.vault: settings like host, port, token etc. Spring Cloud vault will the bootstrap first and you will be able to use any of the properties from vault in your properties files or your code. e.g. security.oauth2.resource.jwt.key-value=${my-vault-property}