summaryrefslogtreecommitdiffstats
path: root/tenant-auth
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2019-10-04 15:13:25 +0200
committerJon Marius Venstad <venstad@gmail.com>2019-10-04 15:13:25 +0200
commitca8cd24e856820538137357994671817a31e51cc (patch)
treecfc506390b312044b4303b352b21bc804ce2f14c /tenant-auth
parent381e8d894d471c2b52ad8acbb8fc8fbd9f50f1bd (diff)
Expose content clusters in TestConfig
Diffstat (limited to 'tenant-auth')
-rw-r--r--tenant-auth/src/main/java/ai/vespa/hosted/auth/ApiAuthenticator.java13
1 files changed, 9 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 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()));
}
}