summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2019-10-25 13:00:32 +0200
committerJon Marius Venstad <venstad@gmail.com>2019-10-25 13:00:32 +0200
commitef9e8a057e6782a461869f186a98d85fe89563d3 (patch)
treea81d410bc150bd4fe8b22f82eee214ca411d4303
parent052987bb1acf8c78426a7f33e618560bb0269f50 (diff)
Change property names expected by plugins and test framework for auth files
-rw-r--r--hosted-api/src/main/java/ai/vespa/hosted/api/Properties.java10
-rw-r--r--tenant-auth/src/main/java/ai/vespa/hosted/auth/ApiAuthenticator.java4
-rw-r--r--vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/AbstractVespaMojo.java24
3 files changed, 19 insertions, 19 deletions
diff --git a/hosted-api/src/main/java/ai/vespa/hosted/api/Properties.java b/hosted-api/src/main/java/ai/vespa/hosted/api/Properties.java
index c0fe2074809..39d56408fb8 100644
--- a/hosted-api/src/main/java/ai/vespa/hosted/api/Properties.java
+++ b/hosted-api/src/main/java/ai/vespa/hosted/api/Properties.java
@@ -42,18 +42,18 @@ public class Properties {
}
/** Returns the path of the API private key. This must be set with the 'privateKeyFile' property. */
- public static Path apiPrivateKeyFile() {
- return Paths.get(requireNonBlankProperty("privateKeyFile"));
+ public static Path apiKeyFile() {
+ return Paths.get(requireNonBlankProperty("apiKeyFile"));
}
/** Returns the path of the API certificate, if this is set with the 'certificateFile' property. */
public static Optional<Path> apiCertificateFile() {
- return getNonBlankProperty("certificateFile").map(Paths::get);
+ return getNonBlankProperty("apiCertificateFile").map(Paths::get);
}
/** Returns the actual private key as a string */
- public static Optional<String> privateKey() {
- return getNonBlankProperty("privateKey");
+ public static Optional<String> apiKey() {
+ return getNonBlankProperty("apiKey");
}
/** Returns the path of the data plane certificate file, if this is set with the 'dataPlaneCertificateFile' property. */
diff --git a/tenant-auth/src/main/java/ai/vespa/hosted/auth/ApiAuthenticator.java b/tenant-auth/src/main/java/ai/vespa/hosted/auth/ApiAuthenticator.java
index f6a88ec83c2..c2d47622040 100644
--- a/tenant-auth/src/main/java/ai/vespa/hosted/auth/ApiAuthenticator.java
+++ b/tenant-auth/src/main/java/ai/vespa/hosted/auth/ApiAuthenticator.java
@@ -10,11 +10,11 @@ public class ApiAuthenticator implements ai.vespa.hosted.api.ApiAuthenticator {
public ControllerHttpClient controller() {
return Properties.apiCertificateFile()
.map(certificateFile -> ControllerHttpClient.withKeyAndCertificate(Properties.apiEndpoint(),
- Properties.apiPrivateKeyFile(),
+ Properties.apiKeyFile(),
certificateFile))
.orElseGet(() ->
ControllerHttpClient.withSignatureKey(Properties.apiEndpoint(),
- Properties.apiPrivateKeyFile(),
+ Properties.apiKeyFile(),
Properties.application()));
}
diff --git a/vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/AbstractVespaMojo.java b/vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/AbstractVespaMojo.java
index 845d0ba4c1b..55616fc7936 100644
--- a/vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/AbstractVespaMojo.java
+++ b/vespa-maven-plugin/src/main/java/ai/vespa/hosted/plugin/AbstractVespaMojo.java
@@ -37,14 +37,14 @@ public abstract class AbstractVespaMojo extends AbstractMojo {
@Parameter(property = "instance")
protected String instance;
- @Parameter(property = "privateKey")
- protected String privateKey;
+ @Parameter(property = "apiKey")
+ protected String apiKey;
- @Parameter(property = "privateKeyFile")
- protected String privateKeyFile;
+ @Parameter(property = "apiKeyFile")
+ protected String apiKeyFile;
- @Parameter(property = "certificateFile")
- protected String certificateFile;
+ @Parameter(property = "apiCertificateFile")
+ protected String apiCertificateFile;
// Fields set up as part of setup().
protected ApplicationId id;
@@ -73,12 +73,12 @@ public abstract class AbstractVespaMojo extends AbstractMojo {
instance = firstNonBlank(instance, project.getProperties().getProperty("instance", Properties.user()));
id = ApplicationId.from(tenant, application, instance);
- if (privateKey != null) {
- controller = ControllerHttpClient.withSignatureKey(URI.create(endpoint), privateKey, id);
- } else if (privateKeyFile != null) {
- controller = certificateFile == null
- ? ControllerHttpClient.withSignatureKey(URI.create(endpoint), Paths.get(privateKeyFile), id)
- : ControllerHttpClient.withKeyAndCertificate(URI.create(endpoint), Paths.get(privateKeyFile), Paths.get(certificateFile));
+ if (apiKey != null) {
+ controller = ControllerHttpClient.withSignatureKey(URI.create(endpoint), apiKey, id);
+ } else if (apiKeyFile != null) {
+ controller = apiCertificateFile == null
+ ? ControllerHttpClient.withSignatureKey(URI.create(endpoint), Paths.get(apiKeyFile), id)
+ : ControllerHttpClient.withKeyAndCertificate(URI.create(endpoint), Paths.get(apiKeyFile), Paths.get(apiCertificateFile));
} else {
throw new IllegalArgumentException("One of the properties 'privateKey' or 'privateKeyFile' is required.");
}