in taverna-server-webapp/src/main/java/org/apache/taverna/server/master/worker/SecurityContextDelegate.java [187:220]
public abstract void validateCredential(Credential c)
throws InvalidCredentialException;
@Override
public void validateTrusted(Trust t) throws InvalidCredentialException {
InputStream contentsAsStream;
if (t.certificateBytes != null && t.certificateBytes.length > 0) {
contentsAsStream = new ByteArrayInputStream(t.certificateBytes);
t.certificateFile = null;
} else if (t.certificateFile == null
|| t.certificateFile.trim().isEmpty())
throw new InvalidCredentialException(
"absent or empty certificateFile");
else {
contentsAsStream = contents(t.certificateFile);
t.certificateBytes = null;
}
t.serverName = null;
if (t.fileType == null || t.fileType.trim().isEmpty())
t.fileType = CERTIFICATE_TYPE;
t.fileType = t.fileType.trim();
try {
t.loadedCertificates = CertificateFactory.getInstance(t.fileType)
.generateCertificates(contentsAsStream);
t.serverName = new ArrayList<>(t.loadedCertificates.size());
for (Certificate c : t.loadedCertificates)
t.serverName.add(getPrincipalName(((X509Certificate) c)
.getSubjectX500Principal()));
} catch (CertificateException e) {
throw new InvalidCredentialException(e);
} catch (ClassCastException e) {
// Do nothing; truncates the list of server names
}
}