blob: a92680c1fd847e2c317049d96d0656b77db2bae3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.athenz.impl;
import com.google.inject.Inject;
import com.yahoo.vespa.athenz.api.AthenzIdentity;
import com.yahoo.vespa.athenz.api.AthenzService;
import com.yahoo.vespa.athenz.client.zms.DefaultZmsClient;
import com.yahoo.vespa.athenz.client.zms.ZmsClient;
import com.yahoo.vespa.athenz.client.zts.DefaultZtsClient;
import com.yahoo.vespa.athenz.client.zts.ZtsClient;
import com.yahoo.vespa.athenz.identity.ServiceIdentityProvider;
import com.yahoo.vespa.hosted.controller.api.integration.athenz.AthenzClientFactory;
import com.yahoo.vespa.hosted.controller.athenz.config.AthenzConfig;
import java.net.URI;
/**
* @author bjorncs
*/
public class AthenzClientFactoryImpl implements AthenzClientFactory {
private final AthenzConfig config;
private final ServiceIdentityProvider identityProvider;
@Inject
public AthenzClientFactoryImpl(ServiceIdentityProvider identityProvider, AthenzConfig config) {
this.identityProvider = identityProvider;
this.config = config;
}
@Override
public AthenzIdentity getControllerIdentity() {
return identityProvider.identity();
}
/**
* @return A ZMS client instance with the service identity as principal.
*/
@Override
public ZmsClient createZmsClient() {
return new DefaultZmsClient(URI.create(config.zmsUrl()), identityProvider);
}
/**
* @return A ZTS client instance with the service identity as principal.
*/
@Override
public ZtsClient createZtsClient() {
return new DefaultZtsClient(URI.create(config.ztsUrl()), identityProvider);
}
@Override
public boolean cacheLookups() {
return true;
}
}
|