Search in sources :

Example 1 with SmtpConfiguration

use of org.xdi.model.SmtpConfiguration 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 2 with SmtpConfiguration

use of org.xdi.model.SmtpConfiguration in project oxAuth 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.xdi.oxauth.model.appliance.GluuAppliance) SmtpConfiguration(org.xdi.model.SmtpConfiguration) EncryptionException(org.xdi.util.security.StringEncrypter.EncryptionException) Produces(javax.enterprise.inject.Produces) ApplicationScoped(javax.enterprise.context.ApplicationScoped)

Example 3 with SmtpConfiguration

use of org.xdi.model.SmtpConfiguration in project oxTrust by GluuFederation.

the class UpdateOrganizationAction method updateSmptConfiguration.

private void updateSmptConfiguration(GluuAppliance appliance) {
    SmtpConfiguration smtpConfiguration = new SmtpConfiguration();
    smtpConfiguration.setHost(appliance.getSmtpHost());
    smtpConfiguration.setPort(StringHelper.toInteger(appliance.getSmtpPort(), 25));
    smtpConfiguration.setRequiresSsl(StringHelper.toBoolean(appliance.getSmtpRequiresSsl(), false));
    smtpConfiguration.setFromName(appliance.getSmtpFromName());
    smtpConfiguration.setFromEmailAddress(appliance.getSmtpFromEmailAddress());
    smtpConfiguration.setRequiresAuthentication(StringHelper.toBoolean(appliance.getSmtpRequiresAuthentication(), false));
    smtpConfiguration.setUserName(appliance.getSmtpUserName());
    smtpConfiguration.setPassword(appliance.getSmtpPassword());
    appliance.setSmtpConfiguration(smtpConfiguration);
}
Also used : SmtpConfiguration(org.xdi.model.SmtpConfiguration)

Aggregations

SmtpConfiguration (org.xdi.model.SmtpConfiguration)3 ApplicationScoped (javax.enterprise.context.ApplicationScoped)2 Produces (javax.enterprise.inject.Produces)2 EncryptionException (org.xdi.util.security.StringEncrypter.EncryptionException)2 GluuAppliance (org.gluu.oxtrust.model.GluuAppliance)1 GluuAppliance (org.xdi.oxauth.model.appliance.GluuAppliance)1