Search in sources :

Example 16 with GluuAppliance

use of org.gluu.oxtrust.model.GluuAppliance in project oxTrust by GluuFederation.

the class ApplicationFactory method getSmtpConfiguration.

@Produces
@ApplicationScoped
public SmtpConfiguration getSmtpConfiguration() {
    GluuAppliance appliance = applianceService.getAppliance();
    SmtpConfiguration smtpConfiguration = appliance.getSmtpConfiguration();
    if (smtpConfiguration == null) {
        return null;
    }
    String password = smtpConfiguration.getPassword();
    if (StringHelper.isNotEmpty(password)) {
        try {
            smtpConfiguration.setPasswordDecrypted(encryptionService.decrypt(password));
        } catch (EncryptionException ex) {
            log.error("Failed to decript SMTP user password", ex);
        }
    }
    return smtpConfiguration;
}
Also used : GluuAppliance(org.gluu.oxtrust.model.GluuAppliance) SmtpConfiguration(org.xdi.model.SmtpConfiguration) EncryptionException(org.xdi.util.security.StringEncrypter.EncryptionException) Produces(javax.enterprise.inject.Produces) ApplicationScoped(javax.enterprise.context.ApplicationScoped)

Example 17 with GluuAppliance

use of org.gluu.oxtrust.model.GluuAppliance in project oxTrust by GluuFederation.

the class PassportUmaProtectionService method isPassportEnabled.

private boolean isPassportEnabled() {
    GluuAppliance appliance = applianceService.getAppliance();
    GluuBoolean passportEnbaled = appliance.getPassportEnabled();
    return GluuBoolean.ENABLED.equals(passportEnbaled) || GluuBoolean.TRUE.equals(passportEnbaled);
}
Also used : GluuAppliance(org.gluu.oxtrust.model.GluuAppliance) GluuBoolean(org.xdi.ldap.model.GluuBoolean)

Example 18 with GluuAppliance

use of org.gluu.oxtrust.model.GluuAppliance in project oxTrust by GluuFederation.

the class LoggerService method setExternalLoggerConfig.

private boolean setExternalLoggerConfig() {
    GluuAppliance updateAppliance = applianceService.getAppliance();
    if (StringUtils.isEmpty(updateAppliance.getOxLogConfigLocation())) {
        return false;
    }
    File log4jFile = new File(updateAppliance.getOxLogConfigLocation());
    if (!log4jFile.exists())
        return false;
    LoggerContext loggerContext = LoggerContext.getContext(false);
    loggerContext.setConfigLocation(log4jFile.toURI());
    loggerContext.reconfigure();
    return true;
}
Also used : GluuAppliance(org.gluu.oxtrust.model.GluuAppliance) File(java.io.File) LoggerContext(org.apache.logging.log4j.core.LoggerContext)

Example 19 with GluuAppliance

use of org.gluu.oxtrust.model.GluuAppliance in project oxTrust by GluuFederation.

the class JsonConfigurationService method saveOxMemCacheConfiguration.

public boolean saveOxMemCacheConfiguration(CacheConfiguration cachedConfiguration) {
    GluuAppliance gluuAppliance = applianceService.getAppliance();
    gluuAppliance.setCacheConfiguration(cachedConfiguration);
    applianceService.updateAppliance(gluuAppliance);
    return true;
}
Also used : GluuAppliance(org.gluu.oxtrust.model.GluuAppliance)

Example 20 with GluuAppliance

use of org.gluu.oxtrust.model.GluuAppliance 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 (LdapMappingException 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 (LdapMappingException 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 (LdapMappingException ex) {
            log.error("Failed to update appliance at central server", ex);
            return;
        }
    }
    log.debug("Appliance status update finished");
}
Also used : GluuAppliance(org.gluu.oxtrust.model.GluuAppliance) AppConfiguration(org.xdi.config.oxtrust.AppConfiguration) LdapMappingException(org.gluu.site.ldap.persistence.exception.LdapMappingException) LdapMappingException(org.gluu.site.ldap.persistence.exception.LdapMappingException) ParseException(java.text.ParseException) IOException(java.io.IOException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) Date(java.util.Date)

Aggregations

GluuAppliance (org.gluu.oxtrust.model.GluuAppliance)36 Date (java.util.Date)8 LdapMappingException (org.gluu.site.ldap.persistence.exception.LdapMappingException)7 IOException (java.io.IOException)5 GluuCustomPerson (org.gluu.oxtrust.model.GluuCustomPerson)5 GluuCustomAttribute (org.gluu.oxtrust.model.GluuCustomAttribute)4 File (java.io.File)3 SimpleDateFormat (java.text.SimpleDateFormat)3 ArrayList (java.util.ArrayList)3 BaseTest (org.gluu.oxtrust.action.test.BaseTest)3 PasswordResetRequest (org.gluu.oxtrust.model.PasswordResetRequest)3 TrustStoreCertificate (org.gluu.oxtrust.model.cert.TrustStoreCertificate)3 Test (org.testng.annotations.Test)3 ParseException (java.text.ParseException)2 Calendar (java.util.Calendar)2 AuthenticationFailedException (javax.mail.AuthenticationFailedException)2 MessagingException (javax.mail.MessagingException)2 OxIDPAuthConf (org.gluu.oxtrust.model.OxIDPAuthConf)2 TrustStoreConfiguration (org.gluu.oxtrust.model.cert.TrustStoreConfiguration)2 MailUtils (org.gluu.oxtrust.util.MailUtils)2