use of org.gluu.persist.exception.mapping.BaseMappingException 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 (BaseMappingException 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 (BaseMappingException 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 (BaseMappingException ex) {
log.error("Failed to update appliance at central server", ex);
return;
}
}
log.debug("Daily Appliance status update finished");
}
use of org.gluu.persist.exception.mapping.BaseMappingException in project oxTrust by GluuFederation.
the class UpdateClientAction method add.
public String add() throws Exception {
if (this.client != null) {
return OxTrustConstants.RESULT_SUCCESS;
}
this.update = false;
this.client = new OxAuthClient();
try {
this.loginUris = getNonEmptyStringList(client.getOxAuthRedirectURIs());
this.logoutUris = getNonEmptyStringList(client.getOxAuthPostLogoutRedirectURIs());
this.clientlogoutUris = getNonEmptyStringList(client.getLogoutUri());
this.scopes = getInitialScopeDisplayNameEntiries();
this.responseTypes = getInitialResponseTypes();
this.grantTypes = getInitialGrantTypes();
this.contacts = getNonEmptyStringList(client.getContacts());
this.defaultAcrValues = getNonEmptyStringList(client.getDefaultAcrValues());
this.requestUris = getNonEmptyStringList(client.getRequestUris());
this.authorizedOrigins = getNonEmptyStringList(client.getAuthorizedOrigins());
this.claimRedirectURIList = getNonEmptyStringList(client.getClaimRedirectURI());
} catch (BaseMappingException ex) {
log.error("Failed to prepare lists", ex);
facesMessages.add(FacesMessage.SEVERITY_ERROR, "Failed to add new client");
conversationService.endConversation();
return OxTrustConstants.RESULT_FAILURE;
}
return OxTrustConstants.RESULT_SUCCESS;
}
use of org.gluu.persist.exception.mapping.BaseMappingException 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();
// Clone shared instance
try {
PropertyUtils.copyProperties(this.organization, tmpOrganization);
} catch (Exception ex) {
log.error("Failed to load organization", ex);
this.organization = null;
}
} catch (BaseMappingException ex) {
log.error("Failed to load organization", ex);
}
if (this.organization == null) {
return OxTrustConstants.RESULT_FAILURE;
}
initLogoImage();
initFaviconImage();
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();
appliances = new ArrayList<GluuAppliance>();
try {
appliances.addAll(applianceService.getAppliances());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return OxTrustConstants.RESULT_SUCCESS;
}
use of org.gluu.persist.exception.mapping.BaseMappingException in project oxTrust by GluuFederation.
the class UpdatePersonAction method update.
/**
* Initializes attributes for updating person
*
* @return String describing success of the operation
* @throws Exception
*/
public String update() {
if (this.person != null) {
return OxTrustConstants.RESULT_SUCCESS;
}
this.update = true;
try {
this.person = personService.getPersonByInum(inum);
} catch (BaseMappingException ex) {
log.error("Failed to find person {}", inum, ex);
facesMessages.add(FacesMessage.SEVERITY_ERROR, "Failed to find person");
conversationService.endConversation();
return OxTrustConstants.RESULT_FAILURE;
}
initAttributes(false);
try {
this.gluuStatus = this.person.getStatus();
List<String> oxexternal = this.person.getOxExternalUid();
externalAuthCustomAttributes = new ArrayList<String>();
if (oxexternal != null && oxexternal.size() > 0) {
for (String oxexternalStr : oxexternal) {
String[] args = oxexternalStr.split(":");
externalAuthCustomAttributes.add(args[0]);
}
}
List<GluuCustomFidoDevice> gluuCustomFidoDevices = fidoDeviceService.searchFidoDevices(this.person.getInum(), null);
deviceDataMap = new ArrayList<GluuDeviceDataBean>();
if (gluuCustomFidoDevices != null) {
for (GluuCustomFidoDevice gluuCustomFidoDevice : gluuCustomFidoDevices) {
GluuDeviceDataBean gluuDeviceDataBean = new GluuDeviceDataBean();
gluuDeviceDataBean.setCreationDate(ldapEntryManager.decodeGeneralizedTime(gluuCustomFidoDevice.getCreationDate()).toGMTString());
gluuDeviceDataBean.setId(gluuCustomFidoDevice.getId());
String devicedata = gluuCustomFidoDevice.getDeviceData();
String modality = "";
String nickName = "";
if (devicedata != null) {
DeviceData deviceData = getDeviceata(devicedata);
// nickName = deviceData.getName();
nickName = gluuCustomFidoDevice.getNickname();
modality = "Super-Gluu Device";
} else {
// nickName = "U2F";
nickName = gluuCustomFidoDevice.getNickname();
modality = "U2F device";
}
gluuDeviceDataBean.setNickName(nickName);
gluuDeviceDataBean.setModality(modality);
deviceDataMap.add(gluuDeviceDataBean);
}
}
if (oxexternal != null && oxexternal.size() > 0) {
for (String oxexternalStr : oxexternal) {
String[] args = oxexternalStr.split(":");
GluuDeviceDataBean gluuDeviceDataBean = new GluuDeviceDataBean();
gluuDeviceDataBean.setNickName(args[0]);
gluuDeviceDataBean.setModality(args[0]);
gluuDeviceDataBean.setId(oxexternalStr);
deviceDataMap.add(gluuDeviceDataBean);
}
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
userPasswordAction.setPerson(this.person);
return OxTrustConstants.RESULT_SUCCESS;
}
use of org.gluu.persist.exception.mapping.BaseMappingException in project oxTrust by GluuFederation.
the class UpdateScopeAction method searchAvailableDynamicScripts.
public void searchAvailableDynamicScripts() {
if (this.availableDynamicScripts != null) {
selectAddedDynamicScripts();
return;
}
try {
List<CustomScript> availableScripts = customScriptService.findCustomScripts(Arrays.asList(CustomScriptType.DYNAMIC_SCOPE), CUSTOM_SCRIPT_RETURN_ATTRIBUTES);
List<SelectableEntity<CustomScript>> tmpAvailableDynamicScripts = new ArrayList<SelectableEntity<CustomScript>>();
for (CustomScript dynamicScript : availableScripts) {
if (dynamicScript.isEnabled()) {
tmpAvailableDynamicScripts.add(new SelectableEntity<CustomScript>(dynamicScript));
}
}
this.availableDynamicScripts = tmpAvailableDynamicScripts;
selectAddedDynamicScripts();
} catch (BaseMappingException ex) {
log.error("Failed to find available authorization policies", ex);
}
}
Aggregations