aboutsummaryrefslogtreecommitdiff
path: root/id/ConfigWebTool/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'id/ConfigWebTool/src/main/java')
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java19
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java23
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java10
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java384
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/InterfederationIDPAction.java90
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/utils/UserRequestCleaner.java3
6 files changed, 292 insertions, 237 deletions
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java
index 5e177655d..975f627d4 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralStorkConfig.java
@@ -26,6 +26,7 @@ import java.util.ArrayList;
import java.util.List;
import at.gv.egovernment.moa.id.commons.db.ConfigurationDBRead;
+import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils;
import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentGeneral;
import at.gv.egovernment.moa.id.commons.db.dao.config.CPEPS;
import at.gv.egovernment.moa.id.commons.db.dao.config.ForeignIdentities;
@@ -42,6 +43,22 @@ public class GeneralStorkConfig {
private int qaa;
private static final Logger log = Logger.getLogger(GeneralStorkConfig.class);
+ private MOAIDConfiguration dbconfig = null;
+
+ /**
+ *
+ */
+ public GeneralStorkConfig() {
+ dbconfig = ConfigurationDBRead.getMOAIDConfiguration();
+
+ }
+
+ @Override
+ protected void finalize() throws Throwable {
+ ConfigurationDBUtils.closeSession();
+ super.finalize();
+ }
+
public void parse(MOAIDConfiguration config) {
log.info("Initializing general Stork config");
@@ -93,7 +110,7 @@ public class GeneralStorkConfig {
if (null == cpepslist)
return null;
- MOAIDConfiguration dbconfig = ConfigurationDBRead.getMOAIDConfiguration();
+ //MOAIDConfiguration dbconfig = ConfigurationDBRead.getMOAIDConfiguration();
try {
List<CPEPS> cpepss = dbconfig.getAuthComponentGeneral().getForeignIdentities().getSTORK().getCPEPS();
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java
index 45875010b..e0a312c09 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java
@@ -30,9 +30,11 @@ import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
import at.gv.egovernment.moa.id.commons.db.ConfigurationDBRead;
+import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils;
import at.gv.egovernment.moa.id.commons.db.dao.config.AttributeProviderPlugin;
import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentOA;
import at.gv.egovernment.moa.id.commons.db.dao.config.CPEPS;
+import at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration;
import at.gv.egovernment.moa.id.commons.db.dao.config.OASTORK;
import at.gv.egovernment.moa.id.commons.db.dao.config.OAStorkAttribute;
import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication;
@@ -59,11 +61,16 @@ public class OASTORKConfig implements IOnlineApplicationData{
private List<String> citizenCountries;
private List<String> enabledCitizenCountries;
+ private MOAIDConfiguration dbconfig = null;
+
public OASTORKConfig() {
// fetch available citizen countries
citizenCountries = new ArrayList<String>();
+
+ dbconfig = ConfigurationDBRead.getMOAIDConfiguration();
+
try {
- for(CPEPS current : ConfigurationDBRead.getMOAIDConfiguration().getAuthComponentGeneral().getForeignIdentities().getSTORK().getCPEPS()) {
+ for(CPEPS current : dbconfig.getAuthComponentGeneral().getForeignIdentities().getSTORK().getCPEPS()) {
citizenCountries.add(current.getCountryCode());
}
@@ -73,6 +80,12 @@ public class OASTORKConfig implements IOnlineApplicationData{
}
+ @Override
+ protected void finalize() throws Throwable {
+ ConfigurationDBUtils.closeSession();
+ super.finalize();
+ }
+
/* (non-Javadoc)
* @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#getName()
*/
@@ -98,7 +111,7 @@ public class OASTORKConfig implements IOnlineApplicationData{
setQaa(config.getQaa());
} catch(NullPointerException e) {
// if there is no configuration available for the OA, get the default qaa level
- setQaa(ConfigurationDBRead.getMOAIDConfiguration().getAuthComponentGeneral().getForeignIdentities().getSTORK().getQualityAuthenticationAssuranceLevel());
+ setQaa(dbconfig.getAuthComponentGeneral().getForeignIdentities().getSTORK().getQualityAuthenticationAssuranceLevel());
}
@@ -110,7 +123,7 @@ public class OASTORKConfig implements IOnlineApplicationData{
attributes = new ArrayList<AttributeHelper>();
try {
try {
- for(StorkAttribute current : ConfigurationDBRead.getMOAIDConfiguration().getAuthComponentGeneral().getForeignIdentities().getSTORK().getAttributes()) {
+ for(StorkAttribute current : dbconfig.getAuthComponentGeneral().getForeignIdentities().getSTORK().getAttributes()) {
AttributeHelper tmp = null;
for(OAStorkAttribute sepp : config.getOAAttributes())
@@ -220,7 +233,7 @@ public class OASTORKConfig implements IOnlineApplicationData{
return result;
for(AttributeHelper current : getHelperAttributes()) {
- for(StorkAttribute currentAttribute : ConfigurationDBRead.getMOAIDConfiguration().getAuthComponentGeneral().getForeignIdentities().getSTORK().getAttributes())
+ for(StorkAttribute currentAttribute : dbconfig.getAuthComponentGeneral().getForeignIdentities().getSTORK().getAttributes())
if(currentAttribute.getName().equals(current.getName())) {
if(current.isUsed() || currentAttribute.isMandatory()) {
OAStorkAttribute tmp = new OAStorkAttribute();
@@ -260,7 +273,7 @@ public class OASTORKConfig implements IOnlineApplicationData{
List<CPEPS> result = new ArrayList<CPEPS>();
try {
- for(CPEPS current : ConfigurationDBRead.getMOAIDConfiguration().getAuthComponentGeneral().getForeignIdentities().getSTORK().getCPEPS()) {
+ for(CPEPS current : dbconfig.getAuthComponentGeneral().getForeignIdentities().getSTORK().getCPEPS()) {
if(enabledCitizenCountries.contains(current.getCountryCode()))
result.add(current);
}
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java
index a4ca3e403..31c29aef0 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java
@@ -132,7 +132,7 @@ public class EditGeneralConfigAction extends BasicAction {
public String saveConfig() {
try {
populateBasicInformations();
-
+
} catch (BasicActionException e) {
return Constants.STRUTS_ERROR;
@@ -210,6 +210,8 @@ public class EditGeneralConfigAction extends BasicAction {
public String back() {
try {
populateBasicInformations();
+ ConfigurationDBUtils.closeSession();
+
} catch (BasicActionException e) {
return Constants.STRUTS_ERROR;
@@ -654,9 +656,11 @@ public class EditGeneralConfigAction extends BasicAction {
} catch (MOADatabaseException e) {
log.warn("MOAID Configuration can not be stored in Database", e);
return LanguageHelper.getErrorString("error.db.oa.store", request);
+
+ } finally {
+ ConfigurationDBUtils.closeSession();
+
}
-
- ConfigurationDBUtils.closeSession();
return null;
}
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java
index 3d96cc1e5..1893b0f60 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java
@@ -108,9 +108,7 @@ public class EditOAAction extends BasicOAAction {
}
setNewOA(false);
-
- ConfigurationDBUtils.closeSession();
-
+
formID = Random.nextRandom();
session.setAttribute(Constants.SESSION_FORMID, formID);
session.setAttribute(Constants.SESSION_OAID, oaid);
@@ -123,6 +121,10 @@ public class EditOAAction extends BasicOAAction {
} catch (BasicOAActionException e) {
addActionError(e.getStrutsError());
return e.getStrutsReturnValue();
+
+ } finally {
+ ConfigurationDBUtils.closeSession();
+
}
}
@@ -149,32 +151,34 @@ public class EditOAAction extends BasicOAAction {
}
getStorkOA().setHelperAttributes(attributes);
-
+
+ UserDatabase userdb = ConfigurationDBRead.getUserWithID(authUser
+ .getUserID());
+
+ if (!authUser.isAdmin() && userdb.isIsMailAddressVerified() != null
+ && !userdb.isIsMailAddressVerified()) {
+ log.info("Online-Applikation managemant disabled. Mail address is not verified.");
+ addActionError(LanguageHelper.getErrorString(
+ "error.editoa.mailverification", request));
+ return Constants.STRUTS_SUCCESS;
+ }
+
+ session.setAttribute(
+ Constants.SESSION_OAUTH20SECRET,
+ ((OAOAuth20Config) formList.get(new OAOAuth20Config().getName()))
+ .getClientSecret());
+ session.setAttribute(Constants.SESSION_BKUFORMPREVIEW, getFormOA().getFormMap());
+ nextPage = Constants.STRUTS_RETURNAREA_VALUES.main.name();
+
+ return Constants.STRUTS_OA_EDIT;
+
} catch (BasicActionException e) {
return Constants.STRUTS_ERROR;
+ } finally {
+ ConfigurationDBUtils.closeSession();
+
}
-
- UserDatabase userdb = ConfigurationDBRead.getUserWithID(authUser
- .getUserID());
-
- if (!authUser.isAdmin() && userdb.isIsMailAddressVerified() != null
- && !userdb.isIsMailAddressVerified()) {
- log.info("Online-Applikation managemant disabled. Mail address is not verified.");
- addActionError(LanguageHelper.getErrorString(
- "error.editoa.mailverification", request));
- return Constants.STRUTS_SUCCESS;
- }
-
- ConfigurationDBUtils.closeSession();
- session.setAttribute(
- Constants.SESSION_OAUTH20SECRET,
- ((OAOAuth20Config) formList.get(new OAOAuth20Config().getName()))
- .getClientSecret());
- session.setAttribute(Constants.SESSION_BKUFORMPREVIEW, getFormOA().getFormMap());
- nextPage = Constants.STRUTS_RETURNAREA_VALUES.main.name();
-
- return Constants.STRUTS_OA_EDIT;
}
public String saveOA() {
@@ -183,9 +187,92 @@ public class EditOAAction extends BasicOAAction {
try {
populateBasicInformations();
-
onlineapplication = preProcessSaveOnlineApplication();
+ List<String> errors = new ArrayList<String>();
+
+ // validate forms
+ for (IOnlineApplicationData form : formList.values())
+ errors.addAll(form.validate(getGeneralOA(), authUser, request));
+
+ // Do not allow SSO in combination with special BKUSelection features
+ if (getSsoOA().isUseSSO()
+ && (getFormOA().isOnlyMandateAllowed() || !getFormOA()
+ .isShowMandateLoginButton())) {
+ log.warn("Special BKUSelection features can not be used in combination with SSO");
+ errors.add(LanguageHelper.getErrorString(
+ "validation.general.bkuselection.specialfeatures.valid",
+ request));
+ }
+
+ if (errors.size() > 0) {
+ log.info("OAConfiguration with ID "
+ + getGeneralOA().getIdentifier() + " has some errors.");
+ for (String el : errors)
+ addActionError(el);
+
+ formID = Random.nextRandom();
+ session.setAttribute(Constants.SESSION_FORMID, formID);
+ return Constants.STRUTS_ERROR_VALIDATION;
+
+ } else {
+ try {
+ onlineapplication = postProcessSaveOnlineApplication(onlineapplication);
+
+ } catch (BasicOAActionException e) {
+ addActionError(e.getStrutsError());
+ return e.getStrutsReturnValue();
+ }
+
+ }
+
+ Object nextPageAttr = session
+ .getAttribute(Constants.SESSION_RETURNAREA);
+ if (nextPageAttr != null && nextPageAttr instanceof String) {
+ nextPage = (String) nextPageAttr;
+ session.setAttribute(Constants.SESSION_RETURNAREA, null);
+
+ } else {
+ nextPage = Constants.STRUTS_RETURNAREA_VALUES.main.name();
+ }
+
+ if (onlineapplication.isIsAdminRequired()) {
+ int numoas = 0;
+ int numusers = 0;
+
+ List<OnlineApplication> openOAs = ConfigurationDBRead
+ .getAllNewOnlineApplications();
+ if (openOAs != null)
+ numoas = openOAs.size();
+
+ List<UserDatabase> openUsers = ConfigurationDBRead.getAllNewUsers();
+ if (openUsers != null)
+ numusers = openUsers.size();
+ try {
+
+ addActionMessage(LanguageHelper.getGUIString(
+ "webpages.oaconfig.success.admin", getGeneralOA()
+ .getIdentifier(), request));
+
+ if (numusers > 0 || numoas > 0)
+ MailHelper.sendAdminMail(numoas, numusers);
+
+ } catch (ConfigurationException e) {
+ log.warn("Sending Mail to Admin failed.", e);
+ }
+
+ } else
+ addActionMessage(LanguageHelper.getGUIString(
+ "webpages.oaconfig.success",
+ getGeneralOA().getIdentifier(), request));
+
+ // remove session attributes
+ session.setAttribute(Constants.SESSION_OAID, null);
+ session.removeAttribute(Constants.SESSION_BKUSELECTIONTEMPLATE);
+ session.removeAttribute(Constants.SESSION_SENDASSERTIONTEMPLATE);
+
+ return Constants.STRUTS_SUCCESS;
+
} catch (BasicActionException e) {
return Constants.STRUTS_ERROR;
@@ -193,122 +280,41 @@ public class EditOAAction extends BasicOAAction {
addActionError(e.getStrutsError());
return e.getStrutsReturnValue();
+ } finally {
+ ConfigurationDBUtils.closeSession();
+
}
-
- List<String> errors = new ArrayList<String>();
-
- // validate forms
- for (IOnlineApplicationData form : formList.values())
- errors.addAll(form.validate(getGeneralOA(), authUser, request));
-
- // Do not allow SSO in combination with special BKUSelection features
- if (getSsoOA().isUseSSO()
- && (getFormOA().isOnlyMandateAllowed() || !getFormOA()
- .isShowMandateLoginButton())) {
- log.warn("Special BKUSelection features can not be used in combination with SSO");
- errors.add(LanguageHelper.getErrorString(
- "validation.general.bkuselection.specialfeatures.valid",
- request));
- }
-
- if (errors.size() > 0) {
- log.info("OAConfiguration with ID "
- + getGeneralOA().getIdentifier() + " has some errors.");
- for (String el : errors)
- addActionError(el);
-
- formID = Random.nextRandom();
- session.setAttribute(Constants.SESSION_FORMID, formID);
- return Constants.STRUTS_ERROR_VALIDATION;
-
- } else {
- try {
- onlineapplication = postProcessSaveOnlineApplication(onlineapplication);
-
- } catch (BasicOAActionException e) {
- addActionError(e.getStrutsError());
- return e.getStrutsReturnValue();
- }
-
- }
-
- Object nextPageAttr = session
- .getAttribute(Constants.SESSION_RETURNAREA);
- if (nextPageAttr != null && nextPageAttr instanceof String) {
- nextPage = (String) nextPageAttr;
- session.setAttribute(Constants.SESSION_RETURNAREA, null);
-
- } else {
- nextPage = Constants.STRUTS_RETURNAREA_VALUES.main.name();
- }
-
- if (onlineapplication.isIsAdminRequired()) {
- int numoas = 0;
- int numusers = 0;
-
- List<OnlineApplication> openOAs = ConfigurationDBRead
- .getAllNewOnlineApplications();
- if (openOAs != null)
- numoas = openOAs.size();
-
- List<UserDatabase> openUsers = ConfigurationDBRead.getAllNewUsers();
- if (openUsers != null)
- numusers = openUsers.size();
- try {
-
- addActionMessage(LanguageHelper.getGUIString(
- "webpages.oaconfig.success.admin", getGeneralOA()
- .getIdentifier(), request));
-
- if (numusers > 0 || numoas > 0)
- MailHelper.sendAdminMail(numoas, numusers);
-
- } catch (ConfigurationException e) {
- log.warn("Sending Mail to Admin failed.", e);
- }
-
- } else
- addActionMessage(LanguageHelper.getGUIString(
- "webpages.oaconfig.success",
- getGeneralOA().getIdentifier(), request));
-
- // remove session attributes
- session.setAttribute(Constants.SESSION_OAID, null);
- session.removeAttribute(Constants.SESSION_BKUSELECTIONTEMPLATE);
- session.removeAttribute(Constants.SESSION_SENDASSERTIONTEMPLATE);
-
- ConfigurationDBUtils.closeSession();
- return Constants.STRUTS_SUCCESS;
}
public String cancleAndBackOA() {
try {
populateBasicInformations();
+ Object nextPageAttr = session
+ .getAttribute(Constants.SESSION_RETURNAREA);
+ if (nextPageAttr != null && nextPageAttr instanceof String) {
+ nextPage = (String) nextPageAttr;
+ session.setAttribute(Constants.SESSION_RETURNAREA, null);
+
+ } else {
+ nextPage = Constants.STRUTS_RETURNAREA_VALUES.main.name();
+ }
+
+ session.setAttribute(Constants.SESSION_OAID, null);
+
+ addActionMessage(LanguageHelper.getGUIString(
+ "webpages.oaconfig.cancle", getGeneralOA().getIdentifier(),
+ request));
+
+ return Constants.STRUTS_SUCCESS;
+
} catch (BasicActionException e) {
return Constants.STRUTS_ERROR;
+ } finally {
+ ConfigurationDBUtils.closeSession();
+
}
-
- Object nextPageAttr = session
- .getAttribute(Constants.SESSION_RETURNAREA);
- if (nextPageAttr != null && nextPageAttr instanceof String) {
- nextPage = (String) nextPageAttr;
- session.setAttribute(Constants.SESSION_RETURNAREA, null);
-
- } else {
- nextPage = Constants.STRUTS_RETURNAREA_VALUES.main.name();
- }
-
- session.setAttribute(Constants.SESSION_OAID, null);
-
- addActionMessage(LanguageHelper.getGUIString(
- "webpages.oaconfig.cancle", getGeneralOA().getIdentifier(),
- request));
-
- ConfigurationDBUtils.closeSession();
-
- return Constants.STRUTS_SUCCESS;
}
public String deleteOA() {
@@ -326,7 +332,63 @@ public class EditOAAction extends BasicOAAction {
}
oaidentifier = preProcessDeleteOnlineApplication();
-
+ OnlineApplication onlineapplication = ConfigurationDBRead
+ .getOnlineApplication(oaidentifier);
+ request.getSession().setAttribute(Constants.SESSION_OAID, null);
+
+ try {
+ if (MiscUtil.isNotEmpty(onlineapplication.getAuthComponentOA()
+ .getOAPVP2().getMetadataURL())) {
+
+ MOAIDConfiguration moaconfig = ConfigurationDBRead
+ .getMOAIDConfiguration();
+ moaconfig.setPvp2RefreshItem(new Date());
+ ConfigurationDBUtils.saveOrUpdate(moaconfig);
+
+ }
+ } catch (Throwable e) {
+ log.info("Found no MetadataURL in OA-Databaseconfig!", e);
+ }
+
+ if (ConfigurationDBUtils.delete(onlineapplication)) {
+
+ if (!authUser.isAdmin()) {
+ UserDatabase user = ConfigurationDBRead.getUserWithID(authUser
+ .getUserID());
+ List<OnlineApplication> useroas = user.getOnlineApplication();
+
+ for (OnlineApplicationType oa : useroas) {
+ if (oa.getHjid().equals(onlineapplication.getHjid())) {
+ useroas.remove(oa);
+ }
+ }
+
+ try {
+ ConfigurationDBUtils.saveOrUpdate(user);
+
+ } catch (MOADatabaseException e) {
+ log.warn("User information can not be updated in database",
+ e);
+ addActionError(LanguageHelper.getGUIString(
+ "error.db.oa.store", request));
+ return Constants.STRUTS_ERROR;
+ }
+ }
+
+ ConfigurationDBUtils.closeSession();
+
+ addActionMessage(LanguageHelper.getGUIString(
+ "webpages.oaconfig.delete.message", oaidentifier, request));
+
+ return Constants.STRUTS_SUCCESS;
+
+ } else {
+ ConfigurationDBUtils.closeSession();
+ addActionError(LanguageHelper.getGUIString(
+ "webpages.oaconfig.delete.error", oaidentifier, request));
+ return Constants.STRUTS_SUCCESS;
+ }
+
} catch (BasicActionException e) {
return Constants.STRUTS_ERROR;
@@ -334,63 +396,9 @@ public class EditOAAction extends BasicOAAction {
addActionError(e.getStrutsError());
return e.getStrutsReturnValue();
- }
-
- OnlineApplication onlineapplication = ConfigurationDBRead
- .getOnlineApplication(oaidentifier);
- request.getSession().setAttribute(Constants.SESSION_OAID, null);
-
- try {
- if (MiscUtil.isNotEmpty(onlineapplication.getAuthComponentOA()
- .getOAPVP2().getMetadataURL())) {
-
- MOAIDConfiguration moaconfig = ConfigurationDBRead
- .getMOAIDConfiguration();
- moaconfig.setPvp2RefreshItem(new Date());
- ConfigurationDBUtils.saveOrUpdate(moaconfig);
-
- }
- } catch (Throwable e) {
- log.info("Found no MetadataURL in OA-Databaseconfig!", e);
- }
-
- if (ConfigurationDBUtils.delete(onlineapplication)) {
-
- if (!authUser.isAdmin()) {
- UserDatabase user = ConfigurationDBRead.getUserWithID(authUser
- .getUserID());
- List<OnlineApplication> useroas = user.getOnlineApplication();
-
- for (OnlineApplicationType oa : useroas) {
- if (oa.getHjid().equals(onlineapplication.getHjid())) {
- useroas.remove(oa);
- }
- }
-
- try {
- ConfigurationDBUtils.saveOrUpdate(user);
-
- } catch (MOADatabaseException e) {
- log.warn("User information can not be updated in database",
- e);
- addActionError(LanguageHelper.getGUIString(
- "error.db.oa.store", request));
- return Constants.STRUTS_ERROR;
- }
- }
-
- ConfigurationDBUtils.closeSession();
-
- addActionMessage(LanguageHelper.getGUIString(
- "webpages.oaconfig.delete.message", oaidentifier, request));
-
- return Constants.STRUTS_SUCCESS;
-
- } else {
+ } finally {
ConfigurationDBUtils.closeSession();
- addActionError(LanguageHelper.getGUIString(
- "webpages.oaconfig.delete.error", oaidentifier, request));
- return Constants.STRUTS_SUCCESS;
+
}
}
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/InterfederationIDPAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/InterfederationIDPAction.java
index 813aa1960..f84bcdbce 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/InterfederationIDPAction.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/InterfederationIDPAction.java
@@ -89,9 +89,7 @@ public class InterfederationIDPAction extends BasicOAAction {
session.setAttribute(Constants.SESSION_RETURNAREA,
Constants.STRUTS_RETURNAREA_VALUES.main.name());
-
- ConfigurationDBUtils.closeSession();
-
+
return Constants.STRUTS_SUCCESS;
} else {
@@ -103,6 +101,9 @@ public class InterfederationIDPAction extends BasicOAAction {
} catch (BasicActionException e) {
return Constants.STRUTS_ERROR;
+ } finally {
+ ConfigurationDBUtils.closeSession();
+
}
}
@@ -140,6 +141,9 @@ public class InterfederationIDPAction extends BasicOAAction {
} catch (BasicActionException e) {
return Constants.STRUTS_ERROR;
+ } finally {
+ ConfigurationDBUtils.closeSession();
+
}
return Constants.STRUTS_OA_EDIT + interfederationType;
@@ -190,7 +194,10 @@ public class InterfederationIDPAction extends BasicOAAction {
addActionError(e.getStrutsError());
return e.getStrutsReturnValue();
- }
+ } finally {
+ ConfigurationDBUtils.closeSession();
+
+ }
}
public String saveIDP() {
@@ -287,7 +294,10 @@ public class InterfederationIDPAction extends BasicOAAction {
addActionError(e.getStrutsError());
return e.getStrutsReturnValue();
- }
+ } finally {
+ ConfigurationDBUtils.closeSession();
+
+ }
}
public String cancleAndBackIDP() {
@@ -300,16 +310,19 @@ public class InterfederationIDPAction extends BasicOAAction {
return Constants.STRUTS_NOTALLOWED;
}
+ session.setAttribute(Constants.SESSION_OAID, null);
+ addActionMessage(LanguageHelper.getGUIString("webpages.idp.cancle", getGeneralOA().getIdentifier(), request));
+ ConfigurationDBUtils.closeSession();
+
+ return Constants.STRUTS_SUCCESS;
+
} catch (BasicActionException e) {
return Constants.STRUTS_ERROR;
+ } finally {
+ ConfigurationDBUtils.closeSession();
+
}
-
- session.setAttribute(Constants.SESSION_OAID, null);
- addActionMessage(LanguageHelper.getGUIString("webpages.idp.cancle", getGeneralOA().getIdentifier(), request));
- ConfigurationDBUtils.closeSession();
-
- return Constants.STRUTS_SUCCESS;
}
public String deleteIDP() {
@@ -325,7 +338,30 @@ public class InterfederationIDPAction extends BasicOAAction {
oaidentifier = preProcessDeleteOnlineApplication();
-
+ session.setAttribute(Constants.SESSION_OAID, null);
+ OnlineApplication onlineapplication = ConfigurationDBRead.getOnlineApplication(oaidentifier);
+
+ try {
+ if (onlineapplication.getAuthComponentOA().getOAPVP2() != null &&
+ MiscUtil.isNotEmpty(onlineapplication.getAuthComponentOA().getOAPVP2().getMetadataURL())) {
+ MOAIDConfiguration moaconfig = ConfigurationDBRead.getMOAIDConfiguration();
+ moaconfig.setPvp2RefreshItem(new Date());
+ ConfigurationDBUtils.saveOrUpdate(moaconfig);
+
+ }
+ } catch (Throwable e) {
+ log.info("Found no MetadataURL in OA-Databaseconfig!", e);
+ }
+
+ if (ConfigurationDBUtils.delete(onlineapplication)) {
+ addActionMessage(LanguageHelper.getGUIString("webpages.oaconfig.delete.message", oaidentifier, request));
+ return Constants.STRUTS_SUCCESS;
+
+ } else {
+ addActionError(LanguageHelper.getGUIString("webpages.oaconfig.delete.error", oaidentifier, request));
+ return Constants.STRUTS_SUCCESS;
+ }
+
} catch (BasicActionException e) {
return Constants.STRUTS_ERROR;
@@ -333,34 +369,10 @@ public class InterfederationIDPAction extends BasicOAAction {
addActionError(e.getStrutsError());
return e.getStrutsReturnValue();
+ } finally {
+ ConfigurationDBUtils.closeSession();
+
}
-
- session.setAttribute(Constants.SESSION_OAID, null);
- OnlineApplication onlineapplication = ConfigurationDBRead.getOnlineApplication(oaidentifier);
-
- try {
- if (onlineapplication.getAuthComponentOA().getOAPVP2() != null &&
- MiscUtil.isNotEmpty(onlineapplication.getAuthComponentOA().getOAPVP2().getMetadataURL())) {
- MOAIDConfiguration moaconfig = ConfigurationDBRead.getMOAIDConfiguration();
- moaconfig.setPvp2RefreshItem(new Date());
- ConfigurationDBUtils.saveOrUpdate(moaconfig);
-
- }
- } catch (Throwable e) {
- log.info("Found no MetadataURL in OA-Databaseconfig!", e);
- }
-
- if (ConfigurationDBUtils.delete(onlineapplication)) {
-
- ConfigurationDBUtils.closeSession();
- addActionMessage(LanguageHelper.getGUIString("webpages.oaconfig.delete.message", oaidentifier, request));
- return Constants.STRUTS_SUCCESS;
-
- } else {
- ConfigurationDBUtils.closeSession();
- addActionError(LanguageHelper.getGUIString("webpages.oaconfig.delete.error", oaidentifier, request));
- return Constants.STRUTS_SUCCESS;
- }
}
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/utils/UserRequestCleaner.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/utils/UserRequestCleaner.java
index a75f8307d..27e29e292 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/utils/UserRequestCleaner.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/utils/UserRequestCleaner.java
@@ -68,7 +68,8 @@ public class UserRequestCleaner implements Runnable {
//clean up active user storage
AuthenticationManager.getInstance().removeAllUsersAfterTimeOut();
-
+ ConfigurationDBUtils.closeSession();
+
Thread.sleep(SESSION_CLEANUP_INTERVAL * 1000);
} catch (ConfigurationException e) {