Fix for namespace not being propagated on Auth schemes (except Token)
This commit is contained in:
@@ -96,9 +96,7 @@ public class SpringVaultClientConfiguration extends AbstractVaultConfiguration {
|
||||
endpointProvider, requestFactory);
|
||||
|
||||
if (vaultProperties.getNamespace() != null) {
|
||||
restTemplateBuilder.customizers(
|
||||
restTemplate -> restTemplate.getInterceptors().add(VaultClients
|
||||
.createNamespaceInterceptor(vaultProperties.getNamespace())));
|
||||
restTemplateBuilder.customizers(this::applyNamespaceInterceptor);
|
||||
}
|
||||
|
||||
return restTemplateBuilder;
|
||||
@@ -125,6 +123,13 @@ public class SpringVaultClientConfiguration extends AbstractVaultConfiguration {
|
||||
return new SslConfiguration(keyStoreConfiguration, trustStoreConfiguration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RestOperations restOperations() {
|
||||
RestTemplate restOperations = (RestTemplate) super.restOperations();
|
||||
applyNamespaceInterceptor(restOperations);
|
||||
return restOperations;
|
||||
}
|
||||
|
||||
private SslConfiguration.KeyStoreConfiguration getKeyStoreConfiguration(
|
||||
Resource resourceProperty, String passwordProperty) {
|
||||
|
||||
@@ -140,6 +145,15 @@ public class SpringVaultClientConfiguration extends AbstractVaultConfiguration {
|
||||
return SslConfiguration.KeyStoreConfiguration.of(resourceProperty);
|
||||
}
|
||||
|
||||
private RestOperations applyNamespaceInterceptor(RestTemplate restTemplate) {
|
||||
if (vaultProperties.getNamespace() != null) {
|
||||
restTemplate.getInterceptors().add(VaultClients
|
||||
.createNamespaceInterceptor(vaultProperties.getNamespace()));
|
||||
}
|
||||
|
||||
return restTemplate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a new {@link ClientAuthentication}.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user