Search in sources :

Example 1 with TrustStoreConfiguration

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;
}
Also used : TrustStoreConfiguration(org.gluu.oxtrust.model.cert.TrustStoreConfiguration) GluuAppliance(org.gluu.oxtrust.model.GluuAppliance) TrustStoreCertificate(org.gluu.oxtrust.model.cert.TrustStoreCertificate) GeneralSecurityException(java.security.GeneralSecurityException) LdapMappingException(org.gluu.site.ldap.persistence.exception.LdapMappingException) IOException(java.io.IOException)

Example 2 with TrustStoreConfiguration

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;
}
Also used : TrustStoreConfiguration(org.gluu.oxtrust.model.cert.TrustStoreConfiguration) GluuAppliance(org.gluu.oxtrust.model.GluuAppliance) TrustStoreCertificate(org.gluu.oxtrust.model.cert.TrustStoreCertificate) LdapMappingException(org.gluu.site.ldap.persistence.exception.LdapMappingException)

Aggregations

GluuAppliance (org.gluu.oxtrust.model.GluuAppliance)2 TrustStoreCertificate (org.gluu.oxtrust.model.cert.TrustStoreCertificate)2 TrustStoreConfiguration (org.gluu.oxtrust.model.cert.TrustStoreConfiguration)2 LdapMappingException (org.gluu.site.ldap.persistence.exception.LdapMappingException)2 IOException (java.io.IOException)1 GeneralSecurityException (java.security.GeneralSecurityException)1