diff options
author | Harald Musum <musum@verizonmedia.com> | 2020-03-25 08:12:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-25 08:12:28 +0100 |
commit | a076349525624a20272f0a5c4a514b50dd567f1d (patch) | |
tree | 86d71f25cf5f356a4dca9b06fb581cd2560772fc /tenant-auth | |
parent | ecf3845bbcd225463be9314ad2b9fd3f1feb9b37 (diff) |
Revert "Revert "Support api key variable for signature based test framework controlle…""
Diffstat (limited to 'tenant-auth')
-rw-r--r-- | tenant-auth/src/main/java/ai/vespa/hosted/auth/ApiAuthenticator.java | 10 |
1 files changed, 6 insertions, 4 deletions
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 82d859b08bd..55b3af93050 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 @@ -13,10 +13,12 @@ public class ApiAuthenticator implements ai.vespa.hosted.api.ApiAuthenticator { .map(certificateFile -> ControllerHttpClient.withKeyAndCertificate(Properties.apiEndpoint(), Properties.apiKeyFile(), certificateFile)) - .orElseGet(() -> - ControllerHttpClient.withSignatureKey(Properties.apiEndpoint(), - Properties.apiKeyFile(), - Properties.application())); + .or(() -> Properties.apiKey().map(apiKey -> ControllerHttpClient.withSignatureKey(Properties.apiEndpoint(), + apiKey, + Properties.application()))) + .orElseGet(() -> ControllerHttpClient.withSignatureKey(Properties.apiEndpoint(), + Properties.apiKeyFile(), + Properties.application())); } } |