use of com.yahoo.vespa.hosted.athenz.instanceproviderservice.identitydocument.IdentityDocument in project vespa by vespa-engine.
the class InstanceValidatorTest method createInstanceConfirmation.
private static InstanceConfirmation createInstanceConfirmation(PrivateKey privateKey, ApplicationId applicationId, String domain, String service) {
IdentityDocument identityDocument = new IdentityDocument(new ProviderUniqueId(applicationId.tenant().value(), applicationId.application().value(), "environment", "region", applicationId.instance().value(), "cluster-id", 0), "hostname", "instance-hostname", Instant.now());
try {
ObjectMapper mapper = Utils.getMapper();
String encodedIdentityDocument = Base64.getEncoder().encodeToString(mapper.writeValueAsString(identityDocument).getBytes());
Signature sigGenerator = Signature.getInstance("SHA512withRSA");
sigGenerator.initSign(privateKey);
sigGenerator.update(encodedIdentityDocument.getBytes());
return new InstanceConfirmation("provider", domain, service, new SignedIdentityDocument(encodedIdentityDocument, Base64.getEncoder().encodeToString(sigGenerator.sign()), 0, identityDocument.providerUniqueId.asString(), "dnssuffix", "service", "localhost/zts", 1));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Aggregations