use of org.gluu.site.ldap.persistence.exception.LdapMappingException 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.isUpdateApplianceStatus()) {
return;
}
GluuAppliance appliance;
try {
appliance = applianceService.getAppliance();
} catch (LdapMappingException ex) {
log.error("Failed to load current appliance", ex);
return;
}
// Set LDAP attributes
setLdapAttributes(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("Daily Appliance status update finished");
}
use of org.gluu.site.ldap.persistence.exception.LdapMappingException in project oxTrust by GluuFederation.
the class ManagePersonAuthenticationAction method save.
public String save() {
try {
// Reload entry to include latest changes
GluuAppliance appliance = applianceService.getAppliance();
boolean updateAuthenticationMode = false;
boolean updateOxTrustAuthenticationMode = false;
OxIDPAuthConf idpConf = getIDPAuthConfOrNull(appliance);
if (idpConf != null && idpConf.getName() != null) {
if (idpConf.getName().equals(this.authenticationMode)) {
updateAuthenticationMode = true;
}
if (idpConf.getName().equals(this.oxTrustAuthenticationMode)) {
updateOxTrustAuthenticationMode = true;
}
}
this.ldapConfig.updateStringsLists();
updateAuthConf(appliance);
String updatedAuthMode = updateAuthenticationMode ? this.ldapConfig.getConfigId() : this.authenticationMode;
String updatedOxTrustAuthMode = updateOxTrustAuthenticationMode ? this.ldapConfig.getConfigId() : this.oxTrustAuthenticationMode;
appliance.setAuthenticationMode(updatedAuthMode);
appliance.setOxTrustAuthenticationMode(updatedOxTrustAuthMode);
appliance.setPassportEnabled(passportEnable);
applianceService.updateAppliance(appliance);
ldapOxPassportConfiguration.setPassportConfigurations(ldapPassportConfigurations);
passportService.updateLdapOxPassportConfiguration(ldapOxPassportConfiguration);
} catch (LdapMappingException ex) {
log.error("Failed to update appliance configuration", ex);
facesMessages.add(FacesMessage.SEVERITY_ERROR, "Failed to update appliance");
return OxTrustConstants.RESULT_FAILURE;
}
reset();
return modify();
}
use of org.gluu.site.ldap.persistence.exception.LdapMappingException in project oxTrust by GluuFederation.
the class CacheRefreshTimer method removeTargetEntries.
private Pair<List<String>, List<String>> removeTargetEntries(LdapServerConnection inumDbServerConnection, LdapEntryManager targetLdapEntryManager, List<GluuSimplePerson> removedPersons, HashMap<String, GluuInumMap> inumInumMap) {
String runDate = ldapEntryManager.encodeGeneralizedTime(new Date(this.lastFinishedTime));
LdapEntryManager inumDbLdapEntryManager = inumDbServerConnection.getLdapEntryManager();
List<String> result1 = new ArrayList<String>();
List<String> result2 = new ArrayList<String>();
for (GluuSimplePerson removedPerson : removedPersons) {
String inum = removedPerson.getAttribute(OxTrustConstants.inum);
// Update GluuInumMap if it exist
GluuInumMap currentInumMap = inumInumMap.get(inum);
if (currentInumMap == null) {
log.warn("Can't find inum entry of person with DN: {}", removedPerson.getDn());
} else {
GluuInumMap removedInumMap = getMarkInumMapEntryAsRemoved(currentInumMap, runDate);
try {
inumDbLdapEntryManager.merge(removedInumMap);
result2.add(removedInumMap.getInum());
} catch (LdapMappingException ex) {
log.error("Failed to update entry with inum '{}' and DN: {}", ex, currentInumMap.getInum(), currentInumMap.getDn());
continue;
}
}
// Remove person from target server
try {
targetLdapEntryManager.removeWithSubtree(removedPerson.getDn());
result1.add(inum);
} catch (LdapMappingException ex) {
log.error("Failed to remove person entry with inum '{}' and DN: {}", ex, inum, removedPerson.getDn());
continue;
}
log.debug("Person with DN: '{}' removed from target server", removedPerson.getDn());
}
return new Pair<List<String>, List<String>>(result1, result2);
}
use of org.gluu.site.ldap.persistence.exception.LdapMappingException in project oxTrust by GluuFederation.
the class ScopeDescriptionDownloadAction method getScopeDescription.
private ScopeDescription getScopeDescription() {
try {
scopeDescriptionService.prepareScopeDescriptionBranch();
} catch (Exception ex) {
log.error("Failed to initialize download action", ex);
return null;
}
log.debug("Loading UMA scope description '{}'", this.scopeId);
ScopeDescription scopeDescription;
try {
List<ScopeDescription> scopeDescriptions = scopeDescriptionService.findScopeDescriptionsById(this.scopeId);
if (scopeDescriptions.size() != 1) {
log.error("Failed to find scope description '{}'. Found: '{}'", this.scopeId, scopeDescriptions.size());
return null;
}
scopeDescription = scopeDescriptions.get(0);
} catch (LdapMappingException ex) {
log.error("Failed to find scope description '{}'", ex, this.scopeId);
return null;
}
return scopeDescription;
}
use of org.gluu.site.ldap.persistence.exception.LdapMappingException 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");
}
Aggregations