0

所以如果我有这个代码:

public void readSecrets() {
    VaultTemplate vaultTemplate = new VaultTemplate(vaultEndpoint(), new TokenAuthentication("00000000-0000-0000-0000-000000000000"));
    VaultResponse response = vaultTemplate.read("/secret/data/gs-vault-config");
    System.out.println(response.getData().toString());
}

我得到数据:

{data={password=passwordone, username=myusername}, metadata={created_time=2021-03-23T06:22:46.7730209Z, deletion_time=, destroyed=false, version=7}}

如果我有这个代码:

public void readSecrets() {
    VaultTemplate vaultTemplate = new VaultTemplate(vaultEndpoint(), new TokenAuthentication("00000000-0000-0000-0000-000000000000"));
    VaultResponseSupport<Credentials> response = vaultTemplate.read("/secret/data/gs-vault-config", Credentials.class);
    System.out.println(response.getData().toString());
}

然后响应是:

Credentials(username=null, password=null)

我不知道为什么?希望有人看到我做错了什么。提前致谢

4

0 回答 0