From ca8cd24e856820538137357994671817a31e51cc Mon Sep 17 00:00:00 2001 From: Jon Marius Venstad Date: Fri, 4 Oct 2019 15:13:25 +0200 Subject: Expose content clusters in TestConfig --- .../main/java/ai/vespa/hosted/auth/ApiAuthenticator.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'tenant-auth/src/main') 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 2b5bbb188dc..9de06e7f4da 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 @@ -5,12 +5,17 @@ import ai.vespa.hosted.api.Properties; public class ApiAuthenticator implements ai.vespa.hosted.api.ApiAuthenticator { - /** Returns an authenticating controller client, using private key signatures for authentication. */ + /** Returns a controller client using mTLS if a key and certificate pair is provided, or signed requests otherwise. */ @Override public ControllerHttpClient controller() { - return ControllerHttpClient.withSignatureKey(Properties.endpoint(), - Properties.privateKeyFile(), - Properties.application()); + return Properties.certificateFile() + .map(certificateFile -> ControllerHttpClient.withKeyAndCertificate(Properties.endpoint(), + Properties.privateKeyFile(), + certificateFile)) + .orElseGet(() -> + ControllerHttpClient.withSignatureKey(Properties.endpoint(), + Properties.privateKeyFile(), + Properties.application())); } } -- cgit v1.2.3