From 2c63ca5a3d8b7fe4583e96abe33cde589ade9d54 Mon Sep 17 00:00:00 2001 From: Alexander Marsalek Date: Thu, 16 Oct 2014 15:07:14 +0200 Subject: config -newpeps() fix --- id/ConfigWebTool/src/main/webapp/js/common.js | 3 ++- id/ConfigWebTool/src/main/webapp/jsp/editMOAConfig.jsp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'id/ConfigWebTool/src/main') diff --git a/id/ConfigWebTool/src/main/webapp/js/common.js b/id/ConfigWebTool/src/main/webapp/js/common.js index f7ef2c415..24702807f 100644 --- a/id/ConfigWebTool/src/main/webapp/js/common.js +++ b/id/ConfigWebTool/src/main/webapp/js/common.js @@ -232,8 +232,9 @@ function newPeps() { var nextindex = lastindex + 1; clone.innerHTML = clone.innerHTML.replace(/[A-Z]{2}/, '
'); + clone.innerHTML = clone.innerHTML.replace(//, '
'); clone.innerHTML = clone.innerHTML.replace(/name="storkconfig.cpepslist\[\d/g, 'name="storkconfig.cpepslist[' + nextindex); + clone.innerHTML = clone.innerHTML.replace(/name="wwgrp_loadGeneralConfig_storkconfig_cpepslist_\d/g, 'name="wwgrp_loadGeneralConfig_storkconfig_cpepslist_' + nextindex); clone.innerHTML = clone.innerHTML.replace(/(.*" value=").*?(".*)/g, '$1$2'); target.parentNode.appendChild(clone); } 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 @@ + " onclick='this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);'/> -- cgit v1.2.3 From 20698a2dcef3de3a8364d2906354c556de0230cd Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Tue, 21 Oct 2014 10:21:45 +0200 Subject: remove debug log messages --- .../struts/action/EditGeneralConfigAction.java | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'id/ConfigWebTool/src/main') 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..a4ca3e403 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 @@ -222,15 +222,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 +523,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()); -- cgit v1.2.3 From 79867a72c06e4230428d3755509f1bf7b50f9914 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Wed, 22 Oct 2014 14:43:55 +0200 Subject: add PVP gateway configuration into configWebTool --- .../data/oa/PVPGatewayInterfederationConfig.java | 134 +++++++++++++++++++++ .../struts/action/IDPGatewayAction.java | 56 +++++++++ .../struts/action/InterfederationIDPAction.java | 13 ++ .../resources/applicationResources_de.properties | 7 +- .../resources/applicationResources_en.properties | 5 +- id/ConfigWebTool/src/main/resources/struts.xml | 12 ++ .../main/webapp/jsp/interfederation/pvpgateway.jsp | 61 ++++++++++ .../src/main/webapp/jsp/snippets/OA/pvpgateway.jsp | 18 +++ 8 files changed, 303 insertions(+), 3 deletions(-) create mode 100644 id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/PVPGatewayInterfederationConfig.java create mode 100644 id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/IDPGatewayAction.java create mode 100644 id/ConfigWebTool/src/main/webapp/jsp/interfederation/pvpgateway.jsp create mode 100644 id/ConfigWebTool/src/main/webapp/jsp/snippets/OA/pvpgateway.jsp (limited to 'id/ConfigWebTool/src/main') diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/PVPGatewayInterfederationConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/PVPGatewayInterfederationConfig.java new file mode 100644 index 000000000..d6cbaf952 --- /dev/null +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/PVPGatewayInterfederationConfig.java @@ -0,0 +1,134 @@ +/* + * 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.data.oa; + +import java.util.ArrayList; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.log4j.Logger; + +import at.gv.egovernment.moa.id.commons.db.dao.config.InterfederationGatewayType; +import at.gv.egovernment.moa.id.commons.db.dao.config.InterfederationIDPType; +import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; +import at.gv.egovernment.moa.id.commons.validation.ValidationHelper; +import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser; +import at.gv.egovernment.moa.id.configuration.helper.LanguageHelper; +import at.gv.egovernment.moa.util.MiscUtil; + +/** + * @author tlenz + * + */ +public class PVPGatewayInterfederationConfig implements IOnlineApplicationData { + + private static final Logger log = Logger.getLogger(PVPGatewayInterfederationConfig.class); + + private String entityID = null; + + /* (non-Javadoc) + * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#getName() + */ + @Override + public String getName() { + return "PVPGatewayInterfederation"; + } + + /* (non-Javadoc) + * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#parse(at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication, at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser, javax.servlet.http.HttpServletRequest) + */ + @Override + public List parse(OnlineApplication dbOA, + AuthenticatedUser authUser, HttpServletRequest request) { + + InterfederationGatewayType gateway = dbOA.getInterfederationGateway(); + if (gateway != null) { + this.entityID = gateway.getForwardIDPIdentifier(); + + } + + return null; + } + + /* (non-Javadoc) + * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#store(at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication, at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser, javax.servlet.http.HttpServletRequest) + */ + @Override + public String store(OnlineApplication dbOA, AuthenticatedUser authUser, + HttpServletRequest request) { + + if (authUser.isAdmin()) { + dbOA.setIsInterfederationGateway(true); + + InterfederationGatewayType gateway = dbOA.getInterfederationGateway(); + if (gateway == null) { + gateway = new InterfederationGatewayType(); + dbOA.setInterfederationGateway(gateway); + } + + gateway.setForwardIDPIdentifier(entityID); + } + + return null; + } + + /* (non-Javadoc) + * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#validate(at.gv.egovernment.moa.id.configuration.data.oa.OAGeneralConfig, at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser, javax.servlet.http.HttpServletRequest) + */ + @Override + public List validate(OAGeneralConfig general, + AuthenticatedUser authUser, HttpServletRequest request) { + + List errors = new ArrayList(); + + if (MiscUtil.isNotEmpty(entityID)) { + if (!ValidationHelper.validateURL(entityID)) { + log.info("PVP gateway EntityID is not valid"); + errors.add(LanguageHelper.getErrorString("validation.interfederation.gateway.entityID.valid", request)); + + } + + } else + errors.add(LanguageHelper.getErrorString("validation.interfederation.gateway.entityID.empty", request)); + + return errors; + } + + /** + * @return the entityID + */ + public String getEntityID() { + return entityID; + } + + /** + * @param entityID the entityID to set + */ + public void setEntityID(String entityID) { + this.entityID = entityID; + } + + + +} diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/IDPGatewayAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/IDPGatewayAction.java new file mode 100644 index 000000000..e238c6d37 --- /dev/null +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/IDPGatewayAction.java @@ -0,0 +1,56 @@ +/* + * 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.action; + +import java.util.LinkedHashMap; + +import at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData; +import at.gv.egovernment.moa.id.configuration.data.oa.OAMOAIDPInterfederationConfig; +import at.gv.egovernment.moa.id.configuration.data.oa.OAPVP2Config; +import at.gv.egovernment.moa.id.configuration.data.oa.PVPGatewayInterfederationConfig; + +/** + * @author tlenz + * + */ +public class IDPGatewayAction extends InterfederationIDPAction { + + private static final long serialVersionUID = -2047128481980413334L; + + public IDPGatewayAction() { + super(); + formList.putAll(buildIDPGatewayFormList()); + } + + public static LinkedHashMap buildIDPGatewayFormList() { + + LinkedHashMap forms = + new LinkedHashMap(); + + PVPGatewayInterfederationConfig pvpGatewayconfig = new PVPGatewayInterfederationConfig(); + forms.put(pvpGatewayconfig.getName(), pvpGatewayconfig); + + return forms; + } + +} 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..589f7d714 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 @@ -46,6 +46,7 @@ import at.gv.egovernment.moa.id.configuration.data.oa.OAMOAIDPInterfederationCon import at.gv.egovernment.moa.id.configuration.data.oa.OAOAuth20Config; import at.gv.egovernment.moa.id.configuration.data.oa.OASTORKConfig; import at.gv.egovernment.moa.id.configuration.data.oa.OATargetConfiguration; +import at.gv.egovernment.moa.id.configuration.data.oa.PVPGatewayInterfederationConfig; import at.gv.egovernment.moa.id.configuration.exception.BasicActionException; import at.gv.egovernment.moa.id.configuration.exception.BasicOAActionException; import at.gv.egovernment.moa.id.configuration.helper.FormDataHelper; @@ -63,6 +64,7 @@ public class InterfederationIDPAction extends BasicOAAction { public static final String STRUTS_IDP_VIDP = "-VIDP"; public static final String STRUTS_IDP_MOA = "-MOAIDP"; + public static final String STRUTS_IDP_GATEWAY = "-IDPGATEWAY"; private List formOAs; @@ -122,6 +124,9 @@ public class InterfederationIDPAction extends BasicOAAction { if (STRUTS_IDP_MOA.equals(interfederationType)) { formList.putAll(MOAIDPAction.buildMOAIDPFormList()); + + } else if (STRUTS_IDP_GATEWAY.equals(interfederationType)) { + formList.putAll(IDPGatewayAction.buildIDPGatewayFormList()); } else if (STRUTS_IDP_VIDP.equals(interfederationType)) { formList.putAll(VIDPAction.buildVIDPFormList()); @@ -403,6 +408,14 @@ public class InterfederationIDPAction extends BasicOAAction { formList.put(pvp2oa.getName(), pvp2oa); } + public PVPGatewayInterfederationConfig getPVPGateway() { + return (PVPGatewayInterfederationConfig) formList.get(new PVPGatewayInterfederationConfig().getName()); + } + + public void setPVPGateway(PVPGatewayInterfederationConfig val) { + formList.put(val.getName(), val); + } + /** * @return the formOA */ diff --git a/id/ConfigWebTool/src/main/resources/applicationResources_de.properties b/id/ConfigWebTool/src/main/resources/applicationResources_de.properties index 39bfcd36b..02133494f 100644 --- a/id/ConfigWebTool/src/main/resources/applicationResources_de.properties +++ b/id/ConfigWebTool/src/main/resources/applicationResources_de.properties @@ -111,6 +111,7 @@ webpages.inderfederation.moaid.attributQueryURL=AttributQuery Service URL webpages.interfederation.new.header=Neuen Identity Provider hinzuf\u00FCgen webpages.interfederation.new.vidp=STORK VIDP webpages.interfederation.new.moaid=MOA-ID IDP +webpages.inderfederation.gateway.entityID=EntityID des PVP Portals @@ -492,9 +493,11 @@ validation.pvp2.metadata.validation=Die Metadaten konnten von der angegebenen UR validation.sso.logouturl.empty=Eine URL zum Single Log-Out Service ist erforderlich. validation.sso.logouturl.valid=Die URL zum Single Log-Out Service wei\u00DFt kein g\u00FCltiges Format auf. -validation.interfederation.moaidp.queryurl.valid=Die URL zum zum AttributQuery Service wei\u00DFt kein g\u00FCltiges Format auf. -validation.interfederation.moaidp.queryurl.empty=Die URL zum zum AttributQuery Service muss f\u00FCr eingehende Single Sign-On Interfederation konfiguriert werden. +validation.interfederation.moaidp.queryurl.valid=Die URL zum AttributQuery Service wei\u00DFt kein g\u00FCltiges Format auf. +validation.interfederation.moaidp.queryurl.empty=Die URL zum AttributQuery Service muss konfiguriert werden. validation.interfederation.moaidp.metadataurl.publicservice=Die Domain des Metadaten Services f\u00FCr diesen IDP erlaubt nur Applikationen aus dem privatwirtschaftlichen Bereich. +validation.interfederation.gateway.entityID.valid=Die EntityID zum PVP Portal wei\u00DFt kein g\u00FCltiges Format auf. +validation.interfederation.gateway.entityID.empty=Die EntityID zum PVP Portal muss konfiguriert werden. validation.saml1.providestammzahl=ProvideStammZahl kann nicht mit Applikationen aus dem privatwirtschaftlichen Bereich kombiniert werden. diff --git a/id/ConfigWebTool/src/main/resources/applicationResources_en.properties b/id/ConfigWebTool/src/main/resources/applicationResources_en.properties index 07c8d708d..a8c784e1d 100644 --- a/id/ConfigWebTool/src/main/resources/applicationResources_en.properties +++ b/id/ConfigWebTool/src/main/resources/applicationResources_en.properties @@ -111,6 +111,7 @@ webpages.inderfederation.moaid.attributQueryURL=AttributQuery service URL webpages.interfederation.new.header=Add new Identity Provider webpages.interfederation.new.vidp=STORK VIDP webpages.interfederation.new.moaid=MOA-ID IDP +webpages.inderfederation.gateway.entityID=PVP portal EntityID webpages.moaconfig.save.success=MOA-ID has been successfully saved. webpages.moaconfig.header=General configuration @@ -490,8 +491,10 @@ validation.sso.logouturl.empty=URL for Single Log-Out Service is necessary. validation.sso.logouturl.valid=URL for Single Log-Out Service has incorrect format. validation.interfederation.moaidp.queryurl.valid=URL for AttributQuery Service has incorrect format. -validation.interfederation.moaidp.queryurl.empty=URL for AttributQuery Service is necessary for inbound Single Sign-On interfederation. +validation.interfederation.moaidp.queryurl.empty=URL for AttributQuery Service is necessary. validation.interfederation.moaidp.metadataurl.publicservice=The domain of Metadata service for that IDP permits private sector only. +validation.interfederation.gateway.entityID.valid=PVP portal EntityID has an incorrect format. +validation.interfederation.gateway.entityID.empty=PVP portal EntityID is necessary. validation.saml1.providestammzahl=ProvideSourcePIN cannot be combined with applications from private sector. diff --git a/id/ConfigWebTool/src/main/resources/struts.xml b/id/ConfigWebTool/src/main/resources/struts.xml index 68cd85b2f..180877494 100644 --- a/id/ConfigWebTool/src/main/resources/struts.xml +++ b/id/ConfigWebTool/src/main/resources/struts.xml @@ -391,6 +391,7 @@ /jsp/interfederation/vidp.jsp /jsp/interfederation/moa_idp.jsp + /jsp/interfederation/pvpgateway.jsp main /error.jsp @@ -412,6 +413,17 @@ + + main + /jsp/interfederation/pvpgateway.jsp + /error.jsp + + logout + / + + + + main /jsp/interfederation/vidp.jsp diff --git a/id/ConfigWebTool/src/main/webapp/jsp/interfederation/pvpgateway.jsp b/id/ConfigWebTool/src/main/webapp/jsp/interfederation/pvpgateway.jsp new file mode 100644 index 000000000..ee86c4b91 --- /dev/null +++ b/id/ConfigWebTool/src/main/webapp/jsp/interfederation/pvpgateway.jsp @@ -0,0 +1,61 @@ +<%@page import="at.gv.egovernment.moa.id.configuration.helper.LanguageHelper"%> + +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@ taglib prefix="s" uri="/struts-tags" %> + + + + + + + <%=LanguageHelper.getGUIString("title", request) %> + + + + + + + + + + +
+ +
+ + +
+
+ + +
+

<%=LanguageHelper.getGUIString("webpages.interfederation.header", request) %>

+ + + + + + + + + + +
+ + + + + +
+ +
+ +
+
+ +
+ + + + + \ No newline at end of file diff --git a/id/ConfigWebTool/src/main/webapp/jsp/snippets/OA/pvpgateway.jsp b/id/ConfigWebTool/src/main/webapp/jsp/snippets/OA/pvpgateway.jsp new file mode 100644 index 000000000..8acd725c7 --- /dev/null +++ b/id/ConfigWebTool/src/main/webapp/jsp/snippets/OA/pvpgateway.jsp @@ -0,0 +1,18 @@ +<%@page import="at.gv.egovernment.moa.id.configuration.helper.LanguageHelper"%> +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@ taglib prefix="s" uri="/struts-tags" %> + + +
+

<%=LanguageHelper.getGUIString("webpages.inderfederation.moaid.header", request) %>

+ + + + +
+ + \ No newline at end of file -- cgit v1.2.3 From 479f2dc2f37b0bcdc9317e6d740d1e173b34bbb4 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Fri, 24 Oct 2014 13:42:13 +0200 Subject: update configtool for STORK-PVP gateway configuration --- .../moa/id/configuration/data/OAListElement.java | 2 +- .../data/oa/OAMOAIDPInterfederationConfig.java | 50 ++++++++++++++++++---- .../data/oa/PVPGatewayInterfederationConfig.java | 2 + .../id/configuration/helper/FormDataHelper.java | 3 ++ .../struts/action/InterfederationIDPAction.java | 5 +++ .../resources/applicationResources_de.properties | 3 ++ .../resources/applicationResources_en.properties | 3 ++ id/ConfigWebTool/src/main/resources/struts.xml | 1 + .../main/webapp/jsp/interfederation/idplist.jsp | 6 ++- .../webapp/jsp/snippets/OA/interfederation.jsp | 10 +++++ .../src/main/webapp/jsp/snippets/OA/pvpgateway.jsp | 4 +- 11 files changed, 77 insertions(+), 12 deletions(-) (limited to 'id/ConfigWebTool/src/main') diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/OAListElement.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/OAListElement.java index c4a825589..28eba9f34 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/OAListElement.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/OAListElement.java @@ -24,7 +24,7 @@ package at.gv.egovernment.moa.id.configuration.data; public class OAListElement { - public enum ServiceType {OA, VIDP, IDP} + public enum ServiceType {OA, VIDP, IDP, GWAY} private long dataBaseID; private String oaIdentifier; diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAMOAIDPInterfederationConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAMOAIDPInterfederationConfig.java index 9431cc1fd..2f9df18aa 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAMOAIDPInterfederationConfig.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAMOAIDPInterfederationConfig.java @@ -45,9 +45,11 @@ public class OAMOAIDPInterfederationConfig implements IOnlineApplicationData { private static final Logger log = Logger.getLogger(OAMOAIDPInterfederationConfig.class); private String queryURL; - private boolean inboundSSO = true; - private boolean outboundSSO = true; - private boolean storeSSOSession = true; + private Boolean inboundSSO = true; + private Boolean outboundSSO = true; + private Boolean storeSSOSession = true; + private Boolean passiveRequest = true; + private Boolean localAuthOnError = true; /* (non-Javadoc) * @see at.gv.egovernment.moa.id.configuration.data.oa.IOnlineApplicationData#getName() @@ -70,6 +72,8 @@ public class OAMOAIDPInterfederationConfig implements IOnlineApplicationData { this.inboundSSO = moaIDP.isInboundSSO(); this.outboundSSO = moaIDP.isOutboundSSO(); this.storeSSOSession = moaIDP.isStoreSSOSession(); + this.localAuthOnError = moaIDP.isPerformLocalAuthenticationOnError(); + this.passiveRequest = moaIDP.isPerformPassivRequest(); } return null; @@ -95,8 +99,10 @@ public class OAMOAIDPInterfederationConfig implements IOnlineApplicationData { moaIDP.setInboundSSO(inboundSSO); moaIDP.setOutboundSSO(outboundSSO); moaIDP.setStoreSSOSession(storeSSOSession); - } - + moaIDP.setPerformLocalAuthenticationOnError(localAuthOnError); + moaIDP.setPerformPassivRequest(passiveRequest); + + } return null; } @@ -143,7 +149,7 @@ public class OAMOAIDPInterfederationConfig implements IOnlineApplicationData { * @return the inboundSSO */ public boolean isInboundSSO() { - return inboundSSO; + return inboundSSO.booleanValue(); } /** @@ -157,7 +163,7 @@ public class OAMOAIDPInterfederationConfig implements IOnlineApplicationData { * @return the outboundSSO */ public boolean isOutboundSSO() { - return outboundSSO; + return outboundSSO.booleanValue(); } /** @@ -171,7 +177,7 @@ public class OAMOAIDPInterfederationConfig implements IOnlineApplicationData { * @return the storeSSOSession */ public boolean isStoreSSOSession() { - return storeSSOSession; + return storeSSOSession.booleanValue(); } /** @@ -180,6 +186,34 @@ public class OAMOAIDPInterfederationConfig implements IOnlineApplicationData { public void setStoreSSOSession(boolean storeSSOSession) { this.storeSSOSession = storeSSOSession; } + + /** + * @return the passiveRequest + */ + public boolean isPassiveRequest() { + return passiveRequest.booleanValue(); + } + + /** + * @param passiveRequest the passiveRequest to set + */ + public void setPassiveRequest(boolean passiveRequest) { + this.passiveRequest = passiveRequest; + } + + /** + * @return the localAuthOnError + */ + public boolean isLocalAuthOnError() { + return localAuthOnError.booleanValue(); + } + + /** + * @param localAuthOnError the localAuthOnError to set + */ + public void setLocalAuthOnError(boolean localAuthOnError) { + this.localAuthOnError = localAuthOnError; + } diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/PVPGatewayInterfederationConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/PVPGatewayInterfederationConfig.java index d6cbaf952..23af59d8e 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/PVPGatewayInterfederationConfig.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/PVPGatewayInterfederationConfig.java @@ -33,6 +33,7 @@ import at.gv.egovernment.moa.id.commons.db.dao.config.InterfederationGatewayType import at.gv.egovernment.moa.id.commons.db.dao.config.InterfederationIDPType; import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; import at.gv.egovernment.moa.id.commons.validation.ValidationHelper; +import at.gv.egovernment.moa.id.configuration.Constants; import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser; import at.gv.egovernment.moa.id.configuration.helper.LanguageHelper; import at.gv.egovernment.moa.util.MiscUtil; @@ -90,6 +91,7 @@ public class PVPGatewayInterfederationConfig implements IOnlineApplicationData { gateway.setForwardIDPIdentifier(entityID); } + dbOA.setType(Constants.MOA_CONFIG_BUSINESSSERVICE); return null; } diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/helper/FormDataHelper.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/helper/FormDataHelper.java index dc97dd2c8..150483dd8 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/helper/FormDataHelper.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/helper/FormDataHelper.java @@ -43,6 +43,9 @@ public class FormDataHelper { if (dboa.isIsInterfederationIDP()!= null && dboa.isIsInterfederationIDP()) formOAs.add(addOAFormListElement(dboa, ServiceType.IDP)); + else if (dboa.isIsInterfederationGateway()!= null && dboa.isIsInterfederationGateway()) + formOAs.add(addOAFormListElement(dboa, ServiceType.GWAY)); + else if (dboa.getAuthComponentOA().getOASTORK() != null && dboa.getAuthComponentOA().getOASTORK().isVidpEnabled() != null && dboa.getAuthComponentOA().getOASTORK().isVidpEnabled()) 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 589f7d714..d2d318413 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 @@ -179,6 +179,10 @@ public class InterfederationIDPAction extends BasicOAAction { getStorkOA().getAttributeProviderPlugins().add(new AttributeProviderPlugin()); interfederationType = STRUTS_IDP_VIDP; + } else if (oa.isIsInterfederationGateway() != null && oa.isIsInterfederationGateway()) { + formList.putAll(IDPGatewayAction.buildIDPGatewayFormList()); + interfederationType = STRUTS_IDP_GATEWAY; + } else { log.warn("Requested application is not an interfederation IDP."); return Constants.STRUTS_NOTALLOWED; @@ -215,6 +219,7 @@ public class InterfederationIDPAction extends BasicOAAction { if ( onlineapplication != null && !((onlineapplication.isIsInterfederationIDP() != null && onlineapplication.isIsInterfederationIDP()) || + (onlineapplication.isIsInterfederationGateway() != null && onlineapplication.isIsInterfederationGateway()) || (onlineapplication.getAuthComponentOA().getOASTORK() != null && onlineapplication.getAuthComponentOA().getOASTORK().isVidpEnabled() != null && onlineapplication.getAuthComponentOA().getOASTORK().isVidpEnabled()))) { diff --git a/id/ConfigWebTool/src/main/resources/applicationResources_de.properties b/id/ConfigWebTool/src/main/resources/applicationResources_de.properties index 02133494f..072f44981 100644 --- a/id/ConfigWebTool/src/main/resources/applicationResources_de.properties +++ b/id/ConfigWebTool/src/main/resources/applicationResources_de.properties @@ -108,9 +108,12 @@ webpages.inderfederation.moaid.inboundSSO=Eingehendes SSO erlauben webpages.inderfederation.moaid.outboundSSO=Ausgehendes SSO erlauben webpages.inderfederation.moaid.storeSSOSession=SSO Session speichern webpages.inderfederation.moaid.attributQueryURL=AttributQuery Service URL +webpages.inderfederation.moaid.sendPassivRequest=Verwende SAML2 isPassive Attribut +webpages.inderfederation.moaid.perfomLocalAuthOnError=Im Fehlerfall Authentifizierung lokal durchf\u00FChren webpages.interfederation.new.header=Neuen Identity Provider hinzuf\u00FCgen webpages.interfederation.new.vidp=STORK VIDP webpages.interfederation.new.moaid=MOA-ID IDP +webpages.interfederation.new.gateway=STORK<->PVP Gateway webpages.inderfederation.gateway.entityID=EntityID des PVP Portals diff --git a/id/ConfigWebTool/src/main/resources/applicationResources_en.properties b/id/ConfigWebTool/src/main/resources/applicationResources_en.properties index a8c784e1d..b717377e0 100644 --- a/id/ConfigWebTool/src/main/resources/applicationResources_en.properties +++ b/id/ConfigWebTool/src/main/resources/applicationResources_en.properties @@ -108,9 +108,12 @@ webpages.inderfederation.moaid.inboundSSO=Allow inbound SSO webpages.inderfederation.moaid.outboundSSO=Allow outbound SSO webpages.inderfederation.moaid.storeSSOSession=Store SSO session webpages.inderfederation.moaid.attributQueryURL=AttributQuery service URL +webpages.inderfederation.moaid.sendPassivRequest=Use SAML2 isPassive attribute +webpages.inderfederation.moaid.perfomLocalAuthOnError=Local authentication in case of an error webpages.interfederation.new.header=Add new Identity Provider webpages.interfederation.new.vidp=STORK VIDP webpages.interfederation.new.moaid=MOA-ID IDP +webpages.interfederation.new.gateway=STORK<->PVP Gateway webpages.inderfederation.gateway.entityID=PVP portal EntityID webpages.moaconfig.save.success=MOA-ID has been successfully saved. diff --git a/id/ConfigWebTool/src/main/resources/struts.xml b/id/ConfigWebTool/src/main/resources/struts.xml index 180877494..f383ad524 100644 --- a/id/ConfigWebTool/src/main/resources/struts.xml +++ b/id/ConfigWebTool/src/main/resources/struts.xml @@ -379,6 +379,7 @@ /jsp/interfederation/vidp.jsp /jsp/interfederation/moa_idp.jsp + /jsp/interfederation/pvpgateway.jsp main /error.jsp diff --git a/id/ConfigWebTool/src/main/webapp/jsp/interfederation/idplist.jsp b/id/ConfigWebTool/src/main/webapp/jsp/interfederation/idplist.jsp index 3e7404dfc..ef666b357 100644 --- a/id/ConfigWebTool/src/main/webapp/jsp/interfederation/idplist.jsp +++ b/id/ConfigWebTool/src/main/webapp/jsp/interfederation/idplist.jsp @@ -46,7 +46,11 @@ - + + + + + diff --git a/id/ConfigWebTool/src/main/webapp/jsp/snippets/OA/interfederation.jsp b/id/ConfigWebTool/src/main/webapp/jsp/snippets/OA/interfederation.jsp index 97d21bcb4..b104e0fa7 100644 --- a/id/ConfigWebTool/src/main/webapp/jsp/snippets/OA/interfederation.jsp +++ b/id/ConfigWebTool/src/main/webapp/jsp/snippets/OA/interfederation.jsp @@ -20,6 +20,16 @@ labelposition="left" cssClass="checkbox" name="moaIDP.storeSSOSession"> + + + +

<%=LanguageHelper.getGUIString("webpages.inderfederation.moaid.header", request) %>

- -- cgit v1.2.3 From bda377810ebe5467439d2098d683788ba4e7e602 Mon Sep 17 00:00:00 2001 From: Alexander Marsalek Date: Fri, 24 Oct 2014 15:39:56 +0200 Subject: newPeps() fix --- id/ConfigWebTool/src/main/webapp/js/common.js | 35 ++++++++++++++++++++------- 1 file changed, 26 insertions(+), 9 deletions(-) (limited to 'id/ConfigWebTool/src/main') diff --git a/id/ConfigWebTool/src/main/webapp/js/common.js b/id/ConfigWebTool/src/main/webapp/js/common.js index 24702807f..9f19e88a2 100644 --- a/id/ConfigWebTool/src/main/webapp/js/common.js +++ b/id/ConfigWebTool/src/main/webapp/js/common.js @@ -223,19 +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(/name="storkconfig.cpepslist\[\d/g, 'name="storkconfig.cpepslist[' + nextindex); - clone.innerHTML = clone.innerHTML.replace(/name="wwgrp_loadGeneralConfig_storkconfig_cpepslist_\d/g, 'name="wwgrp_loadGeneralConfig_storkconfig_cpepslist_' + nextindex); - clone.innerHTML = clone.innerHTML.replace(/(.*" value=").*?(".*)/g, '$1$2'); + clone.innerHTML = '\ + \ +
\ +
\ +
\ +
\ + \ + \ +
\ +
\ +
\ +
\ + \ + \ +
\ +
\ + \ +
\ +
\ + \ + \ + \ + '; target.parentNode.appendChild(clone); } function newStorkAttribute() { -- cgit v1.2.3 From 576f0cd61a686576267c05792d42b69ecbaf4b53 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Tue, 28 Oct 2014 12:39:57 +0100 Subject: add STRUTS2 interceptor for hibernate session management --- .../interceptor/HibernateSessionInterceptor.java | 59 ++++++++++++++++++++++ id/ConfigWebTool/src/main/resources/struts.xml | 6 +++ 2 files changed, 65 insertions(+) create mode 100644 id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/interceptor/HibernateSessionInterceptor.java (limited to 'id/ConfigWebTool/src/main') 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/resources/struts.xml b/id/ConfigWebTool/src/main/resources/struts.xml index 68cd85b2f..74ef3be10 100644 --- a/id/ConfigWebTool/src/main/resources/struts.xml +++ b/id/ConfigWebTool/src/main/resources/struts.xml @@ -16,7 +16,10 @@ + + + ^class\..*,^dojo\..*,^struts\..*,^session\..*,^request\..*,^application\..*,^servlet(Request|Response)\..*,^parameters\..*,^method:.* @@ -85,7 +88,10 @@ + + + ^class\..*,^dojo\..*,^struts\..*,^session\..*,^request\..*,^application\..*,^servlet(Request|Response)\..*,^parameters\..*,^method:.* -- cgit v1.2.3 From 41b1942dc69f1284894270e724ef517fb689f075 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Tue, 28 Oct 2014 12:41:10 +0100 Subject: solve problems with multithreading and hibernate session --- .../id/configuration/data/GeneralStorkConfig.java | 19 +- .../id/configuration/data/oa/OASTORKConfig.java | 23 +- .../struts/action/EditGeneralConfigAction.java | 10 +- .../configuration/struts/action/EditOAAction.java | 384 +++++++++++---------- .../struts/action/InterfederationIDPAction.java | 90 ++--- .../id/configuration/utils/UserRequestCleaner.java | 3 +- 6 files changed, 292 insertions(+), 237 deletions(-) (limited to 'id/ConfigWebTool/src/main') 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 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 citizenCountries; private List enabledCitizenCountries; + private MOAIDConfiguration dbconfig = null; + public OASTORKConfig() { // fetch available citizen countries citizenCountries = new ArrayList(); + + 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(); 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 result = new ArrayList(); 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 errors = new ArrayList(); + + // 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 openOAs = ConfigurationDBRead + .getAllNewOnlineApplications(); + if (openOAs != null) + numoas = openOAs.size(); + + List 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 errors = new ArrayList(); - - // 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 openOAs = ConfigurationDBRead - .getAllNewOnlineApplications(); - if (openOAs != null) - numoas = openOAs.size(); - - List 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 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 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) { -- cgit v1.2.3 From def91ef4b2e19c18aa1f17de391fe08f165292a8 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Thu, 30 Oct 2014 14:40:28 +0100 Subject: fix problems with non-admin user --- .../moa/id/configuration/struts/action/BasicOAAction.java | 9 ++++++--- .../moa/id/configuration/struts/action/EditOAAction.java | 5 ++++- id/ConfigWebTool/src/main/resources/struts.xml | 2 +- id/ConfigWebTool/src/main/webapp/jsp/openadminrequests.jsp | 4 +++- 4 files changed, 14 insertions(+), 6 deletions(-) (limited to 'id/ConfigWebTool/src/main') diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/BasicOAAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/BasicOAAction.java index 9c1cb90e0..415e1c957 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/BasicOAAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/BasicOAAction.java @@ -401,9 +401,7 @@ public class BasicOAAction extends BasicAction { form.store(dboa, authUser, request); try { - if (dboa.isIsNew()) { - ConfigurationDBUtils.save(dboa); - + if (dboa.isIsNew()) { if (!authUser.isAdmin()) { UserDatabase user = ConfigurationDBRead.getUserWithID(authUser.getUserID()); @@ -412,7 +410,12 @@ public class BasicOAAction extends BasicAction { useroas.add(dboa); ConfigurationDBUtils.saveOrUpdate(user); + + } else { + ConfigurationDBUtils.save(dboa); + } + } else ConfigurationDBUtils.saveOrUpdate(dboa); 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 1893b0f60..4cd556b75 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 @@ -346,8 +346,11 @@ public class EditOAAction extends BasicOAAction { ConfigurationDBUtils.saveOrUpdate(moaconfig); } + } catch (NullPointerException e) { + log.debug("Found no MetadataURL in OA-Databaseconfig"); + } catch (Throwable e) { - log.info("Found no MetadataURL in OA-Databaseconfig!", e); + log.info("Set metadata refresh flag FAILED.", e); } if (ConfigurationDBUtils.delete(onlineapplication)) { diff --git a/id/ConfigWebTool/src/main/resources/struts.xml b/id/ConfigWebTool/src/main/resources/struts.xml index 31f3889de..39c38ae43 100644 --- a/id/ConfigWebTool/src/main/resources/struts.xml +++ b/id/ConfigWebTool/src/main/resources/struts.xml @@ -155,7 +155,7 @@ /jsp/editOAGeneral.jsp - main + /jsp/mainpage.jsp /error.jsp logout diff --git a/id/ConfigWebTool/src/main/webapp/jsp/openadminrequests.jsp b/id/ConfigWebTool/src/main/webapp/jsp/openadminrequests.jsp index 954bf9b8b..0cd861884 100644 --- a/id/ConfigWebTool/src/main/webapp/jsp/openadminrequests.jsp +++ b/id/ConfigWebTool/src/main/webapp/jsp/openadminrequests.jsp @@ -38,7 +38,9 @@

<%=LanguageHelper.getGUIString("webpages.openadminrequests.oas.header", request) %>

- + + loadOA +
-- cgit v1.2.3 From d624a3ec33b8e3a4e80aa64f05caa8df5d1fcb42 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Fri, 31 Oct 2014 11:11:29 +0100 Subject: fix MOA-IDP stored twince --- .../moa/id/configuration/struts/action/BasicOAAction.java | 12 +++++++----- .../moa/id/configuration/struts/action/EditOAAction.java | 2 +- .../struts/action/InterfederationIDPAction.java | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) (limited to 'id/ConfigWebTool/src/main') diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/BasicOAAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/BasicOAAction.java index 415e1c957..5a9787069 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/BasicOAAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/BasicOAAction.java @@ -142,7 +142,7 @@ public class BasicOAAction extends BasicAction { session.setAttribute(Constants.SESSION_BKUFORMPREVIEW, null); } - protected OnlineApplication postProcessSaveOnlineApplication(OnlineApplication onlineapplication ) throws BasicOAActionException { + protected OnlineApplication postProcessSaveOnlineApplication(OnlineApplication onlineapplication, boolean persistOA) throws BasicOAActionException { if (onlineapplication == null) { onlineapplication = new OnlineApplication(); onlineapplication.setIsNew(true); @@ -186,7 +186,7 @@ public class BasicOAAction extends BasicAction { } //save OA configuration - String error = saveOAConfigToDatabase(onlineapplication); + String error = saveOAConfigToDatabase(onlineapplication, persistOA); if (MiscUtil.isNotEmpty(error)) { log.warn("OA configuration can not be stored!"); addActionError(error); @@ -395,7 +395,7 @@ public class BasicOAAction extends BasicAction { } } - private String saveOAConfigToDatabase(OnlineApplication dboa) { + private String saveOAConfigToDatabase(OnlineApplication dboa, boolean persistOA) { for (IOnlineApplicationData form : formList.values()) form.store(dboa, authUser, request); @@ -412,12 +412,14 @@ public class BasicOAAction extends BasicAction { ConfigurationDBUtils.saveOrUpdate(user); } else { - ConfigurationDBUtils.save(dboa); + if (persistOA) + ConfigurationDBUtils.save(dboa); } } else - ConfigurationDBUtils.saveOrUpdate(dboa); + if (persistOA) + ConfigurationDBUtils.saveOrUpdate(dboa); } catch (MOADatabaseException e) { log.warn("Online-Application can not be stored.", e); 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 4cd556b75..1da948eec 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 @@ -217,7 +217,7 @@ public class EditOAAction extends BasicOAAction { } else { try { - onlineapplication = postProcessSaveOnlineApplication(onlineapplication); + onlineapplication = postProcessSaveOnlineApplication(onlineapplication, true); } catch (BasicOAActionException e) { addActionError(e.getStrutsError()); 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 89dce3200..b92b17217 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 @@ -265,7 +265,7 @@ public class InterfederationIDPAction extends BasicOAAction { return Constants.STRUTS_ERROR_VALIDATION; } else { - onlineapplication = postProcessSaveOnlineApplication(onlineapplication); + onlineapplication = postProcessSaveOnlineApplication(onlineapplication, false); //set default Target interfederated nameID caluclation if (getPvp2OA() != null) { -- cgit v1.2.3 From b42d6aae70054772610da6b2d8d11d3377bed340 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Fri, 31 Oct 2014 12:10:53 +0100 Subject: fix problem with MOA-IDP database updates --- .../moa/id/configuration/struts/action/InterfederationIDPAction.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'id/ConfigWebTool/src/main') 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 b92b17217..eead280be 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 @@ -263,9 +263,10 @@ public class InterfederationIDPAction extends BasicOAAction { formID = Random.nextRandom(); session.setAttribute(Constants.SESSION_FORMID, formID); return Constants.STRUTS_ERROR_VALIDATION; - + } else { - onlineapplication = postProcessSaveOnlineApplication(onlineapplication, false); + onlineapplication = postProcessSaveOnlineApplication(onlineapplication, + !(this instanceof MOAIDPAction)); //set default Target interfederated nameID caluclation if (getPvp2OA() != null) { -- cgit v1.2.3