use of org.gluu.oxtrust.util.EasyCASSLProtocolSocketFactory in project oxTrust by GluuFederation.
the class Shibboleth3ConfService method saveSpMetadataFile.
public String saveSpMetadataFile(String uri, String spMetadataFileName) {
if (StringHelper.isEmpty(uri)) {
return null;
}
HTTPFileDownloader.setEasyhttps(new Protocol("https", new EasyCASSLProtocolSocketFactory(), 443));
String spMetadataFileContent = HTTPFileDownloader.getResource(uri, "application/xml, text/xml", null, null);
if (StringHelper.isEmpty(spMetadataFileContent)) {
return null;
}
// Save new file
ByteArrayInputStream is;
try {
byte[] spMetadataFileContentBytes = spMetadataFileContent.getBytes("UTF-8");
is = new ByteArrayInputStream(spMetadataFileContentBytes);
} catch (UnsupportedEncodingException ex) {
log.error("saveSpMetadataFile exception", ex);
ex.printStackTrace();
return null;
}
FileUploadWrapper tmpfileWrapper = new FileUploadWrapper();
tmpfileWrapper.setStream(is);
return saveSpMetadataFile(spMetadataFileName, tmpfileWrapper.getStream());
}
Aggregations