use of org.gluu.oxtrust.model.cert.TrustStoreConfiguration in project oxTrust by GluuFederation.
the class ManageCertificateAction method init.
public String init() {
if (this.initialized) {
return OxTrustConstants.RESULT_SUCCESS;
}
this.wereAnyChanges = false;
this.certsMmanagePossible = prepareTempWorkspace();
this.orgInumFN = StringHelper.removePunctuation(organizationService.getOrganizationInum());
this.tomcatCertFN = orgInumFN + "-java.crt";
this.idpCertFN = orgInumFN + "-shib.crt";
try {
GluuAppliance appliance = applianceService.getAppliance();
if (appliance == null) {
return OxTrustConstants.RESULT_FAILURE;
}
trustStoreConfiguration = appliance.getTrustStoreConfiguration();
if (trustStoreConfiguration == null) {
trustStoreConfiguration = new TrustStoreConfiguration();
}
trustStoreCertificates = appliance.getTrustStoreCertificates();
if (trustStoreCertificates == null) {
trustStoreCertificates = new ArrayList<TrustStoreCertificate>();
}
} catch (Exception ex) {
log.error("Failed to load appliance configuration", ex);
return OxTrustConstants.RESULT_FAILURE;
}
this.initialized = true;
return OxTrustConstants.RESULT_SUCCESS;
}
use of org.gluu.oxtrust.model.cert.TrustStoreConfiguration in project oxTrust by GluuFederation.
the class ManageCertificateAction method updateTrustCertificates.
private boolean updateTrustCertificates() {
try {
// Reload entry to include latest changes
GluuAppliance tmpAppliance = applianceService.getAppliance();
TrustStoreConfiguration currTrustStoreConfiguration = tmpAppliance.getTrustStoreConfiguration();
List<TrustStoreCertificate> currTrustStoreCertificates = tmpAppliance.getTrustStoreCertificates();
if (currTrustStoreCertificates == null) {
currTrustStoreCertificates = new ArrayList<TrustStoreCertificate>(0);
}
if (!trustStoreConfiguration.equals(currTrustStoreConfiguration) || !trustStoreCertificates.equals(currTrustStoreCertificates)) {
this.wereAnyChanges = true;
}
tmpAppliance.setTrustStoreConfiguration(trustStoreConfiguration);
if (trustStoreCertificates.size() == 0) {
tmpAppliance.setTrustStoreCertificates(null);
} else {
tmpAppliance.setTrustStoreCertificates(trustStoreCertificates);
}
applianceService.updateAppliance(tmpAppliance);
} catch (LdapMappingException ex) {
log.error("Failed to update appliance configuration", ex);
facesMessages.add(FacesMessage.SEVERITY_ERROR, "Failed to update appliance");
return false;
}
return true;
}
Aggregations