spring-cloud / spring-cloud-vault

Configuration Integration with HashiCorp Vault
http://cloud.spring.io/spring-cloud-vault/
Apache License 2.0
272 stars 151 forks source link

Azure MSI authentication to support reactive infra #613

Closed nks0203 closed 2 years ago

nks0203 commented 2 years ago

Is your feature request related to a problem? Please describe.

I am trying to use Azure MSI auth with spring webflux project . It gives me the following error :

Cannot construct vaultTokenSupplier from org.springframework.vault.authentication.AzureMsiAuthentication : ClientAuthentication must implement AuthenticationStepsFactory or be TokenAuthentication

Describe the solution you'd like

The other counterpart - Aws , Approle authentication classes implements AuthenticationStepsFactory but not AzureMsi Authentication.

Due to this it throws the above exception in VaultReactiveConfiguration.createVaultTokenSupplier() method.

If we can have AuthenticationStepsFactory interface implemented in AzureMsiAuthentication.java . It would work.

Describe alternatives you've considered

Using bootstrap loader without spring.config.import property

failing setup Spring boot - 2.5.4 spring-cloud-dependencies- 2020.0.3

application.yml -- Please ignore the indentation

spring:
   application:
       name: app
   config:
        import: vault://
   cloud:
      vault:
      reactive:
          enabled: false
      uri: //my vaulturi
          kv:
            enabled: true
            backend: backend
            default-context: context
      authentication: azure_msi
      azure_msi:
        role: azure_role
        metadata-service: //url
        isntance-token-service: //url

I have tried with removing spring.config.import property , in this case the azure login steps are not even executed. Please help.

nks0203 commented 2 years ago

I have raised this issue in spring vault core project as AzureMSIAuthentication.java resides there.