Search in sources :

Example 1 with GluuConfiguration

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

the class ManagePersonAuthenticationAction method modifyImpl.

public String modifyImpl() {
    if (this.initialized) {
        return OxTrustConstants.RESULT_SUCCESS;
    }
    try {
        GluuConfiguration configuration = configurationService.getConfiguration();
        if (configuration == null) {
            return OxTrustConstants.RESULT_FAILURE;
        }
        this.passportEnable = configuration.isPassportEnabled();
        this.customScripts = customScriptService.findCustomScripts(Arrays.asList(CustomScriptType.PERSON_AUTHENTICATION), "displayName", "oxLevel", "oxEnabled");
        List<OxIDPAuthConf> list = getIDPAuthConfOrNull(configuration);
        this.sourceConfigs = new ArrayList<GluuLdapConfiguration>();
        if (list != null) {
            for (OxIDPAuthConf oxIDPAuthConf : list) {
                GluuLdapConfiguration oxldapConfig = oxIDPAuthConf.getConfig();
                this.sourceConfigs.add(oxldapConfig);
            }
        }
        getAuthenticationRecaptcha();
        this.authenticationMode = configuration.getAuthenticationMode();
        this.oxTrustAuthenticationMode = configuration.getOxTrustAuthenticationMode();
    } catch (Exception ex) {
        log.error("Failed to load configuration configuration", ex);
        return OxTrustConstants.RESULT_FAILURE;
    }
    this.initialized = true;
    return OxTrustConstants.RESULT_SUCCESS;
}
Also used : OxIDPAuthConf(org.gluu.oxtrust.model.OxIDPAuthConf) GluuConfiguration(org.gluu.oxtrust.model.GluuConfiguration) GluuLdapConfiguration(org.gluu.model.ldap.GluuLdapConfiguration) BasePersistenceException(org.gluu.persist.exception.BasePersistenceException) EncryptionException(org.gluu.util.security.StringEncrypter.EncryptionException) IOException(java.io.IOException)

Example 2 with GluuConfiguration

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

the class ManagePersonAuthenticationAction method save.

public String save() throws IOException {
    try {
        // Reload entry to include latest changes
        GluuConfiguration configuration = configurationService.getConfiguration();
        boolean updateAuthenticationMode = false;
        boolean updateOxTrustAuthenticationMode = false;
        String oldAuthName = getFirstConfigName(configuration.getOxIDPAuthentication());
        if (oldAuthName != null) {
            if (oldAuthName.equals(this.authenticationMode)) {
                updateAuthenticationMode = true;
            }
            if (oldAuthName.equals(this.oxTrustAuthenticationMode)) {
                updateOxTrustAuthenticationMode = true;
            }
        }
        updateAuthConf(configuration);
        String newAuthName = getFirstConfigName(configuration.getOxIDPAuthentication());
        String updatedAuthMode = updateAuthenticationMode ? newAuthName : this.authenticationMode;
        String updatedOxTrustAuthMode = updateOxTrustAuthenticationMode ? newAuthName : this.oxTrustAuthenticationMode;
        configuration.setAuthenticationMode(updatedAuthMode);
        configuration.setOxTrustAuthenticationMode(updatedOxTrustAuthMode);
        setAuthenticationRecaptcha();
        configuration.setPassportEnabled(passportEnable);
        configurationService.updateConfiguration(configuration);
    } catch (BasePersistenceException ex) {
        log.error("Failed to update configuration configuration", ex);
        facesMessages.add(FacesMessage.SEVERITY_ERROR, "Failed to update configuration");
        return OxTrustConstants.RESULT_FAILURE;
    }
    reset();
    facesMessages.add(FacesMessage.SEVERITY_INFO, facesMessages.evalResourceAsString("#{msgs['configuration.manageAuthentication.updateSucceed']}"));
    conversationService.endConversation();
    return OxTrustConstants.RESULT_SUCCESS;
}
Also used : BasePersistenceException(org.gluu.persist.exception.BasePersistenceException) GluuConfiguration(org.gluu.oxtrust.model.GluuConfiguration)

Example 3 with GluuConfiguration

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

the class UpdateOrganizationAction method modifyOrganization.

private String modifyOrganization() {
    if (this.organization != null) {
        return OxTrustConstants.RESULT_SUCCESS;
    }
    try {
        GluuOrganization tmpOrganization = organizationService.getOrganization();
        this.organization = new GluuOrganization();
        try {
            PropertyUtils.copyProperties(this.organization, tmpOrganization);
        } catch (Exception ex) {
            log.error("Failed to load organization", ex);
            this.organization = null;
        }
    } catch (BasePersistenceException ex) {
        log.error("Failed to load organization", ex);
    }
    if (this.organization == null) {
        return OxTrustConstants.RESULT_FAILURE;
    }
    this.loginPageCustomMessage = organizationService.getOrganizationCustomMessage(OxTrustConstants.CUSTOM_MESSAGE_LOGIN_PAGE);
    this.welcomePageCustomMessage = organizationService.getOrganizationCustomMessage(OxTrustConstants.CUSTOM_MESSAGE_WELCOME_PAGE);
    this.welcomeTitleText = organizationService.getOrganizationCustomMessage(OxTrustConstants.CUSTOM_MESSAGE_TITLE_TEXT);
    initOxAuthSetting();
    configurations = new ArrayList<GluuConfiguration>();
    configurations.addAll(configurationService.getConfigurations());
    return OxTrustConstants.RESULT_SUCCESS;
}
Also used : BasePersistenceException(org.gluu.persist.exception.BasePersistenceException) GluuOrganization(org.gluu.oxtrust.model.GluuOrganization) GluuConfiguration(org.gluu.oxtrust.model.GluuConfiguration) BasePersistenceException(org.gluu.persist.exception.BasePersistenceException) IOException(java.io.IOException)

Example 4 with GluuConfiguration

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

the class ConfigureLogViewerAction method updateConfiguration.

private void updateConfiguration() {
    GluuConfiguration updateConfiguration = configurationService.getConfiguration();
    try {
        updateConfiguration.setOxLogViewerConfig(logViewerConfiguration);
        updateConfiguration.setOxLogConfigLocation(oxTrustLogConfigLocation);
        configurationService.updateConfiguration(updateConfiguration);
        loggerService.resetLoggerConfigLocation();
    } catch (Exception ex) {
        log.error("Failed to save log viewer configuration '{}'", ex);
    }
}
Also used : GluuConfiguration(org.gluu.oxtrust.model.GluuConfiguration) IOException(java.io.IOException)

Example 5 with GluuConfiguration

use of org.gluu.oxtrust.model.GluuConfiguration 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.tomcatCertFN = orgInumFN + "-java.crt";
    this.idpCertFN = orgInumFN + "-shib.crt";
    try {
        GluuConfiguration configuration = configurationService.getConfiguration();
        if (configuration == null) {
            return OxTrustConstants.RESULT_FAILURE;
        }
        trustStoreConfiguration = configuration.getTrustStoreConfiguration();
        if (trustStoreConfiguration == null) {
            trustStoreConfiguration = new TrustStoreConfiguration();
        }
        trustStoreCertificates = configuration.getTrustStoreCertificates();
        if (trustStoreCertificates == null) {
            trustStoreCertificates = new ArrayList<TrustStoreCertificate>();
        }
    } catch (Exception ex) {
        log.error("Failed to load configuration configuration", ex);
        return OxTrustConstants.RESULT_FAILURE;
    }
    this.initialized = true;
    return OxTrustConstants.RESULT_SUCCESS;
}
Also used : TrustStoreConfiguration(org.gluu.oxtrust.model.cert.TrustStoreConfiguration) TrustStoreCertificate(org.gluu.oxtrust.model.cert.TrustStoreCertificate) GluuConfiguration(org.gluu.oxtrust.model.GluuConfiguration) GeneralSecurityException(java.security.GeneralSecurityException) BasePersistenceException(org.gluu.persist.exception.BasePersistenceException) IOException(java.io.IOException)

Aggregations

GluuConfiguration (org.gluu.oxtrust.model.GluuConfiguration)32 Date (java.util.Date)8 IOException (java.io.IOException)6 BasePersistenceException (org.gluu.persist.exception.BasePersistenceException)6 Operation (io.swagger.v3.oas.annotations.Operation)5 ApiResponses (io.swagger.v3.oas.annotations.responses.ApiResponses)5 ProtectedApi (org.gluu.oxtrust.service.filter.ProtectedApi)5 TrustStoreCertificate (org.gluu.oxtrust.model.cert.TrustStoreCertificate)4 Parameters (org.testng.annotations.Parameters)3 Test (org.testng.annotations.Test)3 X509Certificate (java.security.cert.X509Certificate)2 ArrayList (java.util.ArrayList)2 GET (javax.ws.rs.GET)2 PUT (javax.ws.rs.PUT)2 AppConfiguration (org.gluu.config.oxtrust.AppConfiguration)2 SmtpConfiguration (org.gluu.model.SmtpConfiguration)2 GluuOxTrustStat (org.gluu.oxtrust.model.GluuOxTrustStat)2 TrustStoreConfiguration (org.gluu.oxtrust.model.cert.TrustStoreConfiguration)2 X509CertificateShortInfo (org.gluu.oxtrust.util.X509CertificateShortInfo)2 File (java.io.File)1