use of org.platformlayer.auth.v1.SignCertificateRequest in project platformlayer by platformlayer.
the class PlatformLayerAuthAdminClient method signCsr.
// This can actually be moved to the user-auth system
public List<X509Certificate> signCsr(String projectKey, CryptoKey projectSecret, String csr) {
String url = "pki/csr";
SignCertificateRequest request = new SignCertificateRequest();
request.setProject(projectKey);
request.setCsr(csr);
request.setProjectSecret(FathomdbCrypto.serialize(projectSecret));
try {
SignCertificateResponse response = doSimpleXmlRequest(HttpMethod.POST, url, request, SignCertificateResponse.class);
List<X509Certificate> certificates = Lists.newArrayList();
for (String cert : response.getCertificates()) {
certificates.addAll(CertificateUtils.fromPem(cert));
}
return certificates;
} catch (RestClientException e) {
throw new IllegalArgumentException("Error while signing certificate", e);
}
}
Aggregations