aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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.java31
-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/struts/interceptor/HibernateSessionInterceptor.java59
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/utils/UserRequestCleaner.java3
-rw-r--r--id/ConfigWebTool/src/main/resources/struts.xml6
-rw-r--r--id/ConfigWebTool/src/main/webapp/js/common.js34
-rw-r--r--id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp1
-rw-r--r--id/server/data/deploy/conf/moa-id/htmlTemplates/loginFormFull.html2
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java183
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/data/AuthenticationData.java2
-rw-r--r--id/server/idserverlib/src/main/resources/resources/templates/loginFormFull.html2
-rw-r--r--id/server/idserverlib/src/main/resources/resources/templates/saml2-post-binding-moa.vm2
-rw-r--r--id/server/moa-id-commons/pom.xml3
-rw-r--r--pom.xml2
17 files changed, 584 insertions, 262 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 7f609d95e..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;
@@ -222,15 +224,15 @@ public class EditGeneralConfigAction extends BasicAction {
private String saveFormToDatabase() {
log.debug("Saving form to database");
- log.error("Saving form to db");
- log.info("SV frm db");
+// log.error("Saving form to db");
+// log.info("SV frm db");
- for (Object obj : Collections.list(request.getParameterNames())) {
- log.error(" PARAM: " + obj.toString());
- }
- for (Object obj : Collections.list(request.getSession().getAttributeNames())) {
- log.error(" SES PARAM: " + obj.toString());
- }
+// for (Object obj : Collections.list(request.getParameterNames())) {
+// log.error(" PARAM: " + obj.toString());
+// }
+// for (Object obj : Collections.list(request.getSession().getAttributeNames())) {
+// log.error(" SES PARAM: " + obj.toString());
+// }
try {
log.error(" ASSERTION " + moaconfig.getTimeoutAssertion());
@@ -523,8 +525,11 @@ public class EditGeneralConfigAction extends BasicAction {
ForeignIdentities foreign = dbauth.getForeignIdentities();
if (foreign != null) {
STORK stork = foreign.getSTORK();
- if (stork == null)
+ if (stork == null) {
stork = new STORK();
+ foreign.setSTORK(stork);
+
+ }
try {
log.error("QAAAA " + storkconfig.getDefaultQaa());
@@ -651,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 d2d318413..89dce3200 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
@@ -91,9 +91,7 @@ public class InterfederationIDPAction extends BasicOAAction {
session.setAttribute(Constants.SESSION_RETURNAREA,
Constants.STRUTS_RETURNAREA_VALUES.main.name());
-
- ConfigurationDBUtils.closeSession();
-
+
return Constants.STRUTS_SUCCESS;
} else {
@@ -105,6 +103,9 @@ public class InterfederationIDPAction extends BasicOAAction {
} catch (BasicActionException e) {
return Constants.STRUTS_ERROR;
+ } finally {
+ ConfigurationDBUtils.closeSession();
+
}
}
@@ -145,6 +146,9 @@ public class InterfederationIDPAction extends BasicOAAction {
} catch (BasicActionException e) {
return Constants.STRUTS_ERROR;
+ } finally {
+ ConfigurationDBUtils.closeSession();
+
}
return Constants.STRUTS_OA_EDIT + interfederationType;
@@ -199,7 +203,10 @@ public class InterfederationIDPAction extends BasicOAAction {
addActionError(e.getStrutsError());
return e.getStrutsReturnValue();
- }
+ } finally {
+ ConfigurationDBUtils.closeSession();
+
+ }
}
public String saveIDP() {
@@ -297,7 +304,10 @@ public class InterfederationIDPAction extends BasicOAAction {
addActionError(e.getStrutsError());
return e.getStrutsReturnValue();
- }
+ } finally {
+ ConfigurationDBUtils.closeSession();
+
+ }
}
public String cancleAndBackIDP() {
@@ -310,16 +320,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() {
@@ -335,7 +348,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;
@@ -343,34 +379,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/struts/interceptor/HibernateSessionInterceptor.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/interceptor/HibernateSessionInterceptor.java
new file mode 100644
index 000000000..084d054f7
--- /dev/null
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/interceptor/HibernateSessionInterceptor.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2014 Federal Chancellery Austria
+ * MOA-ID has been developed in a cooperation between BRZ, the Federal
+ * Chancellery Austria - ICT staff unit, and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+package at.gv.egovernment.moa.id.configuration.struts.interceptor;
+
+import org.apache.log4j.Logger;
+
+import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils;
+
+import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
+
+/**
+ * @author tlenz
+ *
+ */
+public class HibernateSessionInterceptor extends AbstractInterceptor {
+
+ private static final long serialVersionUID = 2457987431702749278L;
+ private static Logger log = Logger.getLogger(HibernateSessionInterceptor.class);
+
+ /* (non-Javadoc)
+ * @see com.opensymphony.xwork2.interceptor.AbstractInterceptor#intercept(com.opensymphony.xwork2.ActionInvocation)
+ */
+ @Override
+ public String intercept(ActionInvocation arg0) throws Exception {
+ log.trace("Hibernate session interceptor starts .... ");
+
+ try {
+ return arg0.invoke();
+
+ } finally {
+ log.debug("Hibernate-Session interceptor close active sessions.");
+ ConfigurationDBUtils.closeSession();
+
+ }
+
+ }
+
+}
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) {
diff --git a/id/ConfigWebTool/src/main/resources/struts.xml b/id/ConfigWebTool/src/main/resources/struts.xml
index f383ad524..31f3889de 100644
--- a/id/ConfigWebTool/src/main/resources/struts.xml
+++ b/id/ConfigWebTool/src/main/resources/struts.xml
@@ -16,7 +16,10 @@
<interceptors>
+ <interceptor name="HibernateSessionInterceptor" class="at.gv.egovernment.moa.id.configuration.struts.interceptor.HibernateSessionInterceptor"/>
+
<interceptor-stack name="OwnStack">
+ <interceptor-ref name="HibernateSessionInterceptor" />
<interceptor-ref name="params">
<param
name="excludeParams">^class\..*,^dojo\..*,^struts\..*,^session\..*,^request\..*,^application\..*,^servlet(Request|Response)\..*,^parameters\..*,^method:.*</param>
@@ -85,7 +88,10 @@
<package name="secure" namespace="/secure" extends="struts-default">
<interceptors>
+ <interceptor name="HibernateSessionInterceptor" class="at.gv.egovernment.moa.id.configuration.struts.interceptor.HibernateSessionInterceptor"/>
+
<interceptor-stack name="OwnStack">
+ <interceptor-ref name="HibernateSessionInterceptor" />
<interceptor-ref name="params">
<param
name="excludeParams">^class\..*,^dojo\..*,^struts\..*,^session\..*,^request\..*,^application\..*,^servlet(Request|Response)\..*,^parameters\..*,^method:.*</param>
diff --git a/id/ConfigWebTool/src/main/webapp/js/common.js b/id/ConfigWebTool/src/main/webapp/js/common.js
index f7ef2c415..9f19e88a2 100644
--- a/id/ConfigWebTool/src/main/webapp/js/common.js
+++ b/id/ConfigWebTool/src/main/webapp/js/common.js
@@ -223,18 +223,36 @@ function oaOnLoad() {
function newPeps() {
var target = $(document.getElementById("stork_pepslist").getElementsByTagName("tr")).last()[0];
var clone = target.cloneNode(true);
+ var lastindex;
try {
- var lastindex = parseInt(clone.innerHTML.match(/name="storkconfig.cpepslist\[(\d)/)[1]);
+ lastindex = parseInt(clone.innerHTML.match(/name="storkconfig.cpepslist\[(\d*)\]/)[1]);
} catch (err) {
-
- var lastindex = 1;
+ lastindex = 1;
}
var nextindex = lastindex + 1;
-
- clone.innerHTML = clone.innerHTML.replace(/[A-Z]{2}</, '<');
- clone.innerHTML = clone.innerHTML.replace(/<input.*type="hidden".*>/, '<div id="wwgrp_loadGeneralConfig_storkconfig_cpepslist_0__countryCode" class="wwgrp"> <div id="wwctrl_loadGeneralConfig_storkconfig_cpepslist_0__countryCode" class="wwctrl"> <input id="loadGeneralConfig_storkconfig_cpepslist_0__countryCode" class="textfield_short" type="text" value="IT" name="storkconfig.cpepslist[0].countryCode"> </div> </div>');
- clone.innerHTML = clone.innerHTML.replace(/name="storkconfig.cpepslist\[\d/g, 'name="storkconfig.cpepslist[' + nextindex);
- clone.innerHTML = clone.innerHTML.replace(/(.*" value=").*?(".*)/g, '$1$2');
+ clone.innerHTML = '<tr>\
+ <td>\
+ <div id="wwgrp_loadGeneralConfig_storkconfig_cpepslist_'+nextindex+'__countryCode" class="wwgrp">\
+ <div id="wwctrl_loadGeneralConfig_storkconfig_cpepslist_'+nextindex+'__countryCode" class="wwctrl">\
+ <input id="loadGeneralConfig_storkconfig_cpepslist_'+nextindex+'__countryCode" class="textfield_short" type="text" value="" name="storkconfig.cpepslist['+nextindex+'].countryCode"></div>\
+ </div>\
+ </td>\
+ <td>\
+ <div id="wwgrp_loadGeneralConfig_storkconfig_cpepslist_'+nextindex+'__URL" class="wwgrp">\
+ <div id="wwctrl_loadGeneralConfig_storkconfig_cpepslist_'+nextindex+'__URL" class="wwctrl">\
+ <input type="text" name="storkconfig.cpepslist['+nextindex+'].URL" value="" id="loadGeneralConfig_storkconfig_cpepslist_'+nextindex+'__URL" class="textfield_long"></div>\
+ </div>\
+ </td>\
+ <td>\
+ <div id="wwgrp_loadGeneralConfig_storkconfig_cpepslist_'+nextindex+'__supportsXMLSignature" class="wwgrp">\
+ <div id="wwctrl_loadGeneralConfig_storkconfig_cpepslist_'+nextindex+'__supportsXMLSignature" class="wwctrl">\
+ <input type="checkbox" name="storkconfig.cpepslist['+nextindex+'].supportsXMLSignature" value="true" checked="checked" id="loadGeneralConfig_storkconfig_cpepslist_'+nextindex+'__supportsXMLSignature">\
+ <input type="hidden" id="__checkbox_loadGeneralConfig_storkconfig_cpepslist_'+nextindex+'__supportsXMLSignature" name="__checkbox_storkconfig.cpepslist['+nextindex+'].supportsXMLSignature" value=""></div>\
+ </div>\
+ </td>\
+ <td>\
+ <input type="button" value="löschen" onclick="this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);"></td>\
+ </tr>';
target.parentNode.appendChild(clone);
}
function newStorkAttribute() {
diff --git a/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp b/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp
index bf5625419..1aeda519f 100644
--- a/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp
+++ b/id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp
@@ -260,6 +260,7 @@
<s:if test="%{storkconfig.cpepslist == null || storkconfig.cpepslist.isEmpty}">
<tr><td><s:textfield name="storkconfig.cpepslist[0].countryCode" value="CC" cssClass="textfield_short"/></td>
<td><s:textfield name="storkconfig.cpepslist[0].URL" value="http://" cssClass="textfield_long"/></td>
+ <td><s:checkbox name="storkconfig.cpepslist[0].supportsXMLSignature" value="true" /></td>
<td><input type="button" value="<%=LanguageHelper.getGUIString("webpages.moaconfig.stork.removepeps", request) %>" onclick='this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);'/></td></tr>
</s:if>
</table>
diff --git a/id/server/data/deploy/conf/moa-id/htmlTemplates/loginFormFull.html b/id/server/data/deploy/conf/moa-id/htmlTemplates/loginFormFull.html
index ef070b8eb..7e2ddc491 100644
--- a/id/server/data/deploy/conf/moa-id/htmlTemplates/loginFormFull.html
+++ b/id/server/data/deploy/conf/moa-id/htmlTemplates/loginFormFull.html
@@ -720,7 +720,7 @@
}
}
function onChangeChecks() {
- if (top.innerWidth < 650) {
+ if (self.innerWidth < 650) {
document.getElementById("moaidform").setAttribute("target","_parent");
} else {
document.getElementById("moaidform").removeAttribute("target");
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java
index ade7d3f3c..4cd192070 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java
@@ -27,7 +27,11 @@ import iaik.x509.X509Certificate;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringWriter;
+import java.net.URL;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Properties;
import javax.activation.DataSource;
import javax.servlet.ServletException;
@@ -68,24 +72,54 @@ import at.gv.util.xsd.xmldsig.X509DataType;
import eu.stork.oasisdss.api.ApiUtils;
import eu.stork.oasisdss.api.LightweightSourceResolver;
import eu.stork.oasisdss.api.exceptions.ApiUtilsException;
+import eu.stork.oasisdss.api.utils.ByteArrayDataSource;
+import eu.stork.oasisdss.profile.DocumentType;
+import eu.stork.oasisdss.profile.DocumentWithSignature;
+import eu.stork.oasisdss.profile.SignRequest;
import eu.stork.oasisdss.profile.SignResponse;
import eu.stork.peps.auth.commons.IPersonalAttributeList;
import eu.stork.peps.auth.commons.PEPSUtil;
import eu.stork.peps.auth.commons.PersonalAttribute;
+import eu.stork.peps.auth.commons.PersonalAttributeList;
+import eu.stork.peps.auth.commons.STORKAttrQueryRequest;
import eu.stork.peps.auth.commons.STORKAuthnRequest;
import eu.stork.peps.auth.commons.STORKAuthnResponse;
import eu.stork.peps.auth.engine.STORKSAMLEngine;
import eu.stork.peps.exceptions.STORKSAMLEngineException;
+import eu.stork.documentservice.DocumentService;
+import eu.stork.documentservice.data.DatabaseConnectorMySQLImpl;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.ws.BindingProvider;
+
+
/**
* Endpoint for receiving STORK response messages
*/
public class PEPSConnectorServlet extends AuthServlet {
+
private static final long serialVersionUID = 1L;
public static final String PEPSCONNECTOR_SERVLET_URL_PATTERN = "/PEPSConnector";
-
+ private String dtlUrl = null;
+
+
+ public PEPSConnectorServlet()
+ {
+ super();
+ Properties props = new Properties();
+ try {
+ props.load(DatabaseConnectorMySQLImpl.class.getResourceAsStream("docservice.properties"));
+ dtlUrl = props.getProperty("docservice.url");
+ } catch (IOException e) {
+ dtlUrl = "http://testvidp.buergerkarte.at/DocumentService/DocumentService";
+ Logger.error("Loading DTL config failed, using default value:"+dtlUrl);
+ e.printStackTrace();
+ }
+ }
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
@@ -245,7 +279,9 @@ public class PEPSConnectorServlet extends AuthServlet {
String citizenSignature = null;
try {
String signatureInfo = authnResponse.getPersonalAttributeList().get("signedDoc").getValue().get(0); // TODO ERROR HANDLING
-
+
+ Logger.debug("signatureInfo:"+signatureInfo);
+
SignResponse dssSignResponse = (SignResponse) ApiUtils.unmarshal(new StreamSource(new java.io.StringReader(signatureInfo)));
// fetch signed doc
@@ -258,6 +294,19 @@ public class PEPSConnectorServlet extends AuthServlet {
citizenSignature = IOUtils.toString(incoming);
incoming.close();
+ Logger.debug("citizenSignature:"+citizenSignature);
+ if(isDocumentServiceUsed(citizenSignature)==true)
+ {
+ Logger.debug("Loading document from DocumentService.");
+ String url = getDtlUrlFromResponse(dssSignResponse);
+ //get Transferrequest
+ String transferRequest = getDocTransferRequest(dssSignResponse.getDocUI(), url);
+ //Load document from DocujmentService
+ byte[] data = getDocumentFromDtl(transferRequest, url);
+ citizenSignature = new String(data, "UTF-8");
+ Logger.debug("Overridung citizenSignature with:"+citizenSignature);
+ }
+
JAXBContext ctx = JAXBContext.newInstance(SignatureType.class.getPackage().getName());
SignatureType root = ((JAXBElement<SignatureType>) ctx.createUnmarshaller().unmarshal(IOUtils.toInputStream(citizenSignature))).getValue();
@@ -423,5 +472,135 @@ public class PEPSConnectorServlet extends AuthServlet {
}
}
+
+ private boolean isDocumentServiceUsed(String citizenSignature) //TODo add better check
+ {
+ if(citizenSignature.contains("<table border=\"0\"><tr><td>Service Name:</td><td>{http://stork.eu}DocumentService</td></tr><tr><td>Port Name:</td><td>{http://stork.eu}DocumentServicePort</td></tr></table>"))
+ return true;
+ return false;
+ }
+
+ /**
+ * Get DTL uril from the oasis sign response
+ * @param signRequest The signature response
+ * @return The URL of DTL service
+ * @throws SimpleException
+ */
+ private String getDtlUrlFromResponse(SignResponse dssSignResponse) {
+ List<DocumentWithSignature> documents = ApiUtils.findNamedElement(dssSignResponse.getOptionalOutputs(),
+ ApiUtils.OPTIONAL_OUTPUT_DOCUMENTWITHSIGNATURE, DocumentWithSignature.class);
+ DocumentType sourceDocument = documents.get(0).getDocument();
+
+ if (sourceDocument.getDocumentURL() != null)
+ return sourceDocument.getDocumentURL();
+ else
+ return null;//throw new Exception("No document url found");
+ }
+
+//From DTLPEPSUTIL
+
+
+
+ /**
+ * Get document from DTL
+ * @param transferRequest The transfer request (attribute query)
+ * @param eDtlUrl The DTL url of external DTL
+ * @return the document data
+ * @throws SimpleException
+ */
+ private byte[] getDocumentFromDtl(String transferRequest, String eDtlUrl) throws Exception
+ {
+ URL url = null;
+ try
+ {
+ url = new URL(dtlUrl);
+ QName qname = new QName("http://stork.eu",
+ "DocumentService");
+
+ Service service = Service.create(url, qname);
+ DocumentService docservice = service.getPort(DocumentService.class);
+
+ BindingProvider bp = (BindingProvider) docservice;
+ SOAPBinding binding = (SOAPBinding) bp.getBinding();
+ binding.setMTOMEnabled(true);
+
+ if (eDtlUrl.equalsIgnoreCase(dtlUrl))
+ return docservice.getDocument(transferRequest, "");
+ else
+ return docservice.getDocument(transferRequest, eDtlUrl);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ throw new Exception("Error in getDocumentFromDtl", e);
+ }
+ }
+
+ /**
+ * Get a document transfer request (attribute query)
+ * @param docId
+ * @return
+ * @throws SimpleException
+ */
+ private String getDocTransferRequest(String docId, String destinationUrl) throws Exception
+ {
+ String spCountry = docId.substring(0, docId.indexOf("/"));
+ final STORKSAMLEngine engine = STORKSAMLEngine.getInstance("VIDP");
+ STORKAttrQueryRequest req = new STORKAttrQueryRequest();
+ req.setAssertionConsumerServiceURL(dtlUrl);
+ req.setDestination(destinationUrl);
+ req.setSpCountry(spCountry);
+ req.setQaa(3);//TODO
+ PersonalAttributeList pal = new PersonalAttributeList();
+ PersonalAttribute attr = new PersonalAttribute();
+ attr.setName("docRequest");
+ attr.setIsRequired(true);
+ attr.setValue(Arrays.asList(docId));
+ pal.add(attr);
+ req.setPersonalAttributeList(pal);
+
+ STORKAttrQueryRequest req1;
+ try {
+ req1 = engine.generateSTORKAttrQueryRequest(req);
+ return PEPSUtil.encodeSAMLTokenUrlSafe(req1.getTokenSaml());
+ } catch (STORKSAMLEngineException e) {
+ e.printStackTrace();
+ throw new Exception("Error in doc request attribute query generation", e);
+ }
+ }
+
+ /**
+ * Get mime type of document from DTL
+ * @param docId The document id
+ * @param dtlUrl The url of dtl
+ * @return The mime type
+ */
+// private String getDocumentMimeFromDtl(String docId, String eDtlUrl) throws Exception
+// {
+// URL url = null;
+// try
+// {
+// url = new URL(dtlUrl);
+// QName qname = new QName("http://stork.eu",
+// "DocumentService");
+//
+// Service service = Service.create(url, qname);
+// DocumentService docservice = service.getPort(DocumentService.class);
+//
+// BindingProvider bp = (BindingProvider) docservice;
+// SOAPBinding binding = (SOAPBinding) bp.getBinding();
+// binding.setMTOMEnabled(true);
+//
+// if (eDtlUrl.equalsIgnoreCase(dtlUrl))
+// return docservice.getDocumentMime(docId, "");
+// else
+// return docservice.getDocumentMime(docId, eDtlUrl);
+// }
+// catch (Exception e)
+// {
+// e.printStackTrace();
+// throw new Exception("Error in getDocumentFromDtl", e);
+// }
+// }
}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/data/AuthenticationData.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/data/AuthenticationData.java
index e20c805ac..65c413ef9 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/data/AuthenticationData.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/data/AuthenticationData.java
@@ -233,7 +233,7 @@ public class AuthenticationData implements IAuthData, Serializable {
if (getDateOfBirth() != null)
return pvpDateFormat.format(getDateOfBirth());
else
- return "1900-01-01";
+ return "2999-12-31";
}
/**
diff --git a/id/server/idserverlib/src/main/resources/resources/templates/loginFormFull.html b/id/server/idserverlib/src/main/resources/resources/templates/loginFormFull.html
index ef070b8eb..7e2ddc491 100644
--- a/id/server/idserverlib/src/main/resources/resources/templates/loginFormFull.html
+++ b/id/server/idserverlib/src/main/resources/resources/templates/loginFormFull.html
@@ -720,7 +720,7 @@
}
}
function onChangeChecks() {
- if (top.innerWidth < 650) {
+ if (self.innerWidth < 650) {
document.getElementById("moaidform").setAttribute("target","_parent");
} else {
document.getElementById("moaidform").removeAttribute("target");
diff --git a/id/server/idserverlib/src/main/resources/resources/templates/saml2-post-binding-moa.vm b/id/server/idserverlib/src/main/resources/resources/templates/saml2-post-binding-moa.vm
index cac0bda76..8beb601c6 100644
--- a/id/server/idserverlib/src/main/resources/resources/templates/saml2-post-binding-moa.vm
+++ b/id/server/idserverlib/src/main/resources/resources/templates/saml2-post-binding-moa.vm
@@ -18,7 +18,7 @@
</p>
</noscript>
- <form action="${action}" method="post" target="_parent">
+ <form action="${action}" method="post" target="_top">
<div>
#if($RelayState)<input type="hidden" name="RelayState" value="${RelayState}"/>#end
diff --git a/id/server/moa-id-commons/pom.xml b/id/server/moa-id-commons/pom.xml
index ebda03801..2ca351e81 100644
--- a/id/server/moa-id-commons/pom.xml
+++ b/id/server/moa-id-commons/pom.xml
@@ -175,7 +175,8 @@
<artifactId>maven-hyperjaxb3-plugin</artifactId>
<version>0.5.6</version>
<executions>
- <execution>
+ <execution>
+ <phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
diff --git a/pom.xml b/pom.xml
index 89f710a4c..9cf5c14e2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -15,7 +15,7 @@
<moa-id-version>2.1.1</moa-id-version>
<moa-id-proxy-version>2.0.0</moa-id-proxy-version>
<moa-spss-version>2.0.2</moa-spss-version>
- <configtool-version>1.1.2</configtool-version>
+ <configtool-version>1.1.3</configtool-version>
<demo-oa-version>2.0.2</demo-oa-version>
</properties>