Search in sources :

Example 6 with AppConfiguration

use of org.xdi.config.oxtrust.AppConfiguration in project oxTrust by GluuFederation.

the class JsonConfigurationAction method getProtectedOxTrustappConfiguration.

private String getProtectedOxTrustappConfiguration(AppConfiguration oxTrustappConfiguration) {
    try {
        AppConfiguration resultOxTrustappConfiguration = (AppConfiguration) BeanUtils.cloneBean(oxTrustappConfiguration);
        resultOxTrustappConfiguration.setSvnConfigurationStorePassword(HIDDEN_PASSWORD_TEXT);
        resultOxTrustappConfiguration.setKeystorePassword(HIDDEN_PASSWORD_TEXT);
        resultOxTrustappConfiguration.setIdpSecurityKeyPassword(HIDDEN_PASSWORD_TEXT);
        resultOxTrustappConfiguration.setIdpBindPassword(HIDDEN_PASSWORD_TEXT);
        resultOxTrustappConfiguration.setCaCertsPassphrase(HIDDEN_PASSWORD_TEXT);
        resultOxTrustappConfiguration.setOxAuthClientPassword(HIDDEN_PASSWORD_TEXT);
        return jsonService.objectToJson(resultOxTrustappConfiguration);
    } catch (Exception ex) {
        log.error("Failed to prepare JSON from appConfiguration: '{}'", oxTrustappConfiguration, ex);
    }
    return null;
}
Also used : AppConfiguration(org.xdi.config.oxtrust.AppConfiguration) EncryptionException(org.xdi.util.security.StringEncrypter.EncryptionException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 7 with AppConfiguration

use of org.xdi.config.oxtrust.AppConfiguration in project oxTrust by GluuFederation.

the class JsonConfigurationAction method convertToOxTrustappConfiguration.

private AppConfiguration convertToOxTrustappConfiguration(String oxTrustappConfigurationJson) {
    try {
        AppConfiguration resultOxTrustappConfiguration = jsonService.jsonToObject(oxTrustappConfigurationJson, AppConfiguration.class);
        processPasswordProperty(this.oxTrustappConfiguration, resultOxTrustappConfiguration, "svnConfigurationStorePassword");
        processPasswordProperty(this.oxTrustappConfiguration, resultOxTrustappConfiguration, "keystorePassword");
        processPasswordProperty(this.oxTrustappConfiguration, resultOxTrustappConfiguration, "idpSecurityKeyPassword");
        processPasswordProperty(this.oxTrustappConfiguration, resultOxTrustappConfiguration, "idpBindPassword");
        processPasswordProperty(this.oxTrustappConfiguration, resultOxTrustappConfiguration, "caCertsPassphrase");
        processPasswordProperty(this.oxTrustappConfiguration, resultOxTrustappConfiguration, "oxAuthClientPassword");
        // jsonConfigurationService.processScimTestModeIsTrue(this.oxTrustappConfiguration, resultOxTrustappConfiguration);
        return resultOxTrustappConfiguration;
    } catch (Exception ex) {
        log.error("Failed to prepare appConfiguration from JSON: '{}'", oxTrustappConfigurationJson, ex);
    }
    return null;
}
Also used : AppConfiguration(org.xdi.config.oxtrust.AppConfiguration) EncryptionException(org.xdi.util.security.StringEncrypter.EncryptionException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 8 with AppConfiguration

use of org.xdi.config.oxtrust.AppConfiguration in project oxTrust by GluuFederation.

the class StatusCheckerTimer method processInt.

/**
 * Gather periodically site and server status
 *
 * @param when
 *            Date
 * @param interval
 *            Interval
 */
private void processInt() {
    log.debug("Starting update of appliance status");
    AppConfiguration appConfiguration = configurationFactory.getAppConfiguration();
    if (!appConfiguration.isUpdateApplianceStatus()) {
        return;
    }
    GluuAppliance appliance;
    try {
        appliance = applianceService.getAppliance();
    } catch (BaseMappingException ex) {
        log.error("Failed to load current appliance", ex);
        return;
    }
    // Execute facter and update appliance attributes
    setFactorAttributes(appliance);
    // Execute df and update appliance attributes
    setDfAttributes(appliance);
    // Set HTTPD attributes
    setHttpdAttributes(appliance);
    try {
        setCertificateExpiryAttributes(appliance);
    } catch (Exception ex) {
        log.error("Failed to check certificate expiration", ex);
    }
    // setVDSAttributes(appliance);
    Date currentDateTime = new Date();
    appliance.setLastUpdate(currentDateTime);
    try {
        applianceService.updateAppliance(appliance);
    } catch (BaseMappingException ex) {
        log.error("Failed to update current appliance", ex);
        return;
    }
    if (centralLdapService.isUseCentralServer()) {
        try {
            GluuAppliance tmpAppliance = new GluuAppliance();
            tmpAppliance.setDn(appliance.getDn());
            boolean existAppliance = centralLdapService.containsAppliance(tmpAppliance);
            if (existAppliance) {
                centralLdapService.updateAppliance(appliance);
            } else {
                centralLdapService.addAppliance(appliance);
            }
        } catch (BaseMappingException ex) {
            log.error("Failed to update appliance at central server", ex);
            return;
        }
    }
    log.debug("Appliance status update finished");
}
Also used : BaseMappingException(org.gluu.persist.exception.mapping.BaseMappingException) GluuAppliance(org.gluu.oxtrust.model.GluuAppliance) AppConfiguration(org.xdi.config.oxtrust.AppConfiguration) BaseMappingException(org.gluu.persist.exception.mapping.BaseMappingException) ParseException(java.text.ParseException) IOException(java.io.IOException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) Date(java.util.Date)

Aggregations

AppConfiguration (org.xdi.config.oxtrust.AppConfiguration)8 BaseMappingException (org.gluu.persist.exception.mapping.BaseMappingException)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 Date (java.util.Date)2 GluuAppliance (org.gluu.oxtrust.model.GluuAppliance)2 EncryptionException (org.xdi.util.security.StringEncrypter.EncryptionException)2 File (java.io.File)1 IOException (java.io.IOException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 ParseException (java.text.ParseException)1 ConfigurationException (org.xdi.exception.ConfigurationException)1