use of org.platformlayer.auth.model.CertificateChainInfo in project platformlayer by platformlayer.
the class RootResource method requireSystemAccess.
protected void requireSystemAccess() throws AuthenticatorException {
X509Certificate[] certChain = getCertificateChain();
if (certChain != null && certChain.length != 0) {
CertificateChainInfo chain = new CertificateChainInfo();
for (X509Certificate cert : certChain) {
CertificateInfo info = new CertificateInfo();
info.publicKey = Hex.toHex(cert.getPublicKey().getEncoded());
info.subjectDN = Certificates.getSubject(cert);
// Md5Hash hash = OpenSshUtils.getSignature(cert.getPublicKey());
// certificateInfo.setPublicKeyHash(hash.toHex());
chain.certificates.add(info);
}
ServiceAccount auth = systemAuthenticator.authenticate(chain);
if (auth != null) {
log.debug("Certificate authentication SUCCESS for " + chain);
return;
}
log.debug("Certificate authentication FAIL for " + chain);
} else {
log.debug("Certificate authentication FAIL (no certificate presented)");
}
throwUnauthorized();
// return myTokenInfo;
}
Aggregations