summaryrefslogtreecommitdiffstats
path: root/vespa-athenz/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'vespa-athenz/src/main')
-rw-r--r--vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/EntityBindingsMapper.java22
-rw-r--r--vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/IdentityDocument.java2
-rw-r--r--vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/IdentityType.java25
-rw-r--r--vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/SignedIdentityDocument.java39
-rw-r--r--vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/VespaUniqueInstanceId.java46
-rw-r--r--vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/bindings/IdentityDocumentApi.java6
-rw-r--r--vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/bindings/IdentityDocumentEntity.java2
-rw-r--r--vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/bindings/SignedIdentityDocumentEntity.java41
-rw-r--r--vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/bindings/VespaUniqueInstanceIdEntity.java26
-rw-r--r--vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/client/AthenzCredentialsService.java3
-rw-r--r--vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/client/DefaultIdentityDocumentClient.java16
11 files changed, 40 insertions, 188 deletions
diff --git a/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/EntityBindingsMapper.java b/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/EntityBindingsMapper.java
index 12389712976..1504119d9cc 100644
--- a/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/EntityBindingsMapper.java
+++ b/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/EntityBindingsMapper.java
@@ -12,8 +12,6 @@ import com.yahoo.vespa.athenz.utils.AthenzIdentities;
import java.util.Base64;
-import static com.yahoo.vespa.athenz.identityprovider.api.VespaUniqueInstanceId.*;
-
/**
* Utility class for mapping objects model types and their Jackson binding versions.
*
@@ -35,7 +33,7 @@ public class EntityBindingsMapper {
public static VespaUniqueInstanceId toVespaUniqueInstanceId(VespaUniqueInstanceIdEntity entity) {
return new VespaUniqueInstanceId(
- entity.clusterIndex, entity.clusterId, entity.instance, entity.application, entity.tenant, entity.region, entity.environment, entity.type != null ? IdentityType.fromId(entity.type) : null); // TODO Remove support for legacy representation without type
+ entity.clusterIndex, entity.clusterId, entity.instance, entity.application, entity.tenant, entity.region, entity.environment);
}
public static IdentityDocument toIdentityDocument(IdentityDocumentEntity entity) {
@@ -52,22 +50,17 @@ public class EntityBindingsMapper {
toIdentityDocument(entity.identityDocument),
entity.signature,
entity.signingKeyVersion,
- fromDottedString(entity.providerUniqueId),
+ VespaUniqueInstanceId.fromDottedString(entity.providerUniqueId),
entity.dnsSuffix,
(AthenzService) AthenzIdentities.from(entity.providerService),
entity.ztsEndpoint,
- entity.documentVersion,
- entity.configServerHostname,
- entity.instanceHostname,
- entity.createdAt,
- entity.ipAddresses,
- entity.identityType != null ? IdentityType.fromId(entity.identityType) : null); // TODO Remove support for legacy representation without type
+ entity.documentVersion);
}
public static VespaUniqueInstanceIdEntity toVespaUniqueInstanceIdEntity(VespaUniqueInstanceId model) {
return new VespaUniqueInstanceIdEntity(
model.tenant(), model.application(), model.environment(), model.region(),
- model.instance(), model.clusterId(), model.clusterIndex(), model.type() != null ? model.type().id() : null); // TODO Remove support for legacy representation without type
+ model.instance(), model.clusterId(), model.clusterIndex());
}
public static IdentityDocumentEntity toIdentityDocumentEntity(IdentityDocument model) {
@@ -91,12 +84,7 @@ public class EntityBindingsMapper {
model.dnsSuffix(),
model.providerService().getFullName(),
model.ztsEndpoint(),
- model.documentVersion(),
- model.configServerHostname(),
- model.instanceHostname(),
- model.createdAt(),
- model.ipAddresses(),
- model.identityType() != null ? model.identityType().id() : null); // TODO Remove support for legacy representation without type
+ model.documentVersion());
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
diff --git a/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/IdentityDocument.java b/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/IdentityDocument.java
index 82d0a3d622c..8da2bd0a343 100644
--- a/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/IdentityDocument.java
+++ b/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/IdentityDocument.java
@@ -8,9 +8,7 @@ import java.util.Set;
* The identity document that contains the instance specific information
*
* @author bjorncs
- * @deprecated Will soon be inlined into {@link SignedIdentityDocument}
*/
-@Deprecated
public class IdentityDocument {
private final VespaUniqueInstanceId providerUniqueId;
private final String configServerHostname;
diff --git a/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/IdentityType.java b/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/IdentityType.java
deleted file mode 100644
index 4ca2e34a618..00000000000
--- a/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/IdentityType.java
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.vespa.athenz.identityprovider.api;
-
-import java.util.Arrays;
-
-/**
- * Represents the types of identities that the configserver can provide.
- *
- * @author bjorncs
- */
-public enum IdentityType {TENANT("tenant"), NODE("node");
- private final String id;
-
- IdentityType(String id) { this.id = id; }
-
- public String id() { return id; }
-
- public static IdentityType fromId(String id) {
- return Arrays.stream(values())
- .filter(v -> v.id.equals(id))
- .findFirst()
- .orElseThrow(() -> new IllegalArgumentException("Invalid id: " + id));
- }
-}
-
diff --git a/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/SignedIdentityDocument.java b/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/SignedIdentityDocument.java
index 60be42544c7..d184efc0221 100644
--- a/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/SignedIdentityDocument.java
+++ b/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/SignedIdentityDocument.java
@@ -4,8 +4,6 @@ package com.yahoo.vespa.athenz.identityprovider.api;
import com.yahoo.vespa.athenz.api.AthenzService;
import java.net.URI;
-import java.time.Instant;
-import java.util.Set;
/**
* A signed identity document which contains a {@link IdentityDocument}
@@ -24,11 +22,6 @@ public class SignedIdentityDocument {
private final AthenzService providerService;
private final URI ztsEndpoint;
private final int documentVersion;
- private final String configServerHostname;
- private final String instanceHostname;
- private final Instant createdAt;
- private final Set<String> ipAddresses;
- private final IdentityType identityType;
public SignedIdentityDocument(IdentityDocument identityDocument,
String signature,
@@ -37,12 +30,7 @@ public class SignedIdentityDocument {
String dnsSuffix,
AthenzService providerService,
URI ztsEndpoint,
- int documentVersion,
- String configServerHostname,
- String instanceHostname,
- Instant createdAt,
- Set<String> ipAddresses,
- IdentityType identityType) {
+ int documentVersion) {
this.identityDocument = identityDocument;
this.signature = signature;
this.signingKeyVersion = signingKeyVersion;
@@ -51,11 +39,6 @@ public class SignedIdentityDocument {
this.providerService = providerService;
this.ztsEndpoint = ztsEndpoint;
this.documentVersion = documentVersion;
- this.configServerHostname = configServerHostname;
- this.instanceHostname = instanceHostname;
- this.createdAt = createdAt;
- this.ipAddresses = ipAddresses;
- this.identityType = identityType;
}
public IdentityDocument identityDocument() {
@@ -89,24 +72,4 @@ public class SignedIdentityDocument {
public int documentVersion() {
return documentVersion;
}
-
- public String configServerHostname() {
- return configServerHostname;
- }
-
- public String instanceHostname() {
- return instanceHostname;
- }
-
- public Instant createdAt() {
- return createdAt;
- }
-
- public Set<String> ipAddresses() {
- return ipAddresses;
- }
-
- public IdentityType identityType() {
- return identityType;
- }
}
diff --git a/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/VespaUniqueInstanceId.java b/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/VespaUniqueInstanceId.java
index be94cc59691..5539ba53882 100644
--- a/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/VespaUniqueInstanceId.java
+++ b/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/VespaUniqueInstanceId.java
@@ -4,8 +4,6 @@ package com.yahoo.vespa.athenz.identityprovider.api;
import java.util.Objects;
/**
- * Represents the unique instance id as used in Vespa's integration with Athenz Copper Argos
- *
* @author bjorncs
*/
public class VespaUniqueInstanceId {
@@ -17,7 +15,6 @@ public class VespaUniqueInstanceId {
private final String tenant;
private final String region;
private final String environment;
- private final IdentityType type;
public VespaUniqueInstanceId(int clusterIndex,
String clusterId,
@@ -25,8 +22,7 @@ public class VespaUniqueInstanceId {
String application,
String tenant,
String region,
- String environment,
- IdentityType type) {
+ String environment) {
this.clusterIndex = clusterIndex;
this.clusterId = clusterId;
this.instance = instance;
@@ -34,43 +30,21 @@ public class VespaUniqueInstanceId {
this.tenant = tenant;
this.region = region;
this.environment = environment;
- this.type = type;
}
- // TODO Remove support for legacy representation without type
- @Deprecated
- public VespaUniqueInstanceId(int clusterIndex,
- String clusterId,
- String instance,
- String application,
- String tenant,
- String region,
- String environment) {
- this(clusterIndex, clusterId, instance, application, tenant, region, environment, null);
- }
-
-
- // TODO Remove support for legacy representation without type
public static VespaUniqueInstanceId fromDottedString(String instanceId) {
String[] tokens = instanceId.split("\\.");
- if (tokens.length != 7 && tokens.length != 8) {
+ if (tokens.length != 7) {
throw new IllegalArgumentException("Invalid instance id: " + instanceId);
}
return new VespaUniqueInstanceId(
- Integer.parseInt(tokens[0]), tokens[1], tokens[2], tokens[3], tokens[4], tokens[5], tokens[6], tokens.length == 8 ? IdentityType.fromId(tokens[7]) : null);
+ Integer.parseInt(tokens[0]), tokens[1], tokens[2], tokens[3], tokens[4], tokens[5], tokens[6]);
}
- // TODO Remove support for legacy representation without type
public String asDottedString() {
- if (type != null) {
- return String.format(
- "%d.%s.%s.%s.%s.%s.%s.%s",
- clusterIndex, clusterId, instance, application, tenant, region, environment, type.id());
- } else {
- return String.format(
- "%d.%s.%s.%s.%s.%s.%s",
- clusterIndex, clusterId, instance, application, tenant, region, environment);
- }
+ return String.format(
+ "%d.%s.%s.%s.%s.%s.%s",
+ clusterIndex, clusterId, instance, application, tenant, region, environment);
}
public int clusterIndex() {
@@ -101,8 +75,6 @@ public class VespaUniqueInstanceId {
return environment;
}
- public IdentityType type() { return type; }
-
@Override
public String toString() {
return "VespaUniqueInstanceId{" +
@@ -113,7 +85,6 @@ public class VespaUniqueInstanceId {
", tenant='" + tenant + '\'' +
", region='" + region + '\'' +
", environment='" + environment + '\'' +
- ", type=" + type +
'}';
}
@@ -128,12 +99,11 @@ public class VespaUniqueInstanceId {
Objects.equals(application, that.application) &&
Objects.equals(tenant, that.tenant) &&
Objects.equals(region, that.region) &&
- Objects.equals(environment, that.environment) &&
- type == that.type;
+ Objects.equals(environment, that.environment);
}
@Override
public int hashCode() {
- return Objects.hash(clusterIndex, clusterId, instance, application, tenant, region, environment, type);
+ return Objects.hash(clusterIndex, clusterId, instance, application, tenant, region, environment);
}
}
diff --git a/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/bindings/IdentityDocumentApi.java b/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/bindings/IdentityDocumentApi.java
index fc5392411c1..775a49349a3 100644
--- a/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/bindings/IdentityDocumentApi.java
+++ b/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/bindings/IdentityDocumentApi.java
@@ -5,6 +5,7 @@ import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
/**
@@ -15,6 +16,11 @@ public interface IdentityDocumentApi {
@GET
@Produces(MediaType.APPLICATION_JSON)
+ @Deprecated
+ SignedIdentityDocumentEntity getIdentityDocument(@QueryParam("hostname") String hostname);
+
+ @GET
+ @Produces(MediaType.APPLICATION_JSON)
@Path("/node/{host}")
SignedIdentityDocumentEntity getNodeIdentityDocument(@PathParam("host") String host);
diff --git a/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/bindings/IdentityDocumentEntity.java b/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/bindings/IdentityDocumentEntity.java
index b4b2e82ab0e..58a4f1e24bf 100644
--- a/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/bindings/IdentityDocumentEntity.java
+++ b/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/bindings/IdentityDocumentEntity.java
@@ -10,10 +10,8 @@ import java.util.Set;
/**
* @author bjorncs
- * @deprecated Will soon be inlined into {@link SignedIdentityDocumentEntity}
*/
@JsonIgnoreProperties(ignoreUnknown = true)
-@Deprecated
public class IdentityDocumentEntity {
@JsonProperty("provider-unique-id")
diff --git a/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/bindings/SignedIdentityDocumentEntity.java b/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/bindings/SignedIdentityDocumentEntity.java
index aa514b3caf3..e397b81ef9e 100644
--- a/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/bindings/SignedIdentityDocumentEntity.java
+++ b/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/bindings/SignedIdentityDocumentEntity.java
@@ -11,10 +11,8 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.net.URI;
-import java.time.Instant;
import java.util.Base64;
import java.util.Objects;
-import java.util.Set;
/**
* @author bjorncs
@@ -33,11 +31,6 @@ public class SignedIdentityDocumentEntity {
@JsonProperty("provider-service") public final String providerService;
@JsonProperty("zts-endpoint") public final URI ztsEndpoint;
@JsonProperty("document-version") public final int documentVersion;
- @JsonProperty("configserver-hostname") public final String configServerHostname;
- @JsonProperty("instance-hostname") public final String instanceHostname;
- @JsonProperty("created-at") public final Instant createdAt;
- @JsonProperty("ip-addresses") public final Set<String> ipAddresses;
- @JsonProperty("identity-type") public final String identityType;
@JsonCreator
public SignedIdentityDocumentEntity(@JsonProperty("identity-document") String rawIdentityDocument,
@@ -47,12 +40,7 @@ public class SignedIdentityDocumentEntity {
@JsonProperty("dns-suffix") String dnsSuffix,
@JsonProperty("provider-service") String providerService,
@JsonProperty("zts-endpoint") URI ztsEndpoint,
- @JsonProperty("document-version") int documentVersion,
- @JsonProperty("configserver-hostname") String configServerHostname,
- @JsonProperty("instance-hostname") String instanceHostname,
- @JsonProperty("created-at") Instant createdAt,
- @JsonProperty("ip-addresses") Set<String> ipAddresses,
- @JsonProperty("identity-type") String identityType) {
+ @JsonProperty("document-version") int documentVersion) {
this.rawIdentityDocument = rawIdentityDocument;
this.identityDocument = parseIdentityDocument(rawIdentityDocument);
this.signature = signature;
@@ -62,11 +50,6 @@ public class SignedIdentityDocumentEntity {
this.providerService = providerService;
this.ztsEndpoint = ztsEndpoint;
this.documentVersion = documentVersion;
- this.configServerHostname = configServerHostname;
- this.instanceHostname = instanceHostname;
- this.createdAt = createdAt;
- this.ipAddresses = ipAddresses;
- this.identityType = identityType;
}
private static IdentityDocumentEntity parseIdentityDocument(String rawIdentityDocument) {
@@ -90,16 +73,7 @@ public class SignedIdentityDocumentEntity {
", identityDocument=" + identityDocument +
", signature='" + signature + '\'' +
", signingKeyVersion=" + signingKeyVersion +
- ", providerUniqueId='" + providerUniqueId + '\'' +
- ", dnsSuffix='" + dnsSuffix + '\'' +
- ", providerService='" + providerService + '\'' +
- ", ztsEndpoint=" + ztsEndpoint +
", documentVersion=" + documentVersion +
- ", configServerHostname='" + configServerHostname + '\'' +
- ", instanceHostname='" + instanceHostname + '\'' +
- ", createdAt=" + createdAt +
- ", ipAddresses=" + ipAddresses +
- ", identityType=" + identityType +
'}';
}
@@ -112,20 +86,11 @@ public class SignedIdentityDocumentEntity {
documentVersion == that.documentVersion &&
Objects.equals(rawIdentityDocument, that.rawIdentityDocument) &&
Objects.equals(identityDocument, that.identityDocument) &&
- Objects.equals(signature, that.signature) &&
- Objects.equals(providerUniqueId, that.providerUniqueId) &&
- Objects.equals(dnsSuffix, that.dnsSuffix) &&
- Objects.equals(providerService, that.providerService) &&
- Objects.equals(ztsEndpoint, that.ztsEndpoint) &&
- Objects.equals(configServerHostname, that.configServerHostname) &&
- Objects.equals(instanceHostname, that.instanceHostname) &&
- Objects.equals(createdAt, that.createdAt) &&
- Objects.equals(ipAddresses, that.ipAddresses) &&
- Objects.equals(identityType, identityType);
+ Objects.equals(signature, that.signature);
}
@Override
public int hashCode() {
- return Objects.hash(rawIdentityDocument, identityDocument, signature, signingKeyVersion, providerUniqueId, dnsSuffix, providerService, ztsEndpoint, documentVersion, configServerHostname, instanceHostname, createdAt, ipAddresses, identityType);
+ return Objects.hash(rawIdentityDocument, identityDocument, signature, signingKeyVersion, documentVersion);
}
}
diff --git a/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/bindings/VespaUniqueInstanceIdEntity.java b/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/bindings/VespaUniqueInstanceIdEntity.java
index 103c087638d..3127752ac7d 100644
--- a/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/bindings/VespaUniqueInstanceIdEntity.java
+++ b/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/bindings/VespaUniqueInstanceIdEntity.java
@@ -1,7 +1,6 @@
// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.athenz.identityprovider.api.bindings;
-import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
@@ -25,18 +24,14 @@ public class VespaUniqueInstanceIdEntity {
public final String clusterId;
@JsonProperty("cluster-index")
public final int clusterIndex;
- @JsonProperty("type")
- public final String type;
- @JsonCreator
public VespaUniqueInstanceIdEntity(@JsonProperty("tenant") String tenant,
@JsonProperty("application") String application,
@JsonProperty("environment") String environment,
@JsonProperty("region") String region,
@JsonProperty("instance") String instance,
@JsonProperty("cluster-id") String clusterId,
- @JsonProperty("cluster-index") int clusterIndex,
- @JsonProperty("type") String type) {
+ @JsonProperty("cluster-index") int clusterIndex) {
this.tenant = tenant;
this.application = application;
this.environment = environment;
@@ -44,21 +39,8 @@ public class VespaUniqueInstanceIdEntity {
this.instance = instance;
this.clusterId = clusterId;
this.clusterIndex = clusterIndex;
- this.type = type;
}
- @Deprecated
- public VespaUniqueInstanceIdEntity(String tenant,
- String application,
- String environment,
- String region,
- String instance,
- String clusterId,
- int clusterIndex) {
- this(tenant, application, environment, region, instance, clusterId, clusterIndex, null);
- }
-
-
@Override
public String toString() {
return "VespaUniqueInstanceIdEntity{" +
@@ -69,7 +51,6 @@ public class VespaUniqueInstanceIdEntity {
", instance='" + instance + '\'' +
", clusterId='" + clusterId + '\'' +
", clusterIndex=" + clusterIndex +
- ", type='" + type + '\'' +
'}';
}
@@ -84,12 +65,11 @@ public class VespaUniqueInstanceIdEntity {
Objects.equals(environment, that.environment) &&
Objects.equals(region, that.region) &&
Objects.equals(instance, that.instance) &&
- Objects.equals(clusterId, that.clusterId) &&
- Objects.equals(type, that.type);
+ Objects.equals(clusterId, that.clusterId);
}
@Override
public int hashCode() {
- return Objects.hash(tenant, application, environment, region, instance, clusterId, clusterIndex, type);
+ return Objects.hash(tenant, application, environment, region, instance, clusterId, clusterIndex);
}
}
diff --git a/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/client/AthenzCredentialsService.java b/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/client/AthenzCredentialsService.java
index e8ef2d9f97e..96e93ca419d 100644
--- a/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/client/AthenzCredentialsService.java
+++ b/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/client/AthenzCredentialsService.java
@@ -2,7 +2,6 @@
package com.yahoo.vespa.athenz.identityprovider.client;
import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.yahoo.container.core.identity.IdentityConfig;
import com.yahoo.vespa.athenz.api.AthenzService;
import com.yahoo.vespa.athenz.identityprovider.api.EntityBindingsMapper;
@@ -29,7 +28,7 @@ import static com.yahoo.vespa.athenz.tls.KeyStoreType.JKS;
*/
class AthenzCredentialsService {
- private static final ObjectMapper mapper = new ObjectMapper().registerModule(new JavaTimeModule());
+ private static final ObjectMapper mapper = new ObjectMapper();
private final IdentityConfig identityConfig;
private final IdentityDocumentClient identityDocumentClient;
diff --git a/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/client/DefaultIdentityDocumentClient.java b/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/client/DefaultIdentityDocumentClient.java
index b9aba6e66b0..90d1312c9f9 100644
--- a/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/client/DefaultIdentityDocumentClient.java
+++ b/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/client/DefaultIdentityDocumentClient.java
@@ -2,12 +2,14 @@
package com.yahoo.vespa.athenz.identityprovider.client;
import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import com.yahoo.vespa.athenz.api.AthenzService;
import com.yahoo.vespa.athenz.identity.ServiceIdentityProvider;
import com.yahoo.vespa.athenz.identityprovider.api.EntityBindingsMapper;
import com.yahoo.vespa.athenz.identityprovider.api.IdentityDocumentClient;
import com.yahoo.vespa.athenz.identityprovider.api.SignedIdentityDocument;
+import com.yahoo.vespa.athenz.identityprovider.api.VespaUniqueInstanceId;
import com.yahoo.vespa.athenz.identityprovider.api.bindings.SignedIdentityDocumentEntity;
+import com.yahoo.vespa.athenz.utils.AthenzIdentities;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.client.methods.RequestBuilder;
@@ -32,7 +34,7 @@ import java.util.function.Supplier;
public class DefaultIdentityDocumentClient implements IdentityDocumentClient {
private static final String IDENTITY_DOCUMENT_API = "/athenz/v1/provider/identity-document/";
- private static final ObjectMapper objectMapper = new ObjectMapper().registerModule(new JavaTimeModule());
+ private static final ObjectMapper objectMapper = new ObjectMapper();
private final Supplier<SSLContext> sslContextSupplier;
private final HostnameVerifier hostnameVerifier;
@@ -80,7 +82,15 @@ public class DefaultIdentityDocumentClient implements IdentityDocumentClient {
String responseContent = EntityUtils.toString(response.getEntity());
if (HttpStatus.isSuccess(response.getStatusLine().getStatusCode())) {
SignedIdentityDocumentEntity entity = objectMapper.readValue(responseContent, SignedIdentityDocumentEntity.class);
- return EntityBindingsMapper.toSignedIdentityDocument(entity);
+ return new SignedIdentityDocument(
+ EntityBindingsMapper.toIdentityDocument(entity.identityDocument),
+ entity.signature,
+ entity.signingKeyVersion,
+ VespaUniqueInstanceId.fromDottedString(entity.providerUniqueId),
+ entity.dnsSuffix,
+ (AthenzService) AthenzIdentities.from(entity.providerService),
+ entity.ztsEndpoint,
+ entity.documentVersion);
} else {
throw new RuntimeException(
String.format(