0

使用 Spring Vault 2.1.2,我无法升级。我正在配置 AbstractReactiveVaultConfiguration 以使用 KubernetesAuthentication。

@Configuration
public class VaultConfiguration extends AbstractReactiveVaultConfiguration {

    @Value("${my.vault.endpoint.url}")
    private URI vaultEndpointURL;

    @Override
    public VaultEndpoint vaultEndpoint() {
        return VaultEndpoint.from(vaultEndpointURL);
    }

    @Override
    public ClientAuthentication clientAuthentication() {
        KubernetesAuthenticationOptions options = KubernetesAuthenticationOptions.builder()
                .role("myRole").path("foo/bar").build();

        return new KubernetesAuthentication(options, restOperations());
    }

}

这是产生:

org.springframework.vault.authentication.VaultLoginException: Cannot retrieve VaultToken from authentication chain; nested exception is org.springframework.web.reactive.function.client.WebClientResponseException$BadRequest: 400 Bad Request

通过足够的日志记录,我发现它正在尝试发布到:

POST /v1/auth/foo%2Fbar/login

什么是转义“foo/bar”的配置路径以及如何避免这种情况?

4

1 回答 1

0

这是最新版本2.2.1.RELEASE的问题。的弹簧拱顶。

现在已经修复了。还没有发布新版本。

在此处参考错误并修复

错误原因:

以前,我们向 login 方法发送两个参数。.login("auth/{mount}/login", options.getPath());. 在 login 方法中,这个参数将被提供给 HttpRequestBuilder.post(uriTemplate, uriVariables) ,它将转换/%2F

目前,我们正在发送一个不会AuthenticationUtil.getLoginPath(options.getPath())将转换为 的参数。/%2F

我们可以将此问题提交给 spring-vault 并要求他们发布下一个版本。

于 2020-05-21T05:02:10.980 回答