use of org.gluu.persist.exception.BasePersistenceException 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;
}
use of org.gluu.persist.exception.BasePersistenceException in project oxTrust by GluuFederation.
the class UpdateClientAction method add.
public String add() throws Exception {
if (this.client != null) {
this.client.setOxAuthAppType(OxAuthApplicationType.WEB);
this.client.setSubjectType(OxAuthSubjectType.PAIRWISE);
return OxTrustConstants.RESULT_SUCCESS;
}
this.update = false;
this.oxAttributesJson = getClientAttributesJson();
this.client = new OxAuthClient();
this.client.setOxAuthAppType(OxAuthApplicationType.WEB);
this.client.setSubjectType(OxAuthSubjectType.PAIRWISE);
try {
this.loginUris = getNonEmptyStringList(client.getOxAuthRedirectURIs());
this.logoutUris = getNonEmptyStringList(client.getOxAuthPostLogoutRedirectURIs());
this.clientlogoutUris = getNonEmptyStringList(client.getLogoutUri());
this.scopes = getInitialEntries();
this.claims = getInitialClaimDisplayNameEntries();
this.responseTypes = getInitialResponseTypes();
this.grantTypes = getInitialGrantTypes();
this.contacts = getNonEmptyStringList(client.getContacts());
this.requestUris = getNonEmptyStringList(client.getRequestUris());
this.authorizedOrigins = getNonEmptyStringList(client.getAuthorizedOrigins());
this.claimRedirectURIList = getNonEmptyStringList(client.getClaimRedirectURI());
this.customScripts = getInitialAcrs();
this.postAuthnScripts = Lists.newArrayList();
this.rptClaimsScripts = Lists.newArrayList();
this.consentScripts = Lists.newArrayList();
this.spontaneousScopesScripts = Lists.newArrayList();
} catch (BasePersistenceException 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.BasePersistenceException 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;
}
use of org.gluu.persist.exception.BasePersistenceException 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 (BasePersistenceException ex) {
log.error("Failed to find available authorization policies", ex);
}
}
use of org.gluu.persist.exception.BasePersistenceException in project oxTrust by GluuFederation.
the class UpdateTrustRelationshipAction method delete.
public String delete() {
String result = OxTrustConstants.RESULT_FAILURE;
if (update) {
try {
if (GluuStatus.ACTIVE.equals(this.trustRelationship.getStatus()) && this.trustRelationship.isFederation()) {
facesMessages.add(FacesMessage.SEVERITY_WARN, "'#{updateTrustRelationshipAction.trustRelationship.displayName}' has associated Trust Relationship(s) depending on it and cannot be deleted. Please disable the federation and try again.");
return result;
}
synchronized (svnSyncTimer) {
for (GluuSAMLTrustRelationship trust : trustService.getDeconstructedTrustRelationships(this.trustRelationship)) {
log.info("Deleting child:" + trust.getDisplayName());
trustService.removeTrustRelationship(trust);
}
shibboleth3ConfService.removeSpMetadataFile(this.trustRelationship.getSpMetaDataFN());
trustService.removeTrustRelationship(this.trustRelationship);
oxTrustAuditService.audit("TR " + this.trustRelationship.getInum() + " **" + this.trustRelationship.getDisplayName() + "** REMOVED", identity.getUser(), (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest());
}
result = OxTrustConstants.RESULT_SUCCESS;
} catch (BasePersistenceException ex) {
result = OxTrustConstants.RESULT_FAILURE;
log.error("Failed to remove trust relationship {}", this.trustRelationship.getInum(), ex);
} finally {
List<GluuSAMLTrustRelationship> trustRelationships = trustService.getAllActiveTrustRelationships();
updateShibboleth3ConfigurationForDelete(trustRelationships);
}
}
if (OxTrustConstants.RESULT_SUCCESS.equals(result)) {
facesMessages.add(FacesMessage.SEVERITY_INFO, "Relationship '#{updateTrustRelationshipAction.trustRelationship.displayName}' removed successfully");
} else if (OxTrustConstants.RESULT_FAILURE.equals(result)) {
facesMessages.add(FacesMessage.SEVERITY_ERROR, "Failed to remove relationship '#{updateTrustRelationshipAction.trustRelationship.displayName}'");
}
return result;
}
Aggregations