use of org.gluu.oxtrust.model.GluuConfiguration in project oxTrust by GluuFederation.
the class SmtpConfigurationWebResource method updateSmtpConfiguration.
@PUT
@Operation(summary = "Update smtp configuration", description = "Update smtp configuration")
@ApiResponses(value = { @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = SmtpConfiguration.class)), description = Constants.RESULT_SUCCESS), @ApiResponse(responseCode = "404", description = "Not found"), @ApiResponse(responseCode = "500", description = "Server error") })
@ProtectedApi(scopes = { WRITE_ACCESS })
public Response updateSmtpConfiguration(SmtpConfiguration smtpConfiguration) {
try {
Preconditions.checkNotNull(smtpConfiguration, "Attempt to update null smtpConfiguration");
configurationService.encryptedSmtpPassword(smtpConfiguration);
GluuConfiguration configurationUpdate = configurationService.getConfiguration();
configurationUpdate.setSmtpConfiguration(smtpConfiguration);
configurationService.updateConfiguration(configurationUpdate);
return Response.ok(configurationService.getConfiguration().getSmtpConfiguration()).build();
} catch (Exception e) {
log(logger, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
}
}
use of org.gluu.oxtrust.model.GluuConfiguration in project oxTrust by GluuFederation.
the class JsonConfigurationService method saveDocumentStoreConfiguration.
public boolean saveDocumentStoreConfiguration(DocumentStoreConfiguration documentStoreConfiguration) {
GluuConfiguration gluuConfiguration = configurationService.getConfiguration();
gluuConfiguration.setDocumentStoreConfiguration(documentStoreConfiguration);
configurationService.updateConfiguration(gluuConfiguration);
return true;
}
use of org.gluu.oxtrust.model.GluuConfiguration in project oxTrust by GluuFederation.
the class CertificateManagementAction method updateTableView.
/**
* Load and process certificate lists.
*
* Set highlight for obsolete certificates. Apply search pattern.
*/
private void updateTableView() {
try {
trustStoreCertificates = new ArrayList<X509CertificateShortInfo>();
GluuConfiguration configuration = configurationService.getConfiguration();
List<TrustStoreCertificate> trustStoreCertificatesList = configuration.getTrustStoreCertificates();
if (trustStoreCertificatesList != null) {
for (TrustStoreCertificate trustStoreCertificate : trustStoreCertificatesList) {
try {
X509Certificate[] certs = SSLService.loadCertificates(trustStoreCertificate.getCertificate().getBytes());
for (X509Certificate cert : certs) {
X509CertificateShortInfo entry = new X509CertificateShortInfo(trustStoreCertificate.getName(), cert);
trustStoreCertificates.add(entry);
}
} catch (Exception e) {
log.error("Certificate load exception", e);
}
}
}
} catch (Exception e) {
log.error("Load trustStoreCertificates configuration exception", e);
}
try {
// load internalCertificates
internalCertificates = new ArrayList<X509CertificateShortInfo>();
try {
X509Certificate[] openDJCerts = SSLService.loadCertificates(new FileInputStream(OPENDJ_CERTIFICATE_FILE));
for (X509Certificate openDJCert : openDJCerts) {
internalCertificates.add(new X509CertificateShortInfo(OPENDJ_CERTIFICATE_FILE, "OpenDJ SSL", openDJCert));
}
} catch (Exception e) {
log.warn("OPENDJ certificate load exception");
}
try {
X509Certificate[] httpdCerts = SSLService.loadCertificates(new FileInputStream(HTTPD_CERTIFICATE_FILE));
for (X509Certificate httpdCert : httpdCerts) {
internalCertificates.add(new X509CertificateShortInfo(HTTPD_CERTIFICATE_FILE, "HTTPD SSL", httpdCert));
}
} catch (Exception e) {
log.warn("HTTPD Certificate load exception");
}
try {
X509Certificate[] idpSigingCerts = SSLService.loadCertificates(new FileInputStream(IDP_SIGNING_CERTIFICATE_FILE));
for (X509Certificate idpSigingCert : idpSigingCerts) {
internalCertificates.add(new X509CertificateShortInfo(IDP_SIGNING_CERTIFICATE_FILE, "IDP SIGNING", idpSigingCert));
}
} catch (Exception e) {
log.warn("IDP SIGNING certificate load exception");
}
try {
X509Certificate[] idpEncryptionCerts = SSLService.loadCertificates(new FileInputStream(IDP_ENCRYPT_CERTIFICATE_FILE));
for (X509Certificate idpEncryptionCert : idpEncryptionCerts) {
internalCertificates.add(new X509CertificateShortInfo(IDP_ENCRYPT_CERTIFICATE_FILE, "IDP ENCRYPTION", idpEncryptionCert));
}
} catch (Exception e) {
log.warn("IDP ENCRYPTION certificate load exception");
}
try {
X509Certificate[] idpEncryptionCerts = SSLService.loadCertificates(new FileInputStream(OPENLDAP_CERTIFICATE_FILE));
for (X509Certificate idpEncryptionCert : idpEncryptionCerts) {
internalCertificates.add(new X509CertificateShortInfo(OPENLDAP_CERTIFICATE_FILE, "OpenLDAP ENCRYPTION", idpEncryptionCert));
}
} catch (Exception e) {
log.warn("OpenLDAP certificate load exception");
}
} catch (Exception e) {
log.error("Load internalCertificates configuration exception", e);
}
}
use of org.gluu.oxtrust.model.GluuConfiguration in project oxTrust by GluuFederation.
the class ConfigurationStatusAction method checkHealth.
public String checkHealth() {
GluuConfiguration configuration = configurationService.getConfiguration();
Date lastUpdateDateTime = configuration.getLastUpdate();
long lastUpdate = 0;
if (lastUpdateDateTime != null) {
lastUpdate = lastUpdateDateTime.getTime();
}
long currentTime = System.currentTimeMillis();
log.debug("lastUpdate: '{}', currentTime: '{}'", lastUpdate, currentTime);
long timeSinceLastUpdate = (currentTime - lastUpdate) / 1000;
if (timeSinceLastUpdate >= 0 && timeSinceLastUpdate < 100) {
this.setHealth("OK");
} else {
this.setHealth("FAIL");
}
log.debug("Set status '{}'", this.getHealth());
return OxTrustConstants.RESULT_SUCCESS;
}
use of org.gluu.oxtrust.model.GluuConfiguration in project oxTrust by GluuFederation.
the class ConfigureCacheRefreshAction method updateConfiguration.
private void updateConfiguration() {
GluuConfiguration configuration = configurationService.getConfiguration();
configuration.setVdsCacheRefreshEnabled(this.configuration.isVdsCacheRefreshEnabled());
configuration.setVdsCacheRefreshPollingInterval(this.configuration.getVdsCacheRefreshPollingInterval());
configuration.setCacheRefreshServerIpAddress(this.configuration.getCacheRefreshServerIpAddress());
configurationService.updateConfiguration(configuration);
}
Aggregations