Search in sources :

Example 1 with AppConfiguration

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

the class JsonConfigurationAction method getProtectedOxTrustappConfiguration.

private String getProtectedOxTrustappConfiguration(AppConfiguration oxTrustappConfiguration) {
    if (oxTrustappConfiguration != null) {
        try {
            AppConfiguration resultOxTrustappConfiguration = (AppConfiguration) BeanUtils.cloneBean(oxTrustappConfiguration);
            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;
    }
    return null;
}
Also used : AppConfiguration(org.gluu.config.oxtrust.AppConfiguration) EncryptionException(org.gluu.util.security.StringEncrypter.EncryptionException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 2 with AppConfiguration

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

the class StatusCheckerDaily method processInt.

/**
 * Gather periodically site and server status
 *
 * @param when
 *            Date
 * @param interval
 *            Interval
 */
private void processInt() {
    log.debug("Starting daily status checker");
    AppConfiguration appConfiguration = configurationFactory.getAppConfiguration();
    if (!appConfiguration.isUpdateStatus()) {
        return;
    }
    log.debug("Getting data from ldap");
    GluuConfiguration configuration = configurationService.getConfiguration();
    GluuOxTrustStat oxTrustStat = configurationService.getOxtrustStat();
    oxTrustStat.setGroupCount(String.valueOf(groupService.countGroups()));
    oxTrustStat.setPersonCount(String.valueOf(personService.countPersons()));
    Date currentDateTime = new Date();
    configuration.setLastUpdate(currentDateTime);
    configurationService.updateConfiguration(configuration);
    configurationService.updateOxtrustStat(oxTrustStat);
    log.debug("Daily Configuration status update finished");
}
Also used : AppConfiguration(org.gluu.config.oxtrust.AppConfiguration) GluuOxTrustStat(org.gluu.oxtrust.model.GluuOxTrustStat) GluuConfiguration(org.gluu.oxtrust.model.GluuConfiguration) Date(java.util.Date)

Example 3 with AppConfiguration

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

the class StatusCheckerTimer method setHttpdAttributes.

private void setHttpdAttributes(ConfigurationStatus configuration) {
    log.debug("Setting httpd attributes");
    AppConfiguration appConfiguration = configurationFactory.getAppConfiguration();
    String page = getHttpdPage(appConfiguration.getIdpUrl(), OxTrustConstants.HTTPD_TEST_PAGE_NAME);
    configuration.setGluuHttpStatus(Boolean.toString(OxTrustConstants.HTTPD_TEST_PAGE_CONTENT.equals(page)));
}
Also used : AppConfiguration(org.gluu.config.oxtrust.AppConfiguration)

Example 4 with AppConfiguration

use of org.gluu.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 configuration status");
    AppConfiguration appConfiguration = configurationFactory.getAppConfiguration();
    if (!appConfiguration.isUpdateStatus()) {
        log.debug("isUpdateStatus");
        return;
    }
    ConfigurationStatus configurationStatus = new ConfigurationStatus();
    OxtrustStat oxtrustStatObject = new OxtrustStat();
    oxtrustStatObject.setGroupCount(String.valueOf(groupService.countGroups()));
    oxtrustStatObject.setPersonCount(String.valueOf(personService.countPersons()));
    log.debug("Setting FactorAttributes");
    FacterData facterData = getFacterData();
    configurationStatus.setHostname(facterData.getHostname());
    oxtrustStatObject.setIpAddress(facterData.getIpaddress());
    oxtrustStatObject.setLoadAvg(facterData.getLoadAverage());
    oxtrustStatObject.setSystemUptime(facterData.getUptime());
    oxtrustStatObject.setFreeDiskSpace(facterData.getFreeDiskSpace());
    oxtrustStatObject.setFreeMemory(facterData.getMemoryfree());
    setHttpdAttributes(configurationStatus);
    try {
        setCertificateExpiryAttributes(configurationStatus);
    } catch (Exception ex) {
        log.error("Failed to check certificate expiration", ex);
    }
    GluuConfiguration configuration = configurationService.getConfiguration();
    GluuOxTrustStat gluuOxTrustStat = configurationService.getOxtrustStat();
    try {
        BeanUtils.copyProperties(configuration, configurationStatus);
        BeanUtils.copyProperties(gluuOxTrustStat, oxtrustStatObject);
    } catch (Exception ex) {
        log.error("Failed to copy status attributes", ex);
    }
    Date currentDateTime = new Date();
    configuration.setLastUpdate(currentDateTime);
    configurationService.updateConfiguration(configuration);
    configurationService.updateOxtrustStat(gluuOxTrustStat);
    log.debug("Configuration status update finished");
}
Also used : AppConfiguration(org.gluu.config.oxtrust.AppConfiguration) ConfigurationStatus(org.gluu.oxtrust.model.status.ConfigurationStatus) GluuOxTrustStat(org.gluu.oxtrust.model.GluuOxTrustStat) FacterData(org.gluu.oxtrust.model.FacterData) OxtrustStat(org.gluu.oxtrust.model.status.OxtrustStat) GluuConfiguration(org.gluu.oxtrust.model.GluuConfiguration) IOException(java.io.IOException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) Date(java.util.Date)

Example 5 with AppConfiguration

use of org.gluu.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, "keystorePassword");
        processPasswordProperty(this.oxTrustappConfiguration, resultOxTrustappConfiguration, "idpSecurityKeyPassword");
        processPasswordProperty(this.oxTrustappConfiguration, resultOxTrustappConfiguration, "idpBindPassword");
        processPasswordProperty(this.oxTrustappConfiguration, resultOxTrustappConfiguration, "caCertsPassphrase");
        processPasswordProperty(this.oxTrustappConfiguration, resultOxTrustappConfiguration, "oxAuthClientPassword");
        // resultOxTrustappConfiguration);
        return resultOxTrustappConfiguration;
    } catch (Exception ex) {
        log.error("Failed to prepare appConfiguration from JSON: '{}'", oxTrustappConfigurationJson, ex);
    }
    return null;
}
Also used : AppConfiguration(org.gluu.config.oxtrust.AppConfiguration) EncryptionException(org.gluu.util.security.StringEncrypter.EncryptionException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

AppConfiguration (org.gluu.config.oxtrust.AppConfiguration)5 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 Date (java.util.Date)2 GluuConfiguration (org.gluu.oxtrust.model.GluuConfiguration)2 GluuOxTrustStat (org.gluu.oxtrust.model.GluuOxTrustStat)2 EncryptionException (org.gluu.util.security.StringEncrypter.EncryptionException)2 IOException (java.io.IOException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 FacterData (org.gluu.oxtrust.model.FacterData)1 ConfigurationStatus (org.gluu.oxtrust.model.status.ConfigurationStatus)1 OxtrustStat (org.gluu.oxtrust.model.status.OxtrustStat)1