use of org.xdi.util.io.FileUploadWrapper in project oxTrust by GluuFederation.
the class RelyingPartyAction method updateProfileConfigurations.
public String updateProfileConfigurations() {
for (ProfileConfiguration profileConfiguration : savedProfileConfigurations) {
if (!profileConfigurationService.isProfileConfigurationPresent(trustRelationship, profileConfiguration)) {
this.getFileWrappers().put(profileConfiguration.getName(), new FileUploadWrapper());
profileConfigurationService.updateProfileConfiguration(trustRelationship, profileConfiguration);
}
}
for (ProfileConfiguration profileConfiguration : profileConfigurationService.getProfileConfigurationsList(trustRelationship)) {
if (!profileConfigurations.contains(profileConfiguration.getName())) {
this.getFileWrappers().remove(profileConfiguration.getName());
ProfileConfiguration removedProfileConfiguration = null;
for (ProfileConfiguration savedProfileConfiguration : savedProfileConfigurations) {
if (savedProfileConfiguration.getName().equals(profileConfiguration.getName())) {
removedProfileConfiguration = profileConfiguration;
}
}
if (removedProfileConfiguration != null) {
savedProfileConfigurations.remove(profileConfiguration);
}
profileConfigurationService.removeProfileConfiguration(trustRelationship, profileConfiguration);
}
}
return OxTrustConstants.RESULT_SUCCESS;
}
use of org.xdi.util.io.FileUploadWrapper in project oxTrust by GluuFederation.
the class UpdateTrustRelationshipAction method add.
public String add() {
if (this.trustRelationship != null) {
return OxTrustConstants.RESULT_SUCCESS;
}
this.update = false;
this.trustRelationship = new GluuSAMLTrustRelationship();
this.trustRelationship.setMaxRefreshDelay("PT8H");
this.fileWrapper = new FileUploadWrapper();
this.trustRelationship.setOwner(organizationService.getOrganization().getDn());
boolean initActionsResult = initActions();
if (!initActionsResult) {
return OxTrustConstants.RESULT_FAILURE;
}
return OxTrustConstants.RESULT_SUCCESS;
}
use of org.xdi.util.io.FileUploadWrapper in project oxTrust by GluuFederation.
the class UpdateTrustRelationshipAction method update.
public String update() {
if (this.trustRelationship != null) {
return OxTrustConstants.RESULT_SUCCESS;
}
this.update = true;
try {
this.trustRelationship = trustService.getRelationshipByInum(inum);
} catch (LdapMappingException ex) {
log.error("Failed to find trust relationship {}", ex, inum);
}
if (this.trustRelationship == null) {
return OxTrustConstants.RESULT_FAILURE;
}
this.fileWrapper = new FileUploadWrapper();
this.fileWrapper.setFileName(this.trustRelationship.getSpMetaDataFN());
boolean initActionsResult = initActions();
if (!initActionsResult) {
return OxTrustConstants.RESULT_FAILURE;
}
return OxTrustConstants.RESULT_SUCCESS;
}
use of org.xdi.util.io.FileUploadWrapper 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) {
ex.printStackTrace();
return null;
}
FileUploadWrapper tmpfileWrapper = new FileUploadWrapper();
tmpfileWrapper.setStream(is);
return saveSpMetadataFile(spMetadataFileName, tmpfileWrapper.getStream());
}
use of org.xdi.util.io.FileUploadWrapper in project oxTrust by GluuFederation.
the class Shibboleth3ConfService method saveMetadataFile.
public boolean saveMetadataFile(String spMetaDataURL, String metadataFileName) {
if (StringHelper.isEmpty(spMetaDataURL)) {
return false;
}
String metadataFileContent = HTTPFileDownloader.getResource(spMetaDataURL, "application/xml, text/xml", null, null);
if (StringHelper.isEmpty(metadataFileContent)) {
return false;
}
// Save new file
ByteArrayInputStream is;
try {
byte[] metadataFileContentBytes = metadataFileContent.getBytes("UTF-8");
is = new ByteArrayInputStream(metadataFileContentBytes);
} catch (UnsupportedEncodingException ex) {
ex.printStackTrace();
return false;
}
FileUploadWrapper tmpfileWrapper = new FileUploadWrapper();
tmpfileWrapper.setStream(is);
return saveMetadataFile(metadataFileName, tmpfileWrapper.getStream());
}
Aggregations