Skip to content

Commit

Permalink
Merge branch 'main' into feature/limited-use-tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
kdubb authored Jan 24, 2025
2 parents b0d3b5d + b5ce612 commit 239d15e
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/includes/attributes.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
:quarkus-version: 3.17.7
:quarkus-version: 3.18.0
:quarkus-vault-version: 4.1.0
:maven-version: 3.8.1+

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public class VaultITCase {
String someSecretThroughIndirection;

@Test
public void credentialsProvider() throws Exception {
public void credentialsProvider() {
Map<String, String> staticCredentials = credentialsProvider.getCredentials("static");
assertEquals("{" + PASSWORD_PROPERTY_NAME + "=" + DB_PASSWORD + "}", staticCredentials.toString());

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<maven.compiler.parameters>true</maven.compiler.parameters>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus.version>3.17.7</quarkus.version>
<quarkus.version>3.18.0</quarkus.version>
<jandex.version>3.2.3</jandex.version>
<assertj.version>3.27.3</assertj.version>
<wiremock.version>3.0.1</wiremock.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ public Map<String, String> getCredentials(String credentialsProviderName) {
}

if (config.kvPath().isPresent()) {
String password = vaultKVSecretEngine.readSecret(config.kvPath().get()).get(config.kvKey());
var val = vaultKVSecretEngine.readSecretJson(config.kvPath().get());
if (val == null) {
throw new VaultException(
"unable to retrieve credential " + config.kvKey() + " from path " + config.kvPath().get());
}
String password = String.valueOf(val.get(config.kvKey()));
Map<String, String> result = new HashMap<>();
result.put(PASSWORD_PROPERTY_NAME, password);
return result;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.quarkus.vault.test;

import static io.quarkus.credentials.CredentialsProvider.PASSWORD_PROPERTY_NAME;
import static java.lang.Boolean.TRUE;
import static java.lang.String.format;
import static java.util.regex.Pattern.MULTILINE;
Expand Down Expand Up @@ -245,6 +244,7 @@ public void start() throws Exception {
.withClasspathResourceMapping("vault-postgres-creation.sql", TMP_VAULT_POSTGRES_CREATION_SQL_FILE, READ_ONLY)
.withClasspathResourceMapping("secret.json", "/tmp/secret.json", READ_ONLY)
.withClasspathResourceMapping("config.json", "/tmp/config.json", READ_ONLY)
.withClasspathResourceMapping("cred-provider.json", "/tmp/cred-provider.json", READ_ONLY)
.withClasspathResourceMapping(getTestPluginFilename(), "/vault/plugins/test-plugin", READ_ONLY)
.withCommand("server", "-log-level=debug", "-config=" + TMP_VAULT_CONFIG_JSON_FILE);

Expand Down Expand Up @@ -331,7 +331,7 @@ private void initVault() throws Exception {
execVault(format("vault kv put %s/%s %s=%s", SECRET_PATH_V1, APP_SECRET_PATH, SECRET_KEY, SECRET_VALUE));
execVault(
format("vault kv put %s/%s %s=%s", SECRET_PATH_V1, LIST_PATH + "/" + LIST_SUB_PATH, SECRET_KEY, SECRET_VALUE));
execVault(format("vault kv put %s/%s %s=%s", SECRET_PATH_V1, APP_CONFIG_PATH, PASSWORD_PROPERTY_NAME, DB_PASSWORD));
execVault(format("vault kv put %s/%s @/tmp/cred-provider.json", SECRET_PATH_V1, APP_CONFIG_PATH));
execVault(format("vault kv put %s/foo-json @/tmp/secret.json", SECRET_PATH_V1));
execVault(format("vault kv put %s/config-json @/tmp/config.json", SECRET_PATH_V1));

Expand All @@ -340,7 +340,7 @@ private void initVault() throws Exception {
execVault(format("vault kv put %s/%s %s=%s", SECRET_PATH_V2, APP_SECRET_PATH, SECRET_KEY, SECRET_VALUE));
execVault(
format("vault kv put %s/%s %s=%s", SECRET_PATH_V2, LIST_PATH + "/" + LIST_SUB_PATH, SECRET_KEY, SECRET_VALUE));
execVault(format("vault kv put %s/%s %s=%s", SECRET_PATH_V2, APP_CONFIG_PATH, PASSWORD_PROPERTY_NAME, DB_PASSWORD));
execVault(format("vault kv put %s/%s @/tmp/cred-provider.json", SECRET_PATH_V2, APP_CONFIG_PATH));
execVault(format("vault kv put %s/foo-json @/tmp/secret.json", SECRET_PATH_V2));
execVault(format("vault kv put %s/config-json @/tmp/config.json", SECRET_PATH_V2));

Expand Down
4 changes: 4 additions & 0 deletions test-framework/src/main/resources/cred-provider.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"password": "bar",
"mynull": null
}

0 comments on commit 239d15e

Please sign in to comment.