From 42c8940c7b813744933d261e4c414f17762062cd Mon Sep 17 00:00:00 2001
From: Florian Reimair
Date: Thu, 20 Feb 2014 16:57:14 +0100
Subject: ap plugins are persisted now
---
.../src/main/resources/config/moaid_config_2.0.xsd | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
(limited to 'id/server/moa-id-commons/src/main')
diff --git a/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd b/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd
index 33ad5c990..ea78918b6 100644
--- a/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd
+++ b/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd
@@ -49,7 +49,7 @@
-
+
possibility to include common austrian primary
keys in human readable way, english translation not available
@@ -933,6 +933,8 @@
type="xsd:boolean" />
+
+
@@ -1010,4 +1012,13 @@
+
+
+
+
+
+
+
+
+
--
cgit v1.2.3
From caee81b311e93720d4c1fe2b3de22cdcbb0fe74d Mon Sep 17 00:00:00 2001
From: Bojan Suzic
Date: Wed, 26 Feb 2014 16:32:48 +0100
Subject: config
---
.../id/protocols/stork2/AuthenticationRequest.java | 55 +-
.../moa/id/commons/db/ConfigurationDBRead.java | 706 ++++++++++-----------
2 files changed, 384 insertions(+), 377 deletions(-)
(limited to 'id/server/moa-id-commons/src/main')
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AuthenticationRequest.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AuthenticationRequest.java
index 6ef85d7ae..db3e12f43 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AuthenticationRequest.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AuthenticationRequest.java
@@ -4,6 +4,7 @@ import at.gv.egovernment.moa.id.auth.data.AuthenticationSession;
import at.gv.egovernment.moa.id.auth.exception.AuthenticationException;
import at.gv.egovernment.moa.id.auth.exception.MOAIDException;
import at.gv.egovernment.moa.id.auth.stork.VelocityProvider;
+import at.gv.egovernment.moa.id.commons.db.dao.config.StorkAttribute;
import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProvider;
import at.gv.egovernment.moa.id.config.auth.OAAuthParameter;
import at.gv.egovernment.moa.id.moduls.IAction;
@@ -64,7 +65,7 @@ public class AuthenticationRequest implements IAction {
Logger.debug("STORK QAA 2 :" + ((MOASTORKAuthnRequest) req).getStorkAuthnRequest().getQAALevel());
StartAuthResponse startAuthResponse = getStartAuthResponse(((MOASTORKAuthnRequest) req).getStorkAuthnRequest());
- HttpSession httpSession = httpReq.getSession();
+ HttpSession httpSession = httpReq.getSession(); performRed
httpSession.setAttribute("STORKSessionID", "12345");
httpResp.setStatus(startAuthResponse.getHttpStatusCode());
try {
@@ -102,12 +103,37 @@ public class AuthenticationRequest implements IAction {
throw new AuthenticationException("stork.12", new Object[] { moasession.getPublicOAURLPrefix() });
+ // Prepare basic AT attributes
+ try {
+ IPersonalAttributeList moaAttrList = moasession.getStorkAttributes();
+ Logger.info("Found number of moa personal attributes: " + moasession.getStorkAttributes().size());
+
+
+ for (PersonalAttribute personalAttribute : moaAttrList) {
+ Logger.info("Personal attribute found: " + personalAttribute.getName() + personalAttribute.getStatus());
+ if (personalAttribute.getValue().size() > 0) {
+ for (String value : personalAttribute.getValue()) {
+ Logger.info(" Value found: " + value);
+ }
+ }
+ }
+
+ } catch (Exception e) {
+ Logger.error("Exception, attributes: " + e.getMessage());
+ }
+
+ authnResponse.setPersonalAttributeList(populateAttributes());
+
+ // Prepare extended attributes
+ Logger.debug("Preparing data container");
+
//httpResp.setStatus(200);
//VPEPSInboundPostHandler
// create fresh container
DataContainer container = new DataContainer();
-
+
+
// - fill in the request we extracted above
container.setRequest(((MOASTORKAuthnRequest) req).getStorkAuthnRequest());
@@ -118,39 +144,20 @@ public class AuthenticationRequest implements IAction {
container.setTarget(((MOASTORKAuthnRequest) req).getStorkAuthnRequest().getAssertionConsumerServiceURL());
+ Logger.debug("Data container prepared");
- if (1==1) // test
+ if (1==0) // test
// see if we need to fetch further attributes
return (new AttributeCollector()).processRequest(container, httpReq, httpResp, oaParam);
+ Logger.debug("Finished sending data container");
-
- try {
- IPersonalAttributeList moaAttrList = moasession.getStorkAttributes();
- Logger.info("Found number of moa personal attributes: " + moasession.getStorkAttributes().size());
-
-
- for (PersonalAttribute personalAttribute : moaAttrList) {
- Logger.info("Personal attribute found: " + personalAttribute.getName() + personalAttribute.getStatus());
- if (personalAttribute.getValue().size() > 0) {
- for (String value : personalAttribute.getValue()) {
- Logger.info(" Value found: " + value);
- }
- }
- }
-
- } catch (Exception e) {
- Logger.error("Exception, attributes: " + e.getMessage());
- }
-
- authnResponse.setPersonalAttributeList(populateAttributes());
-
try {
//Get SAMLEngine instance
STORKSAMLEngine engine = STORKSAMLEngine.getInstance("incoming");
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java
index e4e4ce98a..88220cded 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java
@@ -22,366 +22,366 @@
*******************************************************************************/
package at.gv.egovernment.moa.id.commons.db;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.persistence.EntityManager;
-
-import org.apache.commons.lang.StringEscapeUtils;
-
import at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration;
import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication;
import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase;
-
import at.gv.egovernment.moa.logging.Logger;
import at.gv.egovernment.moa.util.MiscUtil;
+import org.apache.commons.lang.StringEscapeUtils;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
@SuppressWarnings("rawtypes")
public class ConfigurationDBRead {
- private static Map QUERIES = new HashMap();
- static {
- QUERIES.put("getActiveOnlineApplicationWithID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.publicURLPrefix = SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix)) and onlineapplication.isActive = '1'");
- QUERIES.put("getOnlineApplicationWithID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.publicURLPrefix = SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix))");
- QUERIES.put("getOnlineApplicationWithDBID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.hjid = :id");
- QUERIES.put("getAllOnlineApplications", "select onlineapplication from OnlineApplication onlineapplication");
- QUERIES.put("getAllActiveOnlineApplications", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.isActive = '1'");
- QUERIES.put("getAllNewOnlineApplications", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.isActive = '0' and onlineapplication.isAdminRequired = '1'");
- QUERIES.put("getMOAIDConfiguration", "select moaidconfiguration from MOAIDConfiguration moaidconfiguration");
- QUERIES.put("getUserWithUserID", "select userdatabase from UserDatabase userdatabase where userdatabase.hjid = :id");
- QUERIES.put("getNewUserWithUserTokken", "select userdatabase from UserDatabase userdatabase where userdatabase.userRequestTokken = :tokken");
- QUERIES.put("getAllNewUsers", "select userdatabase from UserDatabase userdatabase where userdatabase.userRequestTokken is null and userdatabase.isAdminRequest = '1' and userdatabase.isMailAddressVerified = '1'");
- QUERIES.put("getAllOpenUsersRequests", "select userdatabase from UserDatabase userdatabase where userdatabase.userRequestTokken is not null and userdatabase.isAdminRequest = '1' and userdatabase.isMailAddressVerified = '0'");
- QUERIES.put("getUserWithUserBPKWBPK", "select userdatabase from UserDatabase userdatabase where userdatabase.bpk = :bpk");
- QUERIES.put("getUserWithUserUsername", "select userdatabase from UserDatabase userdatabase where userdatabase.username = :username");
- QUERIES.put("getAllUsers", "select userdatabase from UserDatabase userdatabase");
- QUERIES.put("getUsersWithOADBID", "select userdatabase from UserDatabase userdatabase inner join userdatabase.onlineApplication oa where oa.hjid = :id");
- QUERIES.put("searchOnlineApplicationsWithID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.friendlyName like :id"); }
-
- public static OnlineApplication getActiveOnlineApplication(String id) {
- MiscUtil.assertNotNull(id, "OnlineApplictionID");
- Logger.trace("Getting OnlineApplication with ID " + id + " from database.");
-
- List result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getActiveOnlineApplicationWithID"));
- //query.setParameter("id", id+"%");
- query.setParameter("id", StringEscapeUtils.escapeHtml(id));
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.debug("No entries found.");
- return null;
- }
-
- if (result.size() > 1) {
- Logger.warn("OAIdentifier match to more then one DB-entry!");
- return null;
- }
-
- return (OnlineApplication) result.get(0);
- }
-
- public static OnlineApplication getOnlineApplication(String id) {
- MiscUtil.assertNotNull(id, "OnlineApplictionID");
- Logger.trace("Getting OnlineApplication with ID " + id + " from database.");
-
- List result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getOnlineApplicationWithID"));
- //query.setParameter("id", id+"%");
- query.setParameter("id", id);
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
-
- if (result.size() > 1) {
- Logger.warn("OAIdentifier match to more then one DB-entry!");
- return null;
- }
-
- return (OnlineApplication) result.get(0);
- }
-
- public static OnlineApplication getOnlineApplication(long dbid) {
- MiscUtil.assertNotNull(dbid, "OnlineApplictionID");
- Logger.trace("Getting OnlineApplication with DBID " + dbid + " from database.");
-
- List result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getOnlineApplicationWithDBID"));
- //query.setParameter("id", id+"%");
- query.setParameter("id", dbid);
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
-
- return (OnlineApplication) result.get(0);
- }
-
- public static MOAIDConfiguration getMOAIDConfiguration() {
- Logger.trace("Load MOAID Configuration from database.");
-
- List result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getMOAIDConfiguration"));
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
-
- return (MOAIDConfiguration) result.get(0);
- }
-
- public static List getAllOnlineApplications() {
- Logger.trace("Get All OnlineApplications from database.");
-
- List result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getAllOnlineApplications"));
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
- return result;
- }
-
- public static List getAllNewOnlineApplications() {
- Logger.trace("Get All OnlineApplications from database.");
-
- List result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getAllNewOnlineApplications"));
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
- return result;
- }
-
- public static List getAllUsers() {
- Logger.trace("Get All OnlineApplications from database.");
-
- List result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getAllUsers"));
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
- return result;
- }
-
- public static List getAllActiveOnlineApplications() {
- Logger.trace("Get All active OnlineApplications from database.");
-
- List result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getAllActiveOnlineApplications"));
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
- return result;
- }
-
- @SuppressWarnings("rawtypes")
- public static List searchOnlineApplications(String id) {
- MiscUtil.assertNotNull(id, "OnlineApplictionID");
- Logger.trace("Getting OnlineApplication with ID " + id + " from database.");
-
- List result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("searchOnlineApplicationsWithID"));
- query.setParameter("id", "%"+id+"%");
-
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
-
- return result;
- }
-
- public static UserDatabase getUserWithID(long id) {
- MiscUtil.assertNotNull(id, "UserID");
- Logger.trace("Getting Userinformation with ID " + id + " from database.");
-
- List result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getUserWithUserID"));
- query.setParameter("id", id);
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
- return (UserDatabase) result.get(0);
- }
-
- public static UserDatabase getUsersWithOADBID(long id) {
- MiscUtil.assertNotNull(id, "OADBID");
- Logger.trace("Getting Userinformation with OADBID " + id + " from database.");
-
- List result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getUsersWithOADBID"));
- query.setParameter("id", id);
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
- return (UserDatabase) result.get(0);
- }
-
- public static UserDatabase getUserWithUserName(String username) {
- MiscUtil.assertNotNull(username, "UserName");
- Logger.trace("Getting Userinformation with ID " + username + " from database.");
-
- List result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getUserWithUserUsername"));
- query.setParameter("username", username);
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
- return (UserDatabase) result.get(0);
- }
-
- public static UserDatabase getUserWithUserBPKWBPK(String bpkwbpk) {
- MiscUtil.assertNotNull(bpkwbpk, "bpk/wbpk");
- Logger.trace("Getting Userinformation with ID " + bpkwbpk + " from database.");
-
- List result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getUserWithUserBPKWBPK"));
- query.setParameter("bpk", bpkwbpk);
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
- return (UserDatabase) result.get(0);
- }
-
- public static UserDatabase getNewUserWithTokken(String tokken) {
- MiscUtil.assertNotNull(tokken, "bpk/wbpk");
- Logger.trace("Getting Userinformation with Tokken " + tokken + " from database.");
-
- List result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getNewUserWithUserTokken"));
- query.setParameter("tokken", tokken);
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
- return (UserDatabase) result.get(0);
- }
-
- public static List getAllNewUsers() {
- Logger.trace("Get all new Users from Database");
-
- List result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getAllNewUsers"));
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
- return result;
- }
-
- public static List getAllOpenUsersRequests() {
- Logger.trace("Get all new Users from Database");
-
- List result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getAllOpenUsersRequests"));
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
- return result;
- }
+ private static Map QUERIES = new HashMap();
+
+ static {
+ QUERIES.put("getActiveOnlineApplicationWithID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.publicURLPrefix = SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix)) and onlineapplication.isActive = '1'");
+ QUERIES.put("getOnlineApplicationWithID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.publicURLPrefix = SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix))");
+ QUERIES.put("getOnlineApplicationWithDBID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.hjid = :id");
+ QUERIES.put("getAllOnlineApplications", "select onlineapplication from OnlineApplication onlineapplication");
+ QUERIES.put("getAllActiveOnlineApplications", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.isActive = '1'");
+ QUERIES.put("getAllNewOnlineApplications", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.isActive = '0' and onlineapplication.isAdminRequired = '1'");
+ QUERIES.put("getMOAIDConfiguration", "select moaidconfiguration from MOAIDConfiguration moaidconfiguration");
+ QUERIES.put("getUserWithUserID", "select userdatabase from UserDatabase userdatabase where userdatabase.hjid = :id");
+ QUERIES.put("getNewUserWithUserTokken", "select userdatabase from UserDatabase userdatabase where userdatabase.userRequestTokken = :tokken");
+ QUERIES.put("getAllNewUsers", "select userdatabase from UserDatabase userdatabase where userdatabase.userRequestTokken is null and userdatabase.isAdminRequest = '1' and userdatabase.isMailAddressVerified = '1'");
+ QUERIES.put("getAllOpenUsersRequests", "select userdatabase from UserDatabase userdatabase where userdatabase.userRequestTokken is not null and userdatabase.isAdminRequest = '1' and userdatabase.isMailAddressVerified = '0'");
+ QUERIES.put("getUserWithUserBPKWBPK", "select userdatabase from UserDatabase userdatabase where userdatabase.bpk = :bpk");
+ QUERIES.put("getUserWithUserUsername", "select userdatabase from UserDatabase userdatabase where userdatabase.username = :username");
+ QUERIES.put("getAllUsers", "select userdatabase from UserDatabase userdatabase");
+ QUERIES.put("getUsersWithOADBID", "select userdatabase from UserDatabase userdatabase inner join userdatabase.onlineApplication oa where oa.hjid = :id");
+ QUERIES.put("searchOnlineApplicationsWithID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.friendlyName like :id");
+ }
+
+ public static OnlineApplication getActiveOnlineApplication(String id) {
+ MiscUtil.assertNotNull(id, "OnlineApplictionID");
+ Logger.trace("Getting OnlineApplication with ID " + id + " from database.");
+
+ List result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getActiveOnlineApplicationWithID"));
+ //query.setParameter("id", id+"%");
+ query.setParameter("id", StringEscapeUtils.escapeHtml(id));
+ result = query.getResultList();
+
+ Logger.trace("Found entries: " + result.size());
+
+ if (result.size() == 0) {
+ Logger.debug("No entries found.");
+ return null;
+ }
+
+ if (result.size() > 1) {
+ Logger.warn("OAIdentifier match to more then one DB-entry!");
+ return null;
+ }
+
+ return (OnlineApplication) result.get(0);
+ }
+
+ public static OnlineApplication getOnlineApplication(String id) {
+ MiscUtil.assertNotNull(id, "OnlineApplictionID");
+ Logger.trace("Getting OnlineApplication with ID " + id + " from database.");
+
+ List result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getOnlineApplicationWithID"));
+ //query.setParameter("id", id+"%");
+ query.setParameter("id", id);
+ result = query.getResultList();
+
+ Logger.trace("Found entries: " + result.size());
+
+ if (result.size() == 0) {
+ Logger.trace("No entries found.");
+ return null;
+ }
+
+ if (result.size() > 1) {
+ Logger.warn("OAIdentifier match to more then one DB-entry!");
+ return null;
+ }
+
+ return (OnlineApplication) result.get(0);
+ }
+
+ public static OnlineApplication getOnlineApplication(long dbid) {
+ MiscUtil.assertNotNull(dbid, "OnlineApplictionID");
+ Logger.trace("Getting OnlineApplication with DBID " + dbid + " from database.");
+
+ List result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getOnlineApplicationWithDBID"));
+ //query.setParameter("id", id+"%");
+ query.setParameter("id", dbid);
+ result = query.getResultList();
+
+ Logger.trace("Found entries: " + result.size());
+
+ if (result.size() == 0) {
+ Logger.trace("No entries found.");
+ return null;
+ }
+
+ return (OnlineApplication) result.get(0);
+ }
+
+ public static MOAIDConfiguration getMOAIDConfiguration() {
+ Logger.trace("Load MOAID Configuration from database.");
+
+ List result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getMOAIDConfiguration"));
+ result = query.getResultList();
+
+ Logger.trace("Found entries: " + result.size());
+
+ if (result.size() == 0) {
+ Logger.trace("No entries found.");
+ return null;
+ }
+
+ return (MOAIDConfiguration) result.get(0);
+ }
+
+ public static List getAllOnlineApplications() {
+ Logger.trace("Get All OnlineApplications from database.");
+
+ List result = null;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getAllOnlineApplications"));
+ result = query.getResultList();
+
+ Logger.trace("Found entries: " + result.size());
+
+ if (result.size() == 0) {
+ Logger.trace("No entries found.");
+ return null;
+ }
+ return result;
+ }
+
+ public static List getAllNewOnlineApplications() {
+ Logger.trace("Get All OnlineApplications from database.");
+
+ List result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getAllNewOnlineApplications"));
+ result = query.getResultList();
+
+ Logger.trace("Found entries: " + result.size());
+
+ if (result.size() == 0) {
+ Logger.trace("No entries found.");
+ return null;
+ }
+ return result;
+ }
+
+ public static List getAllUsers() {
+ Logger.trace("Get All OnlineApplications from database.");
+
+ List result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getAllUsers"));
+ result = query.getResultList();
+
+ Logger.trace("Found entries: " + result.size());
+
+ if (result.size() == 0) {
+ Logger.trace("No entries found.");
+ return null;
+ }
+ return result;
+ }
+
+ public static List getAllActiveOnlineApplications() {
+ Logger.trace("Get All active OnlineApplications from database.");
+
+ List result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getAllActiveOnlineApplications"));
+ result = query.getResultList();
+
+ Logger.trace("Found entries: " + result.size());
+
+ if (result.size() == 0) {
+ Logger.trace("No entries found.");
+ return null;
+ }
+ return result;
+ }
+
+ @SuppressWarnings("rawtypes")
+ public static List searchOnlineApplications(String id) {
+ MiscUtil.assertNotNull(id, "OnlineApplictionID");
+ Logger.trace("Getting OnlineApplication with ID " + id + " from database.");
+
+ List result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("searchOnlineApplicationsWithID"));
+ query.setParameter("id", "%" + id + "%");
+
+ result = query.getResultList();
+
+ Logger.trace("Found entries: " + result.size());
+
+ if (result.size() == 0) {
+ Logger.trace("No entries found.");
+ return null;
+ }
+
+ return result;
+ }
+
+ public static UserDatabase getUserWithID(long id) {
+ MiscUtil.assertNotNull(id, "UserID");
+ Logger.trace("Getting Userinformation with ID " + id + " from database.");
+
+ List result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getUserWithUserID"));
+ query.setParameter("id", id);
+ result = query.getResultList();
+
+ Logger.trace("Found entries: " + result.size());
+
+ if (result.size() == 0) {
+ Logger.trace("No entries found.");
+ return null;
+ }
+ return (UserDatabase) result.get(0);
+ }
+
+ public static UserDatabase getUsersWithOADBID(long id) {
+ MiscUtil.assertNotNull(id, "OADBID");
+ Logger.trace("Getting Userinformation with OADBID " + id + " from database.");
+
+ List result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getUsersWithOADBID"));
+ query.setParameter("id", id);
+ result = query.getResultList();
+
+ Logger.trace("Found entries: " + result.size());
+
+ if (result.size() == 0) {
+ Logger.trace("No entries found.");
+ return null;
+ }
+ return (UserDatabase) result.get(0);
+ }
+
+ public static UserDatabase getUserWithUserName(String username) {
+ MiscUtil.assertNotNull(username, "UserName");
+ Logger.trace("Getting Userinformation with ID " + username + " from database.");
+
+ List result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getUserWithUserUsername"));
+ query.setParameter("username", username);
+ result = query.getResultList();
+
+ Logger.trace("Found entries: " + result.size());
+
+ if (result.size() == 0) {
+ Logger.trace("No entries found.");
+ return null;
+ }
+ return (UserDatabase) result.get(0);
+ }
+
+ public static UserDatabase getUserWithUserBPKWBPK(String bpkwbpk) {
+ MiscUtil.assertNotNull(bpkwbpk, "bpk/wbpk");
+ Logger.trace("Getting Userinformation with ID " + bpkwbpk + " from database.");
+
+ List result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getUserWithUserBPKWBPK"));
+ query.setParameter("bpk", bpkwbpk);
+ result = query.getResultList();
+
+ Logger.trace("Found entries: " + result.size());
+
+ if (result.size() == 0) {
+ Logger.trace("No entries found.");
+ return null;
+ }
+ return (UserDatabase) result.get(0);
+ }
+
+ public static UserDatabase getNewUserWithTokken(String tokken) {
+ MiscUtil.assertNotNull(tokken, "bpk/wbpk");
+ Logger.trace("Getting Userinformation with Tokken " + tokken + " from database.");
+
+ List result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getNewUserWithUserTokken"));
+ query.setParameter("tokken", tokken);
+ result = query.getResultList();
+
+ Logger.trace("Found entries: " + result.size());
+
+ if (result.size() == 0) {
+ Logger.trace("No entries found.");
+ return null;
+ }
+ return (UserDatabase) result.get(0);
+ }
+
+ public static List getAllNewUsers() {
+ Logger.trace("Get all new Users from Database");
+
+ List result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getAllNewUsers"));
+ result = query.getResultList();
+
+ Logger.trace("Found entries: " + result.size());
+
+ if (result.size() == 0) {
+ Logger.trace("No entries found.");
+ return null;
+ }
+ return result;
+ }
+
+ public static List getAllOpenUsersRequests() {
+ Logger.trace("Get all new Users from Database");
+
+ List result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getAllOpenUsersRequests"));
+ result = query.getResultList();
+
+ Logger.trace("Found entries: " + result.size());
+
+ if (result.size() == 0) {
+ Logger.trace("No entries found.");
+ return null;
+ }
+ return result;
+ }
}
--
cgit v1.2.3
From 1ba3c2042e0c4da08af39db6172ff1206dfece36 Mon Sep 17 00:00:00 2001
From: Florian Reimair
Date: Wed, 5 Mar 2014 10:22:46 +0100
Subject: ap plugins can be configured to listen to certain attributes
---
.../validation/oa/OASTORKConfigValidation.java | 4 ++++
.../src/main/resources/applicationResources.properties | 1 +
id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp | 5 +++--
.../moa/id/protocols/stork2/AttributeProviderFactory.java | 8 ++++----
.../id/protocols/stork2/EHvdAttributeProviderPlugin.java | 11 ++++++++---
.../id/protocols/stork2/StorkAttributeRequestProvider.java | 13 +++++++++++--
.../src/main/resources/config/moaid_config_2.0.xsd | 5 +++--
7 files changed, 34 insertions(+), 13 deletions(-)
(limited to 'id/server/moa-id-commons/src/main')
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OASTORKConfigValidation.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OASTORKConfigValidation.java
index 25e0d751c..067e85aa6 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OASTORKConfigValidation.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OASTORKConfigValidation.java
@@ -58,6 +58,10 @@ public class OASTORKConfigValidation {
log.info("AttributeProviderPlugin Name is empty.");
errors.add(LanguageHelper.getErrorString("validation.stork.ap.name.valid"));
}
+ if (MiscUtil.isEmpty(current.getAttributes()) || !current.getAttributes().matches("[a-zA-Z]+(, ?[a-zA-Z]+)*")) {
+ log.info("AttributeProviderPlugin attributes are empty or do not match csv format.");
+ errors.add(LanguageHelper.getErrorString("validation.stork.ap.attributes.valid"));
+ }
}
return errors;
diff --git a/id/ConfigWebTool/src/main/resources/applicationResources.properties b/id/ConfigWebTool/src/main/resources/applicationResources.properties
index a033205ed..34bf4a8e5 100644
--- a/id/ConfigWebTool/src/main/resources/applicationResources.properties
+++ b/id/ConfigWebTool/src/main/resources/applicationResources.properties
@@ -419,6 +419,7 @@ validation.stork.qaa.outofrange=G\u00FCltige QAA Werte sind 1, 2, 3, und 4
validation.stork.attributes.empty=Es muss mindestens ein Attribut definiert sein
validation.stork.ap.url.valid=Ung\u00FCltige AttributProvider Url
validation.stork.ap.name.valid=Ung\u00FCltiger AttributProvider Name
+validation.stork.ap.attributes.valid=Ung\u00FCltige Attributconfiguration f\u00FCr ein Attribut Provider Plugin. Feld darf nicht leer sein und ist als csv anzugeben.
validation.pvp2.metadataurl.empty=Keine Metadaten URL angegeben.
validation.pvp2.metadataurl.valid=Die Metadaten URL wei\u00DFt kein g\u00FCltiges URL Format auf.
diff --git a/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp b/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp
index 76c347445..5ee1188ae 100644
--- a/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp
+++ b/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp
@@ -516,10 +516,11 @@
id="OAuseVidp" />
<%=LanguageHelper.getGUIString("webpages.oaconfig.vidp.ap.list", request) %>
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProviderFactory.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProviderFactory.java
index 23edf69f9..de079c960 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProviderFactory.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProviderFactory.java
@@ -31,11 +31,11 @@ public class AttributeProviderFactory {
* the simpleName for the providers class
* @return the attribute provider
*/
- public static AttributeProvider create(String shortname, String url) {
+ public static AttributeProvider create(String shortname, String url, String attributes) {
if (shortname.equals("StorkAttributeRequestProvider")) {
- return new StorkAttributeRequestProvider(url);
+ return new StorkAttributeRequestProvider(url, attributes);
} else if(shortname.equals("EHvdAttributeProvider")) {
- return new EHvdAttributeProviderPlugin(url);
+ return new EHvdAttributeProviderPlugin(url, attributes);
} else {
return null;
}
@@ -52,7 +52,7 @@ public class AttributeProviderFactory {
List result = new ArrayList();
for(AttributeProviderPlugin current : configuredAPs)
- result.add(create(current.getName(), current.getUrl()));
+ result.add(create(current.getName(), current.getUrl(), current.getAttributes()));
return result;
}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/EHvdAttributeProviderPlugin.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/EHvdAttributeProviderPlugin.java
index f97d8c804..a36855d33 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/EHvdAttributeProviderPlugin.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/EHvdAttributeProviderPlugin.java
@@ -44,26 +44,31 @@ public class EHvdAttributeProviderPlugin implements AttributeProvider {
/** The destination. */
private Object destination;
+
+ /** The attributes. */
+ private String attributes;
/**
* Instantiates a new e hvd attribute provider plugin.
*
* @param url the service url
+ * @param attributes
*/
- public EHvdAttributeProviderPlugin(String url) {
+ public EHvdAttributeProviderPlugin(String url, String supportedAttributes) {
destination = url;
+ attributes = supportedAttributes;
}
/* (non-Javadoc)
* @see at.gv.egovernment.moa.id.protocols.stork2.AttributeProvider#acquire(eu.stork.peps.auth.commons.PersonalAttribute)
*/
@Override
- public IPersonalAttributeList acquire(PersonalAttribute attributes, AuthenticationSession moasession)
+ public IPersonalAttributeList acquire(PersonalAttribute attribute, AuthenticationSession moasession)
throws UnsupportedAttributeException,
ExternalAttributeRequestRequiredException, MOAIDException {
// break when we cannot handle the requested attribute
- if(!attributes.getName().equals("isHealthCareProfessional"))
+ if(!attributes.contains(attribute.getName()))
throw new UnsupportedAttributeException();
try {
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/StorkAttributeRequestProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/StorkAttributeRequestProvider.java
index 797695a00..d8becaaf7 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/StorkAttributeRequestProvider.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/StorkAttributeRequestProvider.java
@@ -34,14 +34,19 @@ public class StorkAttributeRequestProvider implements AttributeProvider {
/** The destination. */
private String destination;
-
+
+ /** The attributes. */
+ private String attributes;
+
/**
* Instantiates a new stork attribute request provider.
*
* @param apUrl the AP location
+ * @param supportedAttributes the supported attributes as csv
*/
- public StorkAttributeRequestProvider(String apUrl) {
+ public StorkAttributeRequestProvider(String apUrl, String supportedAttributes) {
destination = apUrl;
+ attributes = supportedAttributes;
}
/* (non-Javadoc)
@@ -49,6 +54,10 @@ public class StorkAttributeRequestProvider implements AttributeProvider {
*/
public IPersonalAttributeList acquire(PersonalAttribute attribute, AuthenticationSession moasession)
throws UnsupportedAttributeException, ExternalAttributeRequestRequiredException {
+
+ if (!attributes.contains(attribute.getName()))
+ throw new UnsupportedAttributeException();
+
requestedAttributes = new PersonalAttributeList(1);
requestedAttributes.add(attribute);
throw new ExternalAttributeRequestRequiredException(this);
diff --git a/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd b/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd
index d20ec1c68..845e4fe1f 100644
--- a/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd
+++ b/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd
@@ -957,8 +957,9 @@
-
-
+
+
+
--
cgit v1.2.3
From 58c8a91c173ce699b8014e4f81fa195bfa37d246 Mon Sep 17 00:00:00 2001
From: Bojan Suzic
Date: Wed, 5 Mar 2014 19:28:25 +0100
Subject: land selection change
---
.../moa/id/configuration/Constants.java | 17 +-
.../id/configuration/data/oa/OAGeneralConfig.java | 37 +-
.../configuration/struts/action/EditOAAction.java | 2619 ++++++++++----------
.../main/resources/applicationResources.properties | 3 +
id/ConfigWebTool/src/main/webapp/js/common.js | 25 +-
.../src/main/webapp/jsp/editOAGeneral.jsp | 43 +-
.../src/main/resources/config/moaid_config_2.0.xsd | 6 +-
7 files changed, 1410 insertions(+), 1340 deletions(-)
(limited to 'id/server/moa-id-commons/src/main')
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/Constants.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/Constants.java
index b963890af..79a966b81 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/Constants.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/Constants.java
@@ -69,7 +69,8 @@ public class Constants {
public static final String BKU_HANDY = "bkuhandy";
public static final String MOA_CONFIG_BUSINESSSERVICE = "businessService";
- public static final String MOA_CONFIG_PROTOCOL_SAML1 = "id_saml1";
+ public static final String MOA_CONFIG_STORKSERVICE = "storkService";
+ public static final String MOA_CONFIG_PROTOCOL_SAML1 = "id_saml1";
public static final String MOA_CONFIG_PROTOCOL_PVP2 = "id_pvp2x";
public static final String MOA_CONFIG_PROTOCOL_STORK2 = "id_stork2";
@@ -82,20 +83,24 @@ public class Constants {
public static final String IDENIFICATIONTYPE_FN = "FN";
public static final String IDENIFICATIONTYPE_ERSB = "ERSB";
public static final String IDENIFICATIONTYPE_ZVR = "ZVR";
- public static final String IDENIFICATIONTYPE_BASEID = "urn:publicid:gv.at:baseid+";
+ public static final String IDENIFICATIONTYPE_STORK = "STORK";
+ public static final String IDENIFICATIONTYPE_BASEID = "urn:publicid:gv.at:baseid+";
public static final String IDENIFICATIONTYPE_BASEID_FN = IDENIFICATIONTYPE_BASEID + "X" + IDENIFICATIONTYPE_FN;
public static final String IDENIFICATIONTYPE_BASEID_ZVR = IDENIFICATIONTYPE_BASEID + "X" + IDENIFICATIONTYPE_ZVR;
public static final String PREFIX_WPBK = "urn:publicid:gv.at:wbpk+";
-
- public static final Map BUSINESSSERVICENAMES;
+ public static final String PREFIX_STORK = "urn:publicid:gv.at:storkid+";
+
+
+ public static final Map BUSINESSSERVICENAMES;
static {
Hashtable tmp = new Hashtable();
tmp.put(IDENIFICATIONTYPE_FN, "Firmenbuchnummer");
tmp.put(IDENIFICATIONTYPE_ZVR, "Vereinsnummer");
tmp.put(IDENIFICATIONTYPE_ERSB, "ERsB Kennzahl");
-
- BUSINESSSERVICENAMES = Collections.unmodifiableMap(tmp);
+ tmp.put(IDENIFICATIONTYPE_STORK, "STORK");
+
+ BUSINESSSERVICENAMES = Collections.unmodifiableMap(tmp);
}
}
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAGeneralConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAGeneralConfig.java
index ba58701fc..495444db1 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAGeneralConfig.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAGeneralConfig.java
@@ -58,17 +58,19 @@ public class OAGeneralConfig {
private String friendlyName = null;
private boolean businessService = false;
-
- private String target = null;
+ private boolean storkService = false;
+
+ private String target = null;
private String target_subsector = null;
private String target_admin = null;
private static List targetList = null;
private String targetFriendlyName = null;
private boolean isAdminTarget = false;
-
+
private String identificationNumber = null;
private String identificationType = null;
private static List identificationTypeList = null;
+ private String storkSPTargetCountry = null;
private String aditionalAuthBlockText = null;
@@ -159,8 +161,17 @@ public class OAGeneralConfig {
businessService = true;
else
businessService = false;
-
- AuthComponentOA oaauth = dbOAConfig.getAuthComponentOA();
+
+ if (dbOAConfig.getType().equals(Constants.MOA_CONFIG_STORKSERVICE))
+ storkService = true;
+ else
+ storkService = false;
+
+ if (dbOAConfig.getStorkSPTargetCountry() != null)
+ storkSPTargetCountry = dbOAConfig.getStorkSPTargetCountry();
+
+
+ AuthComponentOA oaauth = dbOAConfig.getAuthComponentOA();
if (oaauth != null) {
BKUURLS bkuurls = oaauth.getBKUURLS();
@@ -301,6 +312,14 @@ public class OAGeneralConfig {
return identificationNumber;
}
+ public String getStorkSPTargetCountry() {
+ return storkSPTargetCountry;
+ }
+
+ public void setStorkSPTargetCountry(String storkSPTargetCountry) {
+ this.storkSPTargetCountry = storkSPTargetCountry;
+ }
+
public void setIdentificationNumber(String identificationNumber) {
this.identificationNumber = identificationNumber;
}
@@ -341,6 +360,14 @@ public class OAGeneralConfig {
return businessService;
}
+ public boolean isStorkService() {
+ return storkService;
+ }
+
+ public void setStorkService(boolean storkService) {
+ this.storkService = storkService;
+ }
+
public void setBusinessService(boolean businessService) {
this.businessService = businessService;
}
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 99bdfdc9c..4a0bf744a 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
@@ -22,1337 +22,1330 @@
*******************************************************************************/
package at.gv.egovernment.moa.id.configuration.struts.action;
-import iaik.utils.URLDecoder;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.math.BigInteger;
-import java.security.cert.CertificateException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import org.apache.log4j.Logger;
-import org.apache.struts2.interceptor.ServletRequestAware;
-import org.apache.struts2.interceptor.ServletResponseAware;
-
import at.gv.egovernment.moa.id.auth.builder.LoginFormBuilder;
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.AuthComponentOA;
-import at.gv.egovernment.moa.id.commons.db.dao.config.BKUSelectionCustomizationType;
-import at.gv.egovernment.moa.id.commons.db.dao.config.BKUURLS;
-import at.gv.egovernment.moa.id.commons.db.dao.config.DefaultBKUs;
-import at.gv.egovernment.moa.id.commons.db.dao.config.IdentificationNumber;
-import at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration;
-import at.gv.egovernment.moa.id.commons.db.dao.config.MOAKeyBoxSelector;
-import at.gv.egovernment.moa.id.commons.db.dao.config.Mandates;
-import at.gv.egovernment.moa.id.commons.db.dao.config.OAOAUTH20;
-import at.gv.egovernment.moa.id.commons.db.dao.config.OAPVP2;
-import at.gv.egovernment.moa.id.commons.db.dao.config.OASAML1;
-import at.gv.egovernment.moa.id.commons.db.dao.config.OASSO;
-import at.gv.egovernment.moa.id.commons.db.dao.config.OASTORK;
-import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication;
-import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplicationType;
-import at.gv.egovernment.moa.id.commons.db.dao.config.TemplateType;
-import at.gv.egovernment.moa.id.commons.db.dao.config.TemplatesType;
-import at.gv.egovernment.moa.id.commons.db.dao.config.TransformsInfoType;
-import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase;
+import at.gv.egovernment.moa.id.commons.db.dao.config.*;
import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException;
import at.gv.egovernment.moa.id.configuration.Constants;
import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser;
import at.gv.egovernment.moa.id.configuration.config.ConfigurationProvider;
import at.gv.egovernment.moa.id.configuration.data.FormularCustomization;
-import at.gv.egovernment.moa.id.configuration.data.oa.OAGeneralConfig;
-import at.gv.egovernment.moa.id.configuration.data.oa.OAOAuth20Config;
-import at.gv.egovernment.moa.id.configuration.data.oa.OAPVP2Config;
-import at.gv.egovernment.moa.id.configuration.data.oa.OASAML1Config;
-import at.gv.egovernment.moa.id.configuration.data.oa.OASSOConfig;
-import at.gv.egovernment.moa.id.configuration.data.oa.OASTORKConfig;
+import at.gv.egovernment.moa.id.configuration.data.oa.*;
import at.gv.egovernment.moa.id.configuration.exception.ConfigurationException;
import at.gv.egovernment.moa.id.configuration.helper.LanguageHelper;
import at.gv.egovernment.moa.id.configuration.helper.MailHelper;
import at.gv.egovernment.moa.id.configuration.validation.FormularCustomizationValitator;
import at.gv.egovernment.moa.id.configuration.validation.TargetValidator;
import at.gv.egovernment.moa.id.configuration.validation.ValidationHelper;
-import at.gv.egovernment.moa.id.configuration.validation.oa.OAFileUploadValidation;
-import at.gv.egovernment.moa.id.configuration.validation.oa.OAGeneralConfigValidation;
-import at.gv.egovernment.moa.id.configuration.validation.oa.OAOAUTH20ConfigValidation;
-import at.gv.egovernment.moa.id.configuration.validation.oa.OAPVP2ConfigValidation;
-import at.gv.egovernment.moa.id.configuration.validation.oa.OASAML1ConfigValidation;
-import at.gv.egovernment.moa.id.configuration.validation.oa.OASSOConfigValidation;
-import at.gv.egovernment.moa.id.configuration.validation.oa.OASTORKConfigValidation;
+import at.gv.egovernment.moa.id.configuration.validation.oa.*;
import at.gv.egovernment.moa.id.util.FormBuildUtils;
import at.gv.egovernment.moa.id.util.Random;
import at.gv.egovernment.moa.util.MiscUtil;
-
import com.opensymphony.xwork2.ActionSupport;
+import iaik.utils.URLDecoder;
+import org.apache.log4j.Logger;
+import org.apache.struts2.interceptor.ServletRequestAware;
+import org.apache.struts2.interceptor.ServletResponseAware;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.io.*;
+import java.math.BigInteger;
+import java.security.cert.CertificateException;
+import java.util.*;
public class EditOAAction extends ActionSupport implements ServletRequestAware, ServletResponseAware {
-
- private final Logger log = Logger.getLogger(EditOAAction.class);
-
- private static final long serialVersionUID = 1L;
-
- private HttpServletRequest request;
- private HttpServletResponse response;
-
- private AuthenticatedUser authUser;
-
- private String oaidobj;
- private boolean newOA;
- private String formID;
-
- private boolean onlyBusinessService = false;
- private boolean subTargetSet = false;
- private boolean deaktivededBusinessService = false;
- private boolean isMetaDataRefreshRequired = false;
-
- private String nextPage;
-
- private OAGeneralConfig generalOA = new OAGeneralConfig();
- private OAPVP2Config pvp2OA = new OAPVP2Config();
- private OASAML1Config saml1OA = new OASAML1Config();
- private OASSOConfig ssoOA = new OASSOConfig();
- private OAOAuth20Config oauth20OA = new OAOAuth20Config();
- private OASTORKConfig storkOA = new OASTORKConfig();
- private FormularCustomization formOA = new FormularCustomization();
-
- private InputStream stream;
-
- private Map sendAssertionForm = new HashMap();
- private Map bkuSelectionForm = new HashMap();
-
- // STRUTS actions
- public String inital() {
- HttpSession session = request.getSession();
- if (session == null) {
- log.info("No http Session found.");
- return Constants.STRUTS_ERROR;
- }
-
- Object authUserObj = session.getAttribute(Constants.SESSION_AUTH);
-
- authUser = (AuthenticatedUser) authUserObj;
-
- long oaid = -1;
-
- if (!ValidationHelper.validateOAID(oaidobj)) {
- addActionError(LanguageHelper.getErrorString("errors.edit.oa.oaid", request));
- return Constants.STRUTS_ERROR;
- }
- oaid = Long.valueOf(oaidobj);
-
- UserDatabase userdb = null;
- OnlineApplication onlineapplication = null;
-
- if (authUser.isAdmin())
- onlineapplication = ConfigurationDBRead.getOnlineApplication(oaid);
-
- else {
- 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"));
- return Constants.STRUTS_SUCCESS;
- }
-
- // TODO: change to direct Database operation
- List oas = userdb.getOnlineApplication();
- for (OnlineApplication oa : oas) {
- if (oa.getHjid() == oaid) {
- onlineapplication = oa;
- break;
- }
- }
- if (onlineapplication == null) {
- addActionError(LanguageHelper.getErrorString("errors.edit.oa.oaid", request));
- return Constants.STRUTS_ERROR;
- }
- }
-
- generalOA.parse(onlineapplication);
- ssoOA.parse(onlineapplication);
- saml1OA.parse(onlineapplication);
- oauth20OA.parse(onlineapplication);
- session.setAttribute(Constants.SESSION_OAUTH20SECRET, this.oauth20OA.getClientSecret());
-
- storkOA.parse(onlineapplication);
-
- Map map = new HashMap();
- map.putAll(FormBuildUtils.getDefaultMap());
- formOA.parse(onlineapplication, map);
-
- session.setAttribute(Constants.SESSION_BKUFORMPREVIEW, map);
-
- List errors = pvp2OA.parse(onlineapplication);
-
- if (errors.size() > 0) {
- for (String el : errors)
- addActionError(el);
- }
-
- subTargetSet = MiscUtil.isNotEmpty(generalOA.getTarget_subsector());
-
- // set UserSpezific OA Parameters
- if (!authUser.isAdmin()) generateUserSpecificConfigurationOptions(userdb);
-
- ConfigurationDBUtils.closeSession();
- session.setAttribute(Constants.SESSION_OAID, oaid);
-
- formID = Random.nextRandom();
- session.setAttribute(Constants.SESSION_FORMID, formID);
-
- newOA = false;
-
- return Constants.STRUTS_OA_EDIT;
- }
-
- public String newOA() {
- log.debug("insert new Online-Application");
-
- HttpSession session = request.getSession();
- if (session == null) {
- log.info("No http Session found.");
- return Constants.STRUTS_ERROR;
- }
-
- session.setAttribute(Constants.SESSION_OAID, null);
- nextPage = Constants.STRUTS_RETURNAREA_VALUES.main.name();
-
- Object authUserObj = session.getAttribute(Constants.SESSION_AUTH);
-
- authUser = (AuthenticatedUser) authUserObj;
-
- 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"));
- return Constants.STRUTS_SUCCESS;
- }
-
- MOAIDConfiguration moaidconfig = ConfigurationDBRead.getMOAIDConfiguration();
- if (moaidconfig != null) {
- DefaultBKUs defaultbkus = moaidconfig.getDefaultBKUs();
- if (defaultbkus != null) {
- generalOA.setBkuHandyURL(defaultbkus.getHandyBKU());
- generalOA.setBkuLocalURL(defaultbkus.getLocalBKU());
- generalOA.setBkuOnlineURL(defaultbkus.getOnlineBKU());
- }
- }
-
- // set UserSpezific OA Parameters
- if (!authUser.isAdmin()) generateUserSpecificConfigurationOptions(userdb);
-
- ConfigurationDBUtils.closeSession();
-
- newOA = true;
- formID = Random.nextRandom();
- session.setAttribute(Constants.SESSION_FORMID, formID);
-
- session.setAttribute(Constants.SESSION_BKUFORMPREVIEW, null);
-
- this.oauth20OA.generateClientSecret();
- session.setAttribute(Constants.SESSION_OAUTH20SECRET, this.oauth20OA.getClientSecret());
-
- return Constants.STRUTS_OA_EDIT;
- }
-
- public String saveOA() {
- HttpSession session = request.getSession();
- if (session == null) {
- log.info("No http Session found.");
- return Constants.STRUTS_ERROR;
- }
-
- Object authUserObj = session.getAttribute(Constants.SESSION_AUTH);
- authUser = (AuthenticatedUser) authUserObj;
-
- Object formidobj = session.getAttribute(Constants.SESSION_FORMID);
- if (formidobj != null && formidobj instanceof String) {
- String formid = (String) formidobj;
- if (!formid.equals(formID)) {
- log.warn("FormIDs does not match. Some suspect Form is received from user " + authUser.getFamilyName()
- + authUser.getGivenName() + authUser.getUserID());
- return Constants.STRUTS_ERROR;
- }
- } else {
- log.warn("FormIDs does not match. Some suspect Form is received from user " + authUser.getFamilyName()
- + authUser.getGivenName() + authUser.getUserID());
- return Constants.STRUTS_ERROR;
- }
- session.setAttribute(Constants.SESSION_FORMID, null);
-
- 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"));
- return Constants.STRUTS_SUCCESS;
- }
-
- OnlineApplication onlineapplication = null;
- List errors = new ArrayList();
-
- Object oadbid = request.getSession().getAttribute(Constants.SESSION_OAID);
- Long oaid = (long) -1;
-
- if (oadbid != null) {
- try {
- oaid = (Long) oadbid;
- if (oaid < 0 || oaid > Long.MAX_VALUE) {
- addActionError(LanguageHelper.getErrorString("errors.edit.oa.oaid", request));
- return Constants.STRUTS_ERROR;
- }
-
- }
- catch (Throwable t) {
- addActionError(LanguageHelper.getErrorString("errors.edit.oa.oaid", request));
- return Constants.STRUTS_ERROR;
- }
- }
-
- // valid DBID and check entry
- String oaidentifier = generalOA.getIdentifier();
- if (MiscUtil.isEmpty(oaidentifier)) {
- log.info("Empty OA identifier");
- errors.add(LanguageHelper.getErrorString("validation.general.oaidentifier.empty"));
-
- } else {
-
- if (!ValidationHelper.validateURL(oaidentifier)) {
- log.warn("OnlineapplikationIdentifier is not a valid URL: " + oaidentifier);
- errors.add(LanguageHelper.getErrorString("validation.general.oaidentifier.valid",
- new Object[] { ValidationHelper.getNotValidOAIdentifierCharacters() }));
- } else {
-
- if (oaid == -1) {
- onlineapplication = ConfigurationDBRead.getOnlineApplication(oaidentifier);
- newOA = true;
- if (onlineapplication != null) {
- log.info("The OAIdentifier is not unique");
- errors.add(LanguageHelper.getErrorString("validation.general.oaidentifier.notunique"));
- }
-
- } else {
- onlineapplication = ConfigurationDBRead.getOnlineApplication(oaid);
- if (!oaidentifier.equals(onlineapplication.getPublicURLPrefix())) {
-
- if (ConfigurationDBRead.getOnlineApplication(oaidentifier) != null) {
- log.info("The OAIdentifier is not unique");
- errors.add(LanguageHelper.getErrorString("validation.general.oaidentifier.notunique"));
- }
- }
- }
- }
- }
-
- // set UserSpezific OA Parameters
- if (!authUser.isAdmin()) generateUserSpecificConfigurationOptions(userdb);
-
- // check form
- OAGeneralConfigValidation validatior_general = new OAGeneralConfigValidation();
- OAPVP2ConfigValidation validatior_pvp2 = new OAPVP2ConfigValidation();
- OASAML1ConfigValidation validatior_saml1 = new OASAML1ConfigValidation();
- OASSOConfigValidation validatior_sso = new OASSOConfigValidation();
- OASTORKConfigValidation validator_stork = new OASTORKConfigValidation();
- FormularCustomizationValitator validator_form = new FormularCustomizationValitator();
- OAOAUTH20ConfigValidation validatior_oauth20 = new OAOAUTH20ConfigValidation();
- OAFileUploadValidation valiator_fileUpload = new OAFileUploadValidation();
-
- errors.addAll(validatior_general.validate(generalOA, authUser.isAdmin()));
- errors.addAll(validatior_pvp2.validate(pvp2OA));
- errors.addAll(validatior_saml1.validate(saml1OA, generalOA));
- errors.addAll(validatior_sso.validate(ssoOA, authUser.isAdmin()));
- errors.addAll(validator_stork.validate(storkOA));
- errors.addAll(validator_form.validate(formOA));
- errors.addAll(validatior_oauth20.validate(oauth20OA));
-
- //validate BKU-selection template
- List templateError = valiator_fileUpload.validate(generalOA.getBkuSelectionFileUploadFileName()
- , generalOA.getBkuSelectionFileUpload(), "validation.general.bkuselection", bkuSelectionForm);
- if (templateError != null && templateError.size() == 0) {
- if (bkuSelectionForm != null && bkuSelectionForm.size() > 0)
- session.setAttribute(Constants.SESSION_BKUSELECTIONTEMPLATE, bkuSelectionForm);
-
- else
- bkuSelectionForm = (Map) session.getAttribute(Constants.SESSION_BKUSELECTIONTEMPLATE);
-
- } else {
- errors.addAll(templateError);
-
- }
-
- //validate send-assertion template
- templateError = valiator_fileUpload.validate(generalOA.getSendAssertionFileUploadFileName()
- , generalOA.getSendAssertionFileUpload(), "validation.general.sendassertion", sendAssertionForm);
- if (templateError != null && templateError.size() == 0) {
- if (sendAssertionForm != null && sendAssertionForm.size() > 0)
- session.setAttribute(Constants.SESSION_SENDASSERTIONTEMPLATE, sendAssertionForm);
-
- else
- sendAssertionForm = (Map) session.getAttribute(Constants.SESSION_SENDASSERTIONTEMPLATE);
-
- } else {
- errors.addAll(templateError);
-
- }
-
-
- // Do not allow SSO in combination with special BKUSelection features
- if (ssoOA.isUseSSO() && (formOA.isOnlyMandateAllowed() || !formOA.isShowMandateLoginButton())) {
- log.warn("Special BKUSelection features can not be used in combination with SSO");
- errors.add(LanguageHelper.getErrorString("validation.general.bkuselection.specialfeatures.valid"));
- }
-
- if (errors.size() > 0) {
- log.info("OAConfiguration with ID " + generalOA.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 {
-
- boolean newentry = false;
-
- if (onlineapplication == null) {
- onlineapplication = new OnlineApplication();
- newentry = true;
- onlineapplication.setIsActive(false);
-
- if (!authUser.isAdmin()) {
- onlineapplication.setIsAdminRequired(true);
-
- } else
- isMetaDataRefreshRequired = true;
-
- } else {
- if (!authUser.isAdmin() && !onlineapplication.getPublicURLPrefix().equals(generalOA.getIdentifier())) {
-
- onlineapplication.setIsAdminRequired(true);
- onlineapplication.setIsActive(false);
- log.info("User with ID " + authUser.getUserID() + " change OA-PublicURLPrefix. Reaktivation is required.");
- }
-
- }
-
- if ((onlineapplication.isIsAdminRequired() == null)
- || (authUser.isAdmin() && generalOA.isActive() && onlineapplication.isIsAdminRequired())) {
-
- onlineapplication.setIsAdminRequired(false);
- isMetaDataRefreshRequired = true;
-
- if (onlineapplication.getHjid() != null) userdb = ConfigurationDBRead.getUsersWithOADBID(onlineapplication.getHjid());
-
- if (userdb != null && !userdb.isIsAdmin()) {
- try {
- MailHelper.sendUserOnlineApplicationActivationMail(userdb.getGivenname(), userdb.getFamilyname(),
- userdb.getInstitut(), onlineapplication.getPublicURLPrefix(), userdb.getMail());
- }
- catch (ConfigurationException e) {
- log.warn("Sending Mail to User " + userdb.getMail() + " failed", e);
- }
- }
- }
-
- //save OA configuration
- String error = saveOAConfigToDatabase(onlineapplication, newentry);
- if (MiscUtil.isNotEmpty(error)) {
- log.warn("OA configuration can not be stored!");
- addActionError(error);
-
- formID = Random.nextRandom();
- session.setAttribute(Constants.SESSION_FORMID, formID);
- return Constants.STRUTS_ERROR_VALIDATION;
- }
-
- //set metadata reload flag if reload is required
- if (pvp2OA.getMetaDataURL() != null) {
-
- try {
- if (isMetaDataRefreshRequired
- || !pvp2OA.getMetaDataURL().equals(onlineapplication.getAuthComponentOA().getOAPVP2().getMetadataURL())
- || pvp2OA.getFileUpload() != null
- || pvp2OA.isReLoad()) {
-
- log.debug("Set PVP2 Metadata refresh flag.");
- MOAIDConfiguration moaconfig = ConfigurationDBRead.getMOAIDConfiguration();
- moaconfig.setPvp2RefreshItem(new Date());
- ConfigurationDBUtils.saveOrUpdate(moaconfig);
-
- }
- }
- catch (Throwable e) {
- log.info("Found no MetadataURL in OA-Databaseconfig!", e);
- }
-
- }
- }
-
- 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", generalOA.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", generalOA.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() {
-
- HttpSession session = request.getSession();
- if (session == null) {
- log.info("No http Session found.");
- return Constants.STRUTS_ERROR;
- }
-
- 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", generalOA.getIdentifier(), request));
-
- ConfigurationDBUtils.closeSession();
-
- return Constants.STRUTS_SUCCESS;
- }
-
- public String deleteOA() {
- HttpSession session = request.getSession();
- if (session == null) {
- log.info("No http Session found.");
- return Constants.STRUTS_ERROR;
- }
-
- Object authUserObj = session.getAttribute(Constants.SESSION_AUTH);
- authUser = (AuthenticatedUser) authUserObj;
-
- Object formidobj = session.getAttribute(Constants.SESSION_FORMID);
- if (formidobj != null && formidobj instanceof String) {
- String formid = (String) formidobj;
- if (!formid.equals(formID)) {
- log.warn("FormIDs does not match. Some suspect Form is received from user " + authUser.getFamilyName()
- + authUser.getGivenName() + authUser.getUserID());
- return Constants.STRUTS_ERROR;
- }
- } else {
- log.warn("FormIDs does not match. Some suspect Form is received from user " + authUser.getFamilyName()
- + authUser.getGivenName() + authUser.getUserID());
- return Constants.STRUTS_ERROR;
- }
- session.setAttribute(Constants.SESSION_FORMID, null);
-
- Object nextPageAttr = session.getAttribute(Constants.SESSION_RETURNAREA);
- if (nextPageAttr != null && nextPageAttr instanceof String) {
- nextPage = (String) nextPageAttr;
-
- } else {
- nextPage = Constants.STRUTS_RETURNAREA_VALUES.main.name();
- }
-
- 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"));
- return Constants.STRUTS_SUCCESS;
- }
-
- String oaidentifier = generalOA.getIdentifier();
- if (MiscUtil.isEmpty(oaidentifier)) {
- log.info("Empty OA identifier");
- addActionError(LanguageHelper.getErrorString("validation.general.oaidentifier.empty"));
-
- formID = Random.nextRandom();
- session.setAttribute(Constants.SESSION_FORMID, formID);
- return Constants.STRUTS_ERROR_VALIDATION;
-
- } else {
- if (ValidationHelper.isValidOAIdentifier(oaidentifier)) {
- log.warn("IdentificationNumber contains potentail XSS characters: " + oaidentifier);
- addActionError(LanguageHelper.getErrorString("validation.general.oaidentifier.valid",
- new Object[] { ValidationHelper.getNotValidOAIdentifierCharacters() }));
-
- formID = Random.nextRandom();
- session.setAttribute(Constants.SESSION_FORMID, formID);
- return Constants.STRUTS_ERROR_VALIDATION;
- }
- }
-
- 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", generalOA.getIdentifier(), request));
-
- return Constants.STRUTS_SUCCESS;
-
- } else {
- ConfigurationDBUtils.closeSession();
- addActionError(LanguageHelper.getGUIString("webpages.oaconfig.delete.error", generalOA.getIdentifier(), request));
- return Constants.STRUTS_SUCCESS;
- }
-
- }
-
- public String bkuFramePreview() {
-
- String preview = null;
-
- HttpSession session = request.getSession();
- if (session == null) {
- log.info("No http Session found.");
- preview = LanguageHelper.getErrorString("error.bkuformpreview.notpossible");
-
- } else {
- InputStream input = null;
-
- try {
- Object mapobj = session.getAttribute(Constants.SESSION_BKUFORMPREVIEW);
- if (mapobj != null && mapobj instanceof Map, ?>) {
-
- ConfigurationProvider config = ConfigurationProvider.getInstance();
- String templateURL = config.getConfigRootDir() + ConfigurationProvider.HTMLTEMPLATE_DIR
- + ConfigurationProvider.HTMLTEMPLATE_FILE;
-
- File file = new File(templateURL);
- input = new FileInputStream(file);
-
- String contextpath = config.getMOAIDInstanceURL();
- if (MiscUtil.isEmpty(contextpath)) {
- log.info("NO MOA-ID instance URL configurated.");
- throw new ConfigurationException("No MOA-ID instance configurated");
- }
-
- preview = LoginFormBuilder.getTemplate(input);
- preview = preview.replace(LoginFormBuilder.CONTEXTPATH, contextpath);
-
- Map map = (Map) mapobj;
-
- request.setCharacterEncoding("UTF-8");
-
- String module = request.getParameter(Constants.REQUEST_FORMCUSTOM_MODULE);
- String value = request.getParameter(Constants.REQUEST_FORMCUSTOM_VALUE);
-
- if (value != null) {
- String[] query = URLDecoder.decode(request.getQueryString()).split("&");
- value = query[1].substring("value=".length());
- }
-
- synchronized (map) {
-
- if (MiscUtil.isNotEmpty(module)) {
- if (map.containsKey("#" + module + "#")) {
- if (MiscUtil.isNotEmpty(value)) {
- if (FormBuildUtils.FONTFAMILY.contains(module) || FormBuildUtils.HEADER_TEXT.contains(module)
- || value.startsWith("#"))
- map.put("#" + module + "#", value);
- else
- map.put("#" + module + "#", "#" + value);
-
- } else {
- map.put("#" + module + "#", FormBuildUtils.getDefaultMap().get("#" + module + "#"));
- }
- }
- }
- preview = FormBuildUtils.customiceLayoutBKUSelection(preview, true, false, map, true);
- }
-
- } else {
- preview = LanguageHelper.getErrorString("error.bkuformpreview.notpossible");
-
- }
-
- }
- catch (Exception e) {
- log.warn("BKUSelection Preview can not be generated.", e);
- preview = LanguageHelper.getErrorString("error.bkuformpreview.notpossible");
-
- }
- }
-
- stream = new ByteArrayInputStream(preview.getBytes());
-
- return Constants.STRUTS_SUCCESS;
- }
-
- private String saveOAConfigToDatabase(OnlineApplication dboa, boolean newentry) {
-
- AuthComponentOA authoa = dboa.getAuthComponentOA();
- if (authoa == null) {
- authoa = new AuthComponentOA();
- dboa.setAuthComponentOA(authoa);
- }
-
- if (authUser.isAdmin()) dboa.setIsActive(generalOA.isActive());
-
- dboa.setFriendlyName(generalOA.getFriendlyName());
- dboa.setCalculateHPI(generalOA.isCalculateHPI());
- dboa.setRemoveBPKFromAuthBlock(generalOA.isHideBPKAuthBlock());
-
- if (authUser.isAdmin())
- dboa.setKeyBoxIdentifier(MOAKeyBoxSelector.fromValue(generalOA.getKeyBoxIdentifier()));
- else {
- if (newentry) dboa.setKeyBoxIdentifier(MOAKeyBoxSelector.SECURE_SIGNATURE_KEYPAIR);
- }
-
- dboa.setPublicURLPrefix(generalOA.getIdentifier());
-
- if (generalOA.isBusinessService() || onlyBusinessService) {
-
- dboa.setType(Constants.MOA_CONFIG_BUSINESSSERVICE);
-
- String num = generalOA.getIdentificationNumber().replaceAll(" ", "");
- if (num.startsWith(Constants.IDENIFICATIONTYPE_FN)) {
- num = num.substring(Constants.IDENIFICATIONTYPE_FN.length());
-
- num = at.gv.egovernment.moa.util.StringUtils.deleteLeadingZeros(num);
-
- // num = StringUtils.leftPad(num, 7, '0');
- }
-
- if (num.startsWith(Constants.IDENIFICATIONTYPE_ZVR)) num = num.substring(Constants.IDENIFICATIONTYPE_ZVR.length());
-
- if (num.startsWith(Constants.IDENIFICATIONTYPE_ERSB)) num = num.substring(Constants.IDENIFICATIONTYPE_ERSB.length());
-
- IdentificationNumber idnumber = new IdentificationNumber();
- idnumber.setValue(Constants.PREFIX_WPBK + generalOA.getIdentificationType() + "+" + num);
- idnumber.setType(Constants.BUSINESSSERVICENAMES.get(generalOA.getIdentificationType()));
-
- authoa.setIdentificationNumber(idnumber);
-
- } else {
- dboa.setType(null);
-
- if (authUser.isAdmin()) {
- if (MiscUtil.isNotEmpty(generalOA.getTarget_admin()) && generalOA.isAdminTarget()) {
- dboa.setTarget(generalOA.getTarget_admin());
- dboa.setTargetFriendlyName(generalOA.getTargetFriendlyName());
-
- } else {
-
- String target = generalOA.getTarget();
-
- if (MiscUtil.isNotEmpty(generalOA.getTarget_subsector()) && subTargetSet)
- dboa.setTarget(target + "-" + generalOA.getTarget_subsector());
- else
- dboa.setTarget(target);
-
- String targetname = TargetValidator.getTargetFriendlyName(target);
- if (MiscUtil.isNotEmpty(targetname)) dboa.setTargetFriendlyName(targetname);
-
- }
-
- } else {
-
- if (MiscUtil.isNotEmpty(generalOA.getTarget())) {
-
- String target = generalOA.getTarget();
-
- if (MiscUtil.isNotEmpty(generalOA.getTarget_subsector()) && subTargetSet)
- dboa.setTarget(target + "-" + generalOA.getTarget_subsector());
-
- else
- dboa.setTarget(target);
-
- String targetname = TargetValidator.getTargetFriendlyName(target);
- if (MiscUtil.isNotEmpty(targetname)) dboa.setTargetFriendlyName(targetname);
-
- }
- }
- }
-
- //store BKU-URLs
- BKUURLS bkuruls = new BKUURLS();
- authoa.setBKUURLS(bkuruls);
- if (authUser.isAdmin()) {
- bkuruls.setHandyBKU(generalOA.getBkuHandyURL());
- bkuruls.setLocalBKU(generalOA.getBkuLocalURL());
- bkuruls.setOnlineBKU(generalOA.getBkuOnlineURL());
- }
-
- TemplatesType templates = authoa.getTemplates();
- if (templates == null) {
- templates = new TemplatesType();
- authoa.setTemplates(templates);
- }
-
- //store BKU-selection and send-assertion templates
- if (authUser.isAdmin()) {
-
- if(generalOA.isDeleteBKUTemplate())
- templates.setBKUSelectionTemplate(null);
-
- if (generalOA.isDeleteSendAssertionTemplate())
- templates.setSendAssertionTemplate(null);
-
-
- if (bkuSelectionForm != null && bkuSelectionForm.size() > 0) {
- TransformsInfoType template = new TransformsInfoType();
-
- Iterator interator = bkuSelectionForm.keySet().iterator();
- template.setFilename(interator.next());
- template.setTransformation(bkuSelectionForm.get(
- template.getFilename()));
-
- templates.setBKUSelectionTemplate(template);
- }
-
- if (sendAssertionForm != null && sendAssertionForm.size() > 0) {
- TransformsInfoType template = new TransformsInfoType();
-
- Iterator interator = sendAssertionForm.keySet().iterator();
- template.setFilename(interator.next());
- template.setTransformation(sendAssertionForm.get(
- template.getFilename()));
-
- templates.setSendAssertionTemplate(template);
- }
- }
-
-
- //store BKU-selection customization
- BKUSelectionCustomizationType bkuselectioncustom = templates.getBKUSelectionCustomization();
- if (bkuselectioncustom == null) {
- bkuselectioncustom = new BKUSelectionCustomizationType();
- templates.setBKUSelectionCustomization(bkuselectioncustom);
- }
-
- Mandates mandates = new Mandates();
- if (generalOA.isUseMandates()) {
- mandates.setProfiles(generalOA.getMandateProfiles());
-
- } else {
- mandates.setProfiles(new String());
- }
-
- authoa.setMandates(mandates);
- bkuselectioncustom.setMandateLoginButton(MiscUtil.isNotEmpty(generalOA.getMandateProfiles()));
- bkuselectioncustom.setOnlyMandateLoginAllowed(formOA.isOnlyMandateAllowed());
-
- if (authUser.isAdmin()) {
- templates.setAditionalAuthBlockText(generalOA.getAditionalAuthBlockText());
-
- List template = templates.getTemplate();
- if (generalOA.isLegacy()) {
-
- if (template == null)
- template = new ArrayList();
- else
- template.clear();
-
- if (MiscUtil.isNotEmpty(generalOA.getSLTemplateURL1())) {
- TemplateType el = new TemplateType();
- el.setURL(generalOA.getSLTemplateURL1());
- template.add(el);
- } else
- template.add(new TemplateType());
- if (MiscUtil.isNotEmpty(generalOA.getSLTemplateURL2())) {
- TemplateType el = new TemplateType();
- el.setURL(generalOA.getSLTemplateURL2());
- template.add(el);
- }else
- template.add(new TemplateType());
- if (MiscUtil.isNotEmpty(generalOA.getSLTemplateURL3())) {
- TemplateType el = new TemplateType();
- el.setURL(generalOA.getSLTemplateURL3());
- template.add(el);
- }else
- template.add(new TemplateType());
-
- } else {
- if (template != null && template.size() > 0) template.clear();
- }
-
- bkuselectioncustom.setBackGroundColor(parseColor(formOA.getBackGroundColor()));
- bkuselectioncustom.setFrontColor(parseColor(formOA.getFrontColor()));
-
- bkuselectioncustom.setHeaderBackGroundColor(parseColor(formOA.getHeader_BackGroundColor()));
- bkuselectioncustom.setHeaderFrontColor(parseColor(formOA.getHeader_FrontColor()));
- bkuselectioncustom.setHeaderText(formOA.getHeader_text());
-
- bkuselectioncustom.setButtonBackGroundColor(parseColor(formOA.getButton_BackGroundColor()));
- bkuselectioncustom.setButtonBackGroundColorFocus(parseColor(formOA.getButton_BackGroundColorFocus()));
- bkuselectioncustom.setButtonFontColor(parseColor(formOA.getButton_FrontColor()));
-
- if (MiscUtil.isNotEmpty(formOA.getAppletRedirectTarget()))
- bkuselectioncustom.setAppletRedirectTarget(formOA.getAppletRedirectTarget());
-
- bkuselectioncustom.setFontType(formOA.getFontType());
-
- bkuselectioncustom.setAppletHeight(formOA.getApplet_height());
- bkuselectioncustom.setAppletWidth(formOA.getApplet_width());
-
- }
-
- // set default transformation if it is empty
- List transformsInfo = authoa.getTransformsInfo();
- if (transformsInfo == null) {
- // TODO: set OA specific transformation if it is required
-
- }
-
- OAPVP2 pvp2 = authoa.getOAPVP2();
- if (pvp2 == null) {
- pvp2 = new OAPVP2();
- authoa.setOAPVP2(pvp2);
- }
-
- pvp2.setMetadataURL(pvp2OA.getMetaDataURL());
- try {
-
- if (pvp2OA.getFileUpload() != null) pvp2.setCertificate(pvp2OA.getCertificate());
-
- }
- catch (CertificateException e) {
- log.info("Uploaded Certificate can not be found", e);
- return LanguageHelper.getErrorString("validation.pvp2.certificate.notfound");
- }
- catch (IOException e) {
- log.info("Uploaded Certificate can not be parsed", e);
- return LanguageHelper.getErrorString("validation.pvp2.certificate.format");
- }
-
- OASAML1 saml1 = authoa.getOASAML1();
- if (saml1 == null) {
- saml1 = new OASAML1();
- authoa.setOASAML1(saml1);
- saml1.setIsActive(false);
- }
-
- if (authUser.isAdmin()) {
- saml1.setIsActive(saml1OA.isActive());
- }
-
- if (saml1.isIsActive() != null && saml1.isIsActive()) {
- saml1.setProvideAUTHBlock(saml1OA.isProvideAuthBlock());
- saml1.setProvideCertificate(saml1OA.isProvideCertificate());
- saml1.setProvideFullMandatorData(saml1OA.isProvideFullMandateData());
- saml1.setProvideIdentityLink(saml1OA.isProvideIdentityLink());
- saml1.setProvideStammzahl(saml1OA.isProvideStammZahl());
- saml1.setUseCondition(saml1OA.isUseCondition());
- saml1.setConditionLength(BigInteger.valueOf(saml1OA.getConditionLength()));
- // TODO: set sourceID
- // saml1.setSourceID("");
- }
-
- OASSO sso = authoa.getOASSO();
- if (sso == null) {
- sso = new OASSO();
- authoa.setOASSO(sso);
- sso.setAuthDataFrame(true);
- }
- sso.setUseSSO(ssoOA.isUseSSO());
-
- if (authUser.isAdmin()) sso.setAuthDataFrame(ssoOA.isShowAuthDataFrame());
-
- sso.setSingleLogOutURL(ssoOA.getSingleLogOutURL());
-
- if (oauth20OA != null) {
- log.debug("Saving OAuth 2.0 configuration:");
- OAOAUTH20 oaOAuth20 = authoa.getOAOAUTH20();
- if (oaOAuth20 == null) {
- oaOAuth20 = new OAOAUTH20();
- authoa.setOAOAUTH20(oaOAuth20);
- }
-
- oaOAuth20.setOAuthClientId(generalOA.getIdentifier());
- // oaOAuth20.setOAuthClientSecret(oauth20OA.getClientSecret());
- oaOAuth20.setOAuthRedirectUri(oauth20OA.getRedirectUri());
- log.debug("client id: " + oauth20OA.getClientId());
- log.debug("client secret: " + oauth20OA.getClientSecret());
- log.debug("redirect uri:" + oauth20OA.getRedirectUri());
-
- oaOAuth20.setOAuthClientSecret((String) request.getSession().getAttribute(Constants.SESSION_OAUTH20SECRET));
- request.getSession().setAttribute(Constants.SESSION_OAUTH20SECRET, null);
-
- }
-
-
- // fetch stork configuration from database model
- OASTORK stork = authoa.getOASTORK();
- if (stork == null) {
- // if there is none, create a new one with default values.
- stork = new OASTORK();
- authoa.setOASTORK(stork);
- stork.setStorkLogonEnabled(false);
- }
- // transfer the incoming data to the database model
- stork.setStorkLogonEnabled(storkOA.isStorkLogonEnabled());
- stork.setQaa(storkOA.getQaa());
- stork.setOAAttributes(storkOA.getAttributes());
- stork.setVidpEnabled(storkOA.isVidpEnabled());
- stork.setAttributeProviders(storkOA.getAttributeProviderPlugins());
-
- try {
- if (newentry) {
- ConfigurationDBUtils.save(dboa);
-
- if (!authUser.isAdmin()) {
- UserDatabase user = ConfigurationDBRead.getUserWithID(authUser.getUserID());
-
- List useroas = user.getOnlineApplication();
- if (useroas == null) useroas = new ArrayList();
-
- useroas.add(dboa);
- ConfigurationDBUtils.saveOrUpdate(user);
- }
- }
-
- else
- ConfigurationDBUtils.saveOrUpdate(dboa);
-
- }
- catch (MOADatabaseException e) {
- log.warn("Online-Application can not be stored.", e);
- return LanguageHelper.getErrorString("error.db.oa.store");
- }
-
- return null;
- }
-
- private String parseColor(String color) {
- String value = "";
-
- if (MiscUtil.isNotEmpty(color)) {
- if (!color.startsWith("#"))
- value = "#" + color;
- else
- value = color;
- }
- return value;
- }
-
- private void generateUserSpecificConfigurationOptions(UserDatabase userdb) {
-
- if (userdb.isIsMandateUser() != null && userdb.isIsMandateUser()) {
- String bpk = userdb.getBpk();
- if (bpk.startsWith(Constants.IDENIFICATIONTYPE_BASEID_FN) || bpk.startsWith(Constants.IDENIFICATIONTYPE_BASEID_ZVR)) {
-
- onlyBusinessService = true;
- generalOA.setBusinessService(true);
-
- }
-
- deaktivededBusinessService = true;
- String[] split = bpk.split("\\+");
- generalOA.setIdentificationType(split[1].substring(1));
-
- if (bpk.startsWith(Constants.IDENIFICATIONTYPE_BASEID_FN))
- generalOA.setIdentificationNumber(at.gv.egovernment.moa.util.StringUtils.deleteLeadingZeros(split[2]));
- else
- generalOA.setIdentificationNumber(split[2]);
-
- }
-
- }
-
- public String setGeneralOAConfig() {
-
- return Constants.STRUTS_SUCCESS;
- }
-
- public String setSAML1OAConfig() {
-
- return Constants.STRUTS_SUCCESS;
- }
-
- public String setPVP2OAConfig() {
-
- return Constants.STRUTS_SUCCESS;
- }
-
- public String setSSOOAConfig() {
-
- return Constants.STRUTS_SUCCESS;
- }
-
- public String setSTORKOAConfig() {
-
- return Constants.STRUTS_SUCCESS;
- }
-
- // Getter and Setter
- public void setServletResponse(HttpServletResponse arg0) {
- this.response = arg0;
-
- }
-
- public void setServletRequest(HttpServletRequest arg0) {
- this.request = arg0;
-
- }
-
- public HttpServletRequest getRequest() {
- return request;
- }
-
- public void setRequest(HttpServletRequest request) {
- this.request = request;
- }
-
- public HttpServletResponse getResponse() {
- return response;
- }
-
- public void setResponse(HttpServletResponse response) {
- this.response = response;
- }
-
- public OAGeneralConfig getGeneralOA() {
- return generalOA;
- }
-
- public void setGeneralOA(OAGeneralConfig generalOA) {
- this.generalOA = generalOA;
- }
-
- public OAPVP2Config getPvp2OA() {
- return pvp2OA;
- }
-
- public void setPvp2OA(OAPVP2Config pvp2oa) {
- pvp2OA = pvp2oa;
- }
-
- public OASAML1Config getSaml1OA() {
- return saml1OA;
- }
-
- public void setSaml1OA(OASAML1Config saml1oa) {
- saml1OA = saml1oa;
- }
-
- public OASSOConfig getSsoOA() {
- return ssoOA;
- }
-
- public void setSsoOA(OASSOConfig ssoOA) {
- this.ssoOA = ssoOA;
- }
-
- public OASTORKConfig getStorkOA() {
- return storkOA;
- }
-
- public void setStorkOA(OASTORKConfig storkOA) {
- this.storkOA = storkOA;
- }
-
- /**
- * @param oaidobj
- * the oaidobj to set
- */
- public void setOaidobj(String oaidobj) {
- this.oaidobj = oaidobj;
- }
-
- /**
- * @return the authUser
- */
- public AuthenticatedUser getAuthUser() {
- return authUser;
- }
-
- /**
- * @return the newOA
- */
- public boolean isNewOA() {
- return newOA;
- }
-
- /**
- * @param newOA
- * the newOA to set
- */
- public void setNewOA(boolean newOA) {
- this.newOA = newOA;
- }
-
- /**
- * @return the nextPage
- */
- public String getNextPage() {
- return nextPage;
- }
-
- /**
- * @return the formID
- */
- public String getFormID() {
- return formID;
- }
-
- /**
- * @param formID
- * the formID to set
- */
- public void setFormID(String formID) {
- this.formID = formID;
- }
-
- /**
- * @return the onlyBusinessService
- */
- public boolean isOnlyBusinessService() {
- return onlyBusinessService;
- }
-
- /**
- * @param onlyBusinessService
- * the onlyBusinessService to set
- */
- public void setOnlyBusinessService(boolean onlyBusinessService) {
- this.onlyBusinessService = onlyBusinessService;
- }
-
- /**
- * @return the subTargetSet
- */
- public boolean isSubTargetSet() {
- return subTargetSet;
- }
-
- /**
- * @param subTargetSet
- * the subTargetSet to set
- */
- public void setSubTargetSet(boolean subTargetSet) {
- this.subTargetSet = subTargetSet;
- }
-
- /**
- * @return the deaktivededBusinessService
- */
- public boolean isDeaktivededBusinessService() {
- return deaktivededBusinessService;
- }
-
- /**
- * @param deaktivededBusinessService
- * the deaktivededBusinessService to set
- */
- public void setDeaktivededBusinessService(boolean deaktivededBusinessService) {
- this.deaktivededBusinessService = deaktivededBusinessService;
- }
-
- /**
- * @return the formOA
- */
- public FormularCustomization getFormOA() {
- return formOA;
- }
-
- /**
- * @param formOA
- * the formOA to set
- */
- public void setFormOA(FormularCustomization formOA) {
- this.formOA = formOA;
- }
-
- /**
- * @return the stream
- */
- public InputStream getStream() {
- return stream;
- }
-
- public OAOAuth20Config getOauth20OA() {
- return oauth20OA;
- }
-
- public void setOauth20OA(OAOAuth20Config oauth20OA) {
- this.oauth20OA = oauth20OA;
- }
-
+
+ private final Logger log = Logger.getLogger(EditOAAction.class);
+
+ private static final long serialVersionUID = 1L;
+
+ private HttpServletRequest request;
+ private HttpServletResponse response;
+
+ private AuthenticatedUser authUser;
+
+ private String oaidobj;
+ private boolean newOA;
+ private String formID;
+
+ private boolean onlyBusinessService = false;
+ private boolean onlyStorkService = false;
+ private boolean subTargetSet = false;
+ private boolean deaktivededBusinessService = false;
+ private boolean deactivatedStorkService = false;
+ private boolean isMetaDataRefreshRequired = false;
+
+ private String nextPage;
+
+ private OAGeneralConfig generalOA = new OAGeneralConfig();
+ private OAPVP2Config pvp2OA = new OAPVP2Config();
+ private OASAML1Config saml1OA = new OASAML1Config();
+ private OASSOConfig ssoOA = new OASSOConfig();
+ private OAOAuth20Config oauth20OA = new OAOAuth20Config();
+ private OASTORKConfig storkOA = new OASTORKConfig();
+ private FormularCustomization formOA = new FormularCustomization();
+
+ private InputStream stream;
+
+ private Map sendAssertionForm = new HashMap();
+ private Map bkuSelectionForm = new HashMap();
+
+ // STRUTS actions
+ public String inital() {
+ HttpSession session = request.getSession();
+ if (session == null) {
+ log.info("No http Session found.");
+ return Constants.STRUTS_ERROR;
+ }
+
+ Object authUserObj = session.getAttribute(Constants.SESSION_AUTH);
+
+ authUser = (AuthenticatedUser) authUserObj;
+
+ long oaid = -1;
+
+ if (!ValidationHelper.validateOAID(oaidobj)) {
+ addActionError(LanguageHelper.getErrorString("errors.edit.oa.oaid", request));
+ return Constants.STRUTS_ERROR;
+ }
+ oaid = Long.valueOf(oaidobj);
+
+ UserDatabase userdb = null;
+ OnlineApplication onlineapplication = null;
+
+ if (authUser.isAdmin())
+ onlineapplication = ConfigurationDBRead.getOnlineApplication(oaid);
+
+ else {
+ 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"));
+ return Constants.STRUTS_SUCCESS;
+ }
+
+ // TODO: change to direct Database operation
+ List oas = userdb.getOnlineApplication();
+ for (OnlineApplication oa : oas) {
+ if (oa.getHjid() == oaid) {
+ onlineapplication = oa;
+ break;
+ }
+ }
+ if (onlineapplication == null) {
+ addActionError(LanguageHelper.getErrorString("errors.edit.oa.oaid", request));
+ return Constants.STRUTS_ERROR;
+ }
+ }
+
+ generalOA.parse(onlineapplication);
+ ssoOA.parse(onlineapplication);
+ saml1OA.parse(onlineapplication);
+ oauth20OA.parse(onlineapplication);
+ session.setAttribute(Constants.SESSION_OAUTH20SECRET, this.oauth20OA.getClientSecret());
+
+ storkOA.parse(onlineapplication);
+
+ Map map = new HashMap();
+ map.putAll(FormBuildUtils.getDefaultMap());
+ formOA.parse(onlineapplication, map);
+
+ session.setAttribute(Constants.SESSION_BKUFORMPREVIEW, map);
+
+ List errors = pvp2OA.parse(onlineapplication);
+
+ if (errors.size() > 0) {
+ for (String el : errors)
+ addActionError(el);
+ }
+
+ subTargetSet = MiscUtil.isNotEmpty(generalOA.getTarget_subsector());
+
+ // set UserSpezific OA Parameters
+ if (!authUser.isAdmin()) generateUserSpecificConfigurationOptions(userdb);
+
+ ConfigurationDBUtils.closeSession();
+ session.setAttribute(Constants.SESSION_OAID, oaid);
+
+ formID = Random.nextRandom();
+ session.setAttribute(Constants.SESSION_FORMID, formID);
+
+ newOA = false;
+
+ return Constants.STRUTS_OA_EDIT;
+ }
+
+ public String newOA() {
+ log.debug("insert new Online-Application");
+
+ HttpSession session = request.getSession();
+ if (session == null) {
+ log.info("No http Session found.");
+ return Constants.STRUTS_ERROR;
+ }
+
+ session.setAttribute(Constants.SESSION_OAID, null);
+ nextPage = Constants.STRUTS_RETURNAREA_VALUES.main.name();
+
+ Object authUserObj = session.getAttribute(Constants.SESSION_AUTH);
+
+ authUser = (AuthenticatedUser) authUserObj;
+
+ 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"));
+ return Constants.STRUTS_SUCCESS;
+ }
+
+ MOAIDConfiguration moaidconfig = ConfigurationDBRead.getMOAIDConfiguration();
+ if (moaidconfig != null) {
+ DefaultBKUs defaultbkus = moaidconfig.getDefaultBKUs();
+ if (defaultbkus != null) {
+ generalOA.setBkuHandyURL(defaultbkus.getHandyBKU());
+ generalOA.setBkuLocalURL(defaultbkus.getLocalBKU());
+ generalOA.setBkuOnlineURL(defaultbkus.getOnlineBKU());
+ }
+ }
+
+ // set UserSpezific OA Parameters
+ if (!authUser.isAdmin()) generateUserSpecificConfigurationOptions(userdb);
+
+ ConfigurationDBUtils.closeSession();
+
+ newOA = true;
+ formID = Random.nextRandom();
+ session.setAttribute(Constants.SESSION_FORMID, formID);
+
+ session.setAttribute(Constants.SESSION_BKUFORMPREVIEW, null);
+
+ this.oauth20OA.generateClientSecret();
+ session.setAttribute(Constants.SESSION_OAUTH20SECRET, this.oauth20OA.getClientSecret());
+
+ return Constants.STRUTS_OA_EDIT;
+ }
+
+ public String saveOA() {
+ HttpSession session = request.getSession();
+ if (session == null) {
+ log.info("No http Session found.");
+ return Constants.STRUTS_ERROR;
+ }
+
+ Object authUserObj = session.getAttribute(Constants.SESSION_AUTH);
+ authUser = (AuthenticatedUser) authUserObj;
+
+ Object formidobj = session.getAttribute(Constants.SESSION_FORMID);
+ if (formidobj != null && formidobj instanceof String) {
+ String formid = (String) formidobj;
+ if (!formid.equals(formID)) {
+ log.warn("FormIDs does not match. Some suspect Form is received from user " + authUser.getFamilyName()
+ + authUser.getGivenName() + authUser.getUserID());
+ return Constants.STRUTS_ERROR;
+ }
+ } else {
+ log.warn("FormIDs does not match. Some suspect Form is received from user " + authUser.getFamilyName()
+ + authUser.getGivenName() + authUser.getUserID());
+ return Constants.STRUTS_ERROR;
+ }
+ session.setAttribute(Constants.SESSION_FORMID, null);
+
+ 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"));
+ return Constants.STRUTS_SUCCESS;
+ }
+
+ OnlineApplication onlineapplication = null;
+ List errors = new ArrayList();
+
+ Object oadbid = request.getSession().getAttribute(Constants.SESSION_OAID);
+ Long oaid = (long) -1;
+
+ if (oadbid != null) {
+ try {
+ oaid = (Long) oadbid;
+ if (oaid < 0 || oaid > Long.MAX_VALUE) {
+ addActionError(LanguageHelper.getErrorString("errors.edit.oa.oaid", request));
+ return Constants.STRUTS_ERROR;
+ }
+
+ } catch (Throwable t) {
+ addActionError(LanguageHelper.getErrorString("errors.edit.oa.oaid", request));
+ return Constants.STRUTS_ERROR;
+ }
+ }
+
+ // valid DBID and check entry
+ String oaidentifier = generalOA.getIdentifier();
+ if (MiscUtil.isEmpty(oaidentifier)) {
+ log.info("Empty OA identifier");
+ errors.add(LanguageHelper.getErrorString("validation.general.oaidentifier.empty"));
+
+ } else {
+
+ if (!ValidationHelper.validateURL(oaidentifier)) {
+ log.warn("OnlineapplikationIdentifier is not a valid URL: " + oaidentifier);
+ errors.add(LanguageHelper.getErrorString("validation.general.oaidentifier.valid",
+ new Object[]{ValidationHelper.getNotValidOAIdentifierCharacters()}));
+ } else {
+
+ if (oaid == -1) {
+ onlineapplication = ConfigurationDBRead.getOnlineApplication(oaidentifier);
+ newOA = true;
+ if (onlineapplication != null) {
+ log.info("The OAIdentifier is not unique");
+ errors.add(LanguageHelper.getErrorString("validation.general.oaidentifier.notunique"));
+ }
+
+ } else {
+ onlineapplication = ConfigurationDBRead.getOnlineApplication(oaid);
+ if (!oaidentifier.equals(onlineapplication.getPublicURLPrefix())) {
+
+ if (ConfigurationDBRead.getOnlineApplication(oaidentifier) != null) {
+ log.info("The OAIdentifier is not unique");
+ errors.add(LanguageHelper.getErrorString("validation.general.oaidentifier.notunique"));
+ }
+ }
+ }
+ }
+ }
+
+ // set UserSpezific OA Parameters
+ if (!authUser.isAdmin()) generateUserSpecificConfigurationOptions(userdb);
+
+ // check form
+ OAGeneralConfigValidation validatior_general = new OAGeneralConfigValidation();
+ OAPVP2ConfigValidation validatior_pvp2 = new OAPVP2ConfigValidation();
+ OASAML1ConfigValidation validatior_saml1 = new OASAML1ConfigValidation();
+ OASSOConfigValidation validatior_sso = new OASSOConfigValidation();
+ OASTORKConfigValidation validator_stork = new OASTORKConfigValidation();
+ FormularCustomizationValitator validator_form = new FormularCustomizationValitator();
+ OAOAUTH20ConfigValidation validatior_oauth20 = new OAOAUTH20ConfigValidation();
+ OAFileUploadValidation valiator_fileUpload = new OAFileUploadValidation();
+
+ errors.addAll(validatior_general.validate(generalOA, authUser.isAdmin()));
+ errors.addAll(validatior_pvp2.validate(pvp2OA));
+ errors.addAll(validatior_saml1.validate(saml1OA, generalOA));
+ errors.addAll(validatior_sso.validate(ssoOA, authUser.isAdmin()));
+ errors.addAll(validator_stork.validate(storkOA));
+ errors.addAll(validator_form.validate(formOA));
+ errors.addAll(validatior_oauth20.validate(oauth20OA));
+
+ //validate BKU-selection template
+ List templateError = valiator_fileUpload.validate(generalOA.getBkuSelectionFileUploadFileName()
+ , generalOA.getBkuSelectionFileUpload(), "validation.general.bkuselection", bkuSelectionForm);
+ if (templateError != null && templateError.size() == 0) {
+ if (bkuSelectionForm != null && bkuSelectionForm.size() > 0)
+ session.setAttribute(Constants.SESSION_BKUSELECTIONTEMPLATE, bkuSelectionForm);
+
+ else
+ bkuSelectionForm = (Map) session.getAttribute(Constants.SESSION_BKUSELECTIONTEMPLATE);
+
+ } else {
+ errors.addAll(templateError);
+
+ }
+
+ //validate send-assertion template
+ templateError = valiator_fileUpload.validate(generalOA.getSendAssertionFileUploadFileName()
+ , generalOA.getSendAssertionFileUpload(), "validation.general.sendassertion", sendAssertionForm);
+ if (templateError != null && templateError.size() == 0) {
+ if (sendAssertionForm != null && sendAssertionForm.size() > 0)
+ session.setAttribute(Constants.SESSION_SENDASSERTIONTEMPLATE, sendAssertionForm);
+
+ else
+ sendAssertionForm = (Map) session.getAttribute(Constants.SESSION_SENDASSERTIONTEMPLATE);
+
+ } else {
+ errors.addAll(templateError);
+
+ }
+
+
+ // Do not allow SSO in combination with special BKUSelection features
+ if (ssoOA.isUseSSO() && (formOA.isOnlyMandateAllowed() || !formOA.isShowMandateLoginButton())) {
+ log.warn("Special BKUSelection features can not be used in combination with SSO");
+ errors.add(LanguageHelper.getErrorString("validation.general.bkuselection.specialfeatures.valid"));
+ }
+
+ if (errors.size() > 0) {
+ log.info("OAConfiguration with ID " + generalOA.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 {
+
+ boolean newentry = false;
+
+ if (onlineapplication == null) {
+ onlineapplication = new OnlineApplication();
+ newentry = true;
+ onlineapplication.setIsActive(false);
+
+ if (!authUser.isAdmin()) {
+ onlineapplication.setIsAdminRequired(true);
+
+ } else
+ isMetaDataRefreshRequired = true;
+
+ } else {
+ if (!authUser.isAdmin() && !onlineapplication.getPublicURLPrefix().equals(generalOA.getIdentifier())) {
+
+ onlineapplication.setIsAdminRequired(true);
+ onlineapplication.setIsActive(false);
+ log.info("User with ID " + authUser.getUserID() + " change OA-PublicURLPrefix. Reaktivation is required.");
+ }
+
+ }
+
+ if ((onlineapplication.isIsAdminRequired() == null)
+ || (authUser.isAdmin() && generalOA.isActive() && onlineapplication.isIsAdminRequired())) {
+
+ onlineapplication.setIsAdminRequired(false);
+ isMetaDataRefreshRequired = true;
+
+ if (onlineapplication.getHjid() != null)
+ userdb = ConfigurationDBRead.getUsersWithOADBID(onlineapplication.getHjid());
+
+ if (userdb != null && !userdb.isIsAdmin()) {
+ try {
+ MailHelper.sendUserOnlineApplicationActivationMail(userdb.getGivenname(), userdb.getFamilyname(),
+ userdb.getInstitut(), onlineapplication.getPublicURLPrefix(), userdb.getMail());
+ } catch (ConfigurationException e) {
+ log.warn("Sending Mail to User " + userdb.getMail() + " failed", e);
+ }
+ }
+ }
+
+ //save OA configuration
+ String error = saveOAConfigToDatabase(onlineapplication, newentry);
+ if (MiscUtil.isNotEmpty(error)) {
+ log.warn("OA configuration can not be stored!");
+ addActionError(error);
+
+ formID = Random.nextRandom();
+ session.setAttribute(Constants.SESSION_FORMID, formID);
+ return Constants.STRUTS_ERROR_VALIDATION;
+ }
+
+ //set metadata reload flag if reload is required
+ if (pvp2OA.getMetaDataURL() != null) {
+
+ try {
+ if (isMetaDataRefreshRequired
+ || !pvp2OA.getMetaDataURL().equals(onlineapplication.getAuthComponentOA().getOAPVP2().getMetadataURL())
+ || pvp2OA.getFileUpload() != null
+ || pvp2OA.isReLoad()) {
+
+ log.debug("Set PVP2 Metadata refresh flag.");
+ MOAIDConfiguration moaconfig = ConfigurationDBRead.getMOAIDConfiguration();
+ moaconfig.setPvp2RefreshItem(new Date());
+ ConfigurationDBUtils.saveOrUpdate(moaconfig);
+
+ }
+ } catch (Throwable e) {
+ log.info("Found no MetadataURL in OA-Databaseconfig!", e);
+ }
+
+ }
+ }
+
+ 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", generalOA.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", generalOA.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() {
+
+ HttpSession session = request.getSession();
+ if (session == null) {
+ log.info("No http Session found.");
+ return Constants.STRUTS_ERROR;
+ }
+
+ 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", generalOA.getIdentifier(), request));
+
+ ConfigurationDBUtils.closeSession();
+
+ return Constants.STRUTS_SUCCESS;
+ }
+
+ public String deleteOA() {
+ HttpSession session = request.getSession();
+ if (session == null) {
+ log.info("No http Session found.");
+ return Constants.STRUTS_ERROR;
+ }
+
+ Object authUserObj = session.getAttribute(Constants.SESSION_AUTH);
+ authUser = (AuthenticatedUser) authUserObj;
+
+ Object formidobj = session.getAttribute(Constants.SESSION_FORMID);
+ if (formidobj != null && formidobj instanceof String) {
+ String formid = (String) formidobj;
+ if (!formid.equals(formID)) {
+ log.warn("FormIDs does not match. Some suspect Form is received from user " + authUser.getFamilyName()
+ + authUser.getGivenName() + authUser.getUserID());
+ return Constants.STRUTS_ERROR;
+ }
+ } else {
+ log.warn("FormIDs does not match. Some suspect Form is received from user " + authUser.getFamilyName()
+ + authUser.getGivenName() + authUser.getUserID());
+ return Constants.STRUTS_ERROR;
+ }
+ session.setAttribute(Constants.SESSION_FORMID, null);
+
+ Object nextPageAttr = session.getAttribute(Constants.SESSION_RETURNAREA);
+ if (nextPageAttr != null && nextPageAttr instanceof String) {
+ nextPage = (String) nextPageAttr;
+
+ } else {
+ nextPage = Constants.STRUTS_RETURNAREA_VALUES.main.name();
+ }
+
+ 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"));
+ return Constants.STRUTS_SUCCESS;
+ }
+
+ String oaidentifier = generalOA.getIdentifier();
+ if (MiscUtil.isEmpty(oaidentifier)) {
+ log.info("Empty OA identifier");
+ addActionError(LanguageHelper.getErrorString("validation.general.oaidentifier.empty"));
+
+ formID = Random.nextRandom();
+ session.setAttribute(Constants.SESSION_FORMID, formID);
+ return Constants.STRUTS_ERROR_VALIDATION;
+
+ } else {
+ if (ValidationHelper.isValidOAIdentifier(oaidentifier)) {
+ log.warn("IdentificationNumber contains potentail XSS characters: " + oaidentifier);
+ addActionError(LanguageHelper.getErrorString("validation.general.oaidentifier.valid",
+ new Object[]{ValidationHelper.getNotValidOAIdentifierCharacters()}));
+
+ formID = Random.nextRandom();
+ session.setAttribute(Constants.SESSION_FORMID, formID);
+ return Constants.STRUTS_ERROR_VALIDATION;
+ }
+ }
+
+ 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", generalOA.getIdentifier(), request));
+
+ return Constants.STRUTS_SUCCESS;
+
+ } else {
+ ConfigurationDBUtils.closeSession();
+ addActionError(LanguageHelper.getGUIString("webpages.oaconfig.delete.error", generalOA.getIdentifier(), request));
+ return Constants.STRUTS_SUCCESS;
+ }
+
+ }
+
+ public String bkuFramePreview() {
+
+ String preview = null;
+
+ HttpSession session = request.getSession();
+ if (session == null) {
+ log.info("No http Session found.");
+ preview = LanguageHelper.getErrorString("error.bkuformpreview.notpossible");
+
+ } else {
+ InputStream input = null;
+
+ try {
+ Object mapobj = session.getAttribute(Constants.SESSION_BKUFORMPREVIEW);
+ if (mapobj != null && mapobj instanceof Map, ?>) {
+
+ ConfigurationProvider config = ConfigurationProvider.getInstance();
+ String templateURL = config.getConfigRootDir() + ConfigurationProvider.HTMLTEMPLATE_DIR
+ + ConfigurationProvider.HTMLTEMPLATE_FILE;
+
+ File file = new File(templateURL);
+ input = new FileInputStream(file);
+
+ String contextpath = config.getMOAIDInstanceURL();
+ if (MiscUtil.isEmpty(contextpath)) {
+ log.info("NO MOA-ID instance URL configurated.");
+ throw new ConfigurationException("No MOA-ID instance configurated");
+ }
+
+ preview = LoginFormBuilder.getTemplate(input);
+ preview = preview.replace(LoginFormBuilder.CONTEXTPATH, contextpath);
+
+ Map map = (Map) mapobj;
+
+ request.setCharacterEncoding("UTF-8");
+
+ String module = request.getParameter(Constants.REQUEST_FORMCUSTOM_MODULE);
+ String value = request.getParameter(Constants.REQUEST_FORMCUSTOM_VALUE);
+
+ if (value != null) {
+ String[] query = URLDecoder.decode(request.getQueryString()).split("&");
+ value = query[1].substring("value=".length());
+ }
+
+ synchronized (map) {
+
+ if (MiscUtil.isNotEmpty(module)) {
+ if (map.containsKey("#" + module + "#")) {
+ if (MiscUtil.isNotEmpty(value)) {
+ if (FormBuildUtils.FONTFAMILY.contains(module) || FormBuildUtils.HEADER_TEXT.contains(module)
+ || value.startsWith("#"))
+ map.put("#" + module + "#", value);
+ else
+ map.put("#" + module + "#", "#" + value);
+
+ } else {
+ map.put("#" + module + "#", FormBuildUtils.getDefaultMap().get("#" + module + "#"));
+ }
+ }
+ }
+ preview = FormBuildUtils.customiceLayoutBKUSelection(preview, true, false, map, true);
+ }
+
+ } else {
+ preview = LanguageHelper.getErrorString("error.bkuformpreview.notpossible");
+
+ }
+
+ } catch (Exception e) {
+ log.warn("BKUSelection Preview can not be generated.", e);
+ preview = LanguageHelper.getErrorString("error.bkuformpreview.notpossible");
+
+ }
+ }
+
+ stream = new ByteArrayInputStream(preview.getBytes());
+
+ return Constants.STRUTS_SUCCESS;
+ }
+
+ private String saveOAConfigToDatabase(OnlineApplication dboa, boolean newentry) {
+
+ AuthComponentOA authoa = dboa.getAuthComponentOA();
+ if (authoa == null) {
+ authoa = new AuthComponentOA();
+ dboa.setAuthComponentOA(authoa);
+ }
+
+ if (authUser.isAdmin()) dboa.setIsActive(generalOA.isActive());
+
+ dboa.setFriendlyName(generalOA.getFriendlyName());
+ dboa.setCalculateHPI(generalOA.isCalculateHPI());
+ dboa.setRemoveBPKFromAuthBlock(generalOA.isHideBPKAuthBlock());
+
+ if (authUser.isAdmin())
+ dboa.setKeyBoxIdentifier(MOAKeyBoxSelector.fromValue(generalOA.getKeyBoxIdentifier()));
+ else {
+ if (newentry) dboa.setKeyBoxIdentifier(MOAKeyBoxSelector.SECURE_SIGNATURE_KEYPAIR);
+ }
+
+ dboa.setPublicURLPrefix(generalOA.getIdentifier());
+
+ if (generalOA.isStorkService() || onlyStorkService) {
+ dboa.setType(Constants.MOA_CONFIG_STORKSERVICE);
+ dboa.setStorkSPTargetCountry(generalOA.getStorkSPTargetCountry());
+
+
+ String num = generalOA.getIdentificationNumber().replaceAll(" ", "");
+
+ if (num.startsWith(Constants.IDENIFICATIONTYPE_STORK))
+ num = num.substring(Constants.IDENIFICATIONTYPE_STORK.length());
+
+ IdentificationNumber idnumber = new IdentificationNumber();
+ idnumber.setValue(Constants.PREFIX_STORK + "AT+" + generalOA.getIdentificationType() + num);
+ idnumber.setType(Constants.BUSINESSSERVICENAMES.get(generalOA.getIdentificationType()));
+
+ authoa.setIdentificationNumber(idnumber);
+
+ } else if (generalOA.isBusinessService() || onlyBusinessService) {
+
+ dboa.setType(Constants.MOA_CONFIG_BUSINESSSERVICE);
+
+ String num = generalOA.getIdentificationNumber().replaceAll(" ", "");
+ if (num.startsWith(Constants.IDENIFICATIONTYPE_FN)) {
+ num = num.substring(Constants.IDENIFICATIONTYPE_FN.length());
+
+ num = at.gv.egovernment.moa.util.StringUtils.deleteLeadingZeros(num);
+
+ // num = StringUtils.leftPad(num, 7, '0');
+ }
+
+ if (num.startsWith(Constants.IDENIFICATIONTYPE_ZVR))
+ num = num.substring(Constants.IDENIFICATIONTYPE_ZVR.length());
+
+ if (num.startsWith(Constants.IDENIFICATIONTYPE_ERSB))
+ num = num.substring(Constants.IDENIFICATIONTYPE_ERSB.length());
+
+ IdentificationNumber idnumber = new IdentificationNumber();
+ idnumber.setValue(Constants.PREFIX_WPBK + generalOA.getIdentificationType() + "+" + num);
+ idnumber.setType(Constants.BUSINESSSERVICENAMES.get(generalOA.getIdentificationType()));
+
+ authoa.setIdentificationNumber(idnumber);
+
+ } else {
+ dboa.setType(null);
+
+ if (authUser.isAdmin()) {
+ if (MiscUtil.isNotEmpty(generalOA.getTarget_admin()) && generalOA.isAdminTarget()) {
+ dboa.setTarget(generalOA.getTarget_admin());
+ dboa.setTargetFriendlyName(generalOA.getTargetFriendlyName());
+
+ } else {
+
+ String target = generalOA.getTarget();
+
+ if (MiscUtil.isNotEmpty(generalOA.getTarget_subsector()) && subTargetSet)
+ dboa.setTarget(target + "-" + generalOA.getTarget_subsector());
+ else
+ dboa.setTarget(target);
+
+ String targetname = TargetValidator.getTargetFriendlyName(target);
+ if (MiscUtil.isNotEmpty(targetname)) dboa.setTargetFriendlyName(targetname);
+
+ }
+
+ } else {
+
+ if (MiscUtil.isNotEmpty(generalOA.getTarget())) {
+
+ String target = generalOA.getTarget();
+
+ if (MiscUtil.isNotEmpty(generalOA.getTarget_subsector()) && subTargetSet)
+ dboa.setTarget(target + "-" + generalOA.getTarget_subsector());
+
+ else
+ dboa.setTarget(target);
+
+ String targetname = TargetValidator.getTargetFriendlyName(target);
+ if (MiscUtil.isNotEmpty(targetname)) dboa.setTargetFriendlyName(targetname);
+
+ }
+ }
+ }
+
+ //store BKU-URLs
+ BKUURLS bkuruls = new BKUURLS();
+ authoa.setBKUURLS(bkuruls);
+ if (authUser.isAdmin()) {
+ bkuruls.setHandyBKU(generalOA.getBkuHandyURL());
+ bkuruls.setLocalBKU(generalOA.getBkuLocalURL());
+ bkuruls.setOnlineBKU(generalOA.getBkuOnlineURL());
+ }
+
+ TemplatesType templates = authoa.getTemplates();
+ if (templates == null) {
+ templates = new TemplatesType();
+ authoa.setTemplates(templates);
+ }
+
+ //store BKU-selection and send-assertion templates
+ if (authUser.isAdmin()) {
+
+ if (generalOA.isDeleteBKUTemplate())
+ templates.setBKUSelectionTemplate(null);
+
+ if (generalOA.isDeleteSendAssertionTemplate())
+ templates.setSendAssertionTemplate(null);
+
+
+ if (bkuSelectionForm != null && bkuSelectionForm.size() > 0) {
+ TransformsInfoType template = new TransformsInfoType();
+
+ Iterator interator = bkuSelectionForm.keySet().iterator();
+ template.setFilename(interator.next());
+ template.setTransformation(bkuSelectionForm.get(
+ template.getFilename()));
+
+ templates.setBKUSelectionTemplate(template);
+ }
+
+ if (sendAssertionForm != null && sendAssertionForm.size() > 0) {
+ TransformsInfoType template = new TransformsInfoType();
+
+ Iterator interator = sendAssertionForm.keySet().iterator();
+ template.setFilename(interator.next());
+ template.setTransformation(sendAssertionForm.get(
+ template.getFilename()));
+
+ templates.setSendAssertionTemplate(template);
+ }
+ }
+
+
+ //store BKU-selection customization
+ BKUSelectionCustomizationType bkuselectioncustom = templates.getBKUSelectionCustomization();
+ if (bkuselectioncustom == null) {
+ bkuselectioncustom = new BKUSelectionCustomizationType();
+ templates.setBKUSelectionCustomization(bkuselectioncustom);
+ }
+
+ Mandates mandates = new Mandates();
+ if (generalOA.isUseMandates()) {
+ mandates.setProfiles(generalOA.getMandateProfiles());
+
+ } else {
+ mandates.setProfiles(new String());
+ }
+
+ authoa.setMandates(mandates);
+ bkuselectioncustom.setMandateLoginButton(MiscUtil.isNotEmpty(generalOA.getMandateProfiles()));
+ bkuselectioncustom.setOnlyMandateLoginAllowed(formOA.isOnlyMandateAllowed());
+
+ if (authUser.isAdmin()) {
+ templates.setAditionalAuthBlockText(generalOA.getAditionalAuthBlockText());
+
+ List template = templates.getTemplate();
+ if (generalOA.isLegacy()) {
+
+ if (template == null)
+ template = new ArrayList();
+ else
+ template.clear();
+
+ if (MiscUtil.isNotEmpty(generalOA.getSLTemplateURL1())) {
+ TemplateType el = new TemplateType();
+ el.setURL(generalOA.getSLTemplateURL1());
+ template.add(el);
+ } else
+ template.add(new TemplateType());
+ if (MiscUtil.isNotEmpty(generalOA.getSLTemplateURL2())) {
+ TemplateType el = new TemplateType();
+ el.setURL(generalOA.getSLTemplateURL2());
+ template.add(el);
+ } else
+ template.add(new TemplateType());
+ if (MiscUtil.isNotEmpty(generalOA.getSLTemplateURL3())) {
+ TemplateType el = new TemplateType();
+ el.setURL(generalOA.getSLTemplateURL3());
+ template.add(el);
+ } else
+ template.add(new TemplateType());
+
+ } else {
+ if (template != null && template.size() > 0) template.clear();
+ }
+
+ bkuselectioncustom.setBackGroundColor(parseColor(formOA.getBackGroundColor()));
+ bkuselectioncustom.setFrontColor(parseColor(formOA.getFrontColor()));
+
+ bkuselectioncustom.setHeaderBackGroundColor(parseColor(formOA.getHeader_BackGroundColor()));
+ bkuselectioncustom.setHeaderFrontColor(parseColor(formOA.getHeader_FrontColor()));
+ bkuselectioncustom.setHeaderText(formOA.getHeader_text());
+
+ bkuselectioncustom.setButtonBackGroundColor(parseColor(formOA.getButton_BackGroundColor()));
+ bkuselectioncustom.setButtonBackGroundColorFocus(parseColor(formOA.getButton_BackGroundColorFocus()));
+ bkuselectioncustom.setButtonFontColor(parseColor(formOA.getButton_FrontColor()));
+
+ if (MiscUtil.isNotEmpty(formOA.getAppletRedirectTarget()))
+ bkuselectioncustom.setAppletRedirectTarget(formOA.getAppletRedirectTarget());
+
+ bkuselectioncustom.setFontType(formOA.getFontType());
+
+ bkuselectioncustom.setAppletHeight(formOA.getApplet_height());
+ bkuselectioncustom.setAppletWidth(formOA.getApplet_width());
+
+ }
+
+ // set default transformation if it is empty
+ List transformsInfo = authoa.getTransformsInfo();
+ if (transformsInfo == null) {
+ // TODO: set OA specific transformation if it is required
+
+ }
+
+ OAPVP2 pvp2 = authoa.getOAPVP2();
+ if (pvp2 == null) {
+ pvp2 = new OAPVP2();
+ authoa.setOAPVP2(pvp2);
+ }
+
+ pvp2.setMetadataURL(pvp2OA.getMetaDataURL());
+ try {
+
+ if (pvp2OA.getFileUpload() != null) pvp2.setCertificate(pvp2OA.getCertificate());
+
+ } catch (CertificateException e) {
+ log.info("Uploaded Certificate can not be found", e);
+ return LanguageHelper.getErrorString("validation.pvp2.certificate.notfound");
+ } catch (IOException e) {
+ log.info("Uploaded Certificate can not be parsed", e);
+ return LanguageHelper.getErrorString("validation.pvp2.certificate.format");
+ }
+
+ OASAML1 saml1 = authoa.getOASAML1();
+ if (saml1 == null) {
+ saml1 = new OASAML1();
+ authoa.setOASAML1(saml1);
+ saml1.setIsActive(false);
+ }
+
+ if (authUser.isAdmin()) {
+ saml1.setIsActive(saml1OA.isActive());
+ }
+
+ if (saml1.isIsActive() != null && saml1.isIsActive()) {
+ saml1.setProvideAUTHBlock(saml1OA.isProvideAuthBlock());
+ saml1.setProvideCertificate(saml1OA.isProvideCertificate());
+ saml1.setProvideFullMandatorData(saml1OA.isProvideFullMandateData());
+ saml1.setProvideIdentityLink(saml1OA.isProvideIdentityLink());
+ saml1.setProvideStammzahl(saml1OA.isProvideStammZahl());
+ saml1.setUseCondition(saml1OA.isUseCondition());
+ saml1.setConditionLength(BigInteger.valueOf(saml1OA.getConditionLength()));
+ // TODO: set sourceID
+ // saml1.setSourceID("");
+ }
+
+ OASSO sso = authoa.getOASSO();
+ if (sso == null) {
+ sso = new OASSO();
+ authoa.setOASSO(sso);
+ sso.setAuthDataFrame(true);
+ }
+ sso.setUseSSO(ssoOA.isUseSSO());
+
+ if (authUser.isAdmin()) sso.setAuthDataFrame(ssoOA.isShowAuthDataFrame());
+
+ sso.setSingleLogOutURL(ssoOA.getSingleLogOutURL());
+
+ if (oauth20OA != null) {
+ log.debug("Saving OAuth 2.0 configuration:");
+ OAOAUTH20 oaOAuth20 = authoa.getOAOAUTH20();
+ if (oaOAuth20 == null) {
+ oaOAuth20 = new OAOAUTH20();
+ authoa.setOAOAUTH20(oaOAuth20);
+ }
+
+ oaOAuth20.setOAuthClientId(generalOA.getIdentifier());
+ // oaOAuth20.setOAuthClientSecret(oauth20OA.getClientSecret());
+ oaOAuth20.setOAuthRedirectUri(oauth20OA.getRedirectUri());
+ log.debug("client id: " + oauth20OA.getClientId());
+ log.debug("client secret: " + oauth20OA.getClientSecret());
+ log.debug("redirect uri:" + oauth20OA.getRedirectUri());
+
+ oaOAuth20.setOAuthClientSecret((String) request.getSession().getAttribute(Constants.SESSION_OAUTH20SECRET));
+ request.getSession().setAttribute(Constants.SESSION_OAUTH20SECRET, null);
+
+ }
+
+
+ // fetch stork configuration from database model
+ OASTORK stork = authoa.getOASTORK();
+ if (stork == null) {
+ // if there is none, create a new one with default values.
+ stork = new OASTORK();
+ authoa.setOASTORK(stork);
+ stork.setStorkLogonEnabled(false);
+ }
+ // transfer the incoming data to the database model
+ stork.setStorkLogonEnabled(storkOA.isStorkLogonEnabled());
+ stork.setQaa(storkOA.getQaa());
+ stork.setOAAttributes(storkOA.getAttributes());
+ stork.setVidpEnabled(storkOA.isVidpEnabled());
+ stork.setAttributeProviders(storkOA.getAttributeProviderPlugins());
+
+ try {
+ if (newentry) {
+ ConfigurationDBUtils.save(dboa);
+
+ if (!authUser.isAdmin()) {
+ UserDatabase user = ConfigurationDBRead.getUserWithID(authUser.getUserID());
+
+ List useroas = user.getOnlineApplication();
+ if (useroas == null) useroas = new ArrayList();
+
+ useroas.add(dboa);
+ ConfigurationDBUtils.saveOrUpdate(user);
+ }
+ } else
+ ConfigurationDBUtils.saveOrUpdate(dboa);
+
+ } catch (MOADatabaseException e) {
+ log.warn("Online-Application can not be stored.", e);
+ return LanguageHelper.getErrorString("error.db.oa.store");
+ }
+
+ return null;
+ }
+
+ private String parseColor(String color) {
+ String value = "";
+
+ if (MiscUtil.isNotEmpty(color)) {
+ if (!color.startsWith("#"))
+ value = "#" + color;
+ else
+ value = color;
+ }
+ return value;
+ }
+
+ private void generateUserSpecificConfigurationOptions(UserDatabase userdb) {
+
+ if (userdb.isIsMandateUser() != null && userdb.isIsMandateUser()) {
+ String bpk = userdb.getBpk();
+ if (bpk.startsWith(Constants.IDENIFICATIONTYPE_BASEID_FN) || bpk.startsWith(Constants.IDENIFICATIONTYPE_BASEID_ZVR)) {
+ onlyBusinessService = true;
+ generalOA.setBusinessService(true);
+ } else if (bpk.startsWith(Constants.IDENIFICATIONTYPE_STORK)) {
+ onlyStorkService = true;
+ generalOA.setStorkService(true);
+ }
+
+ deaktivededBusinessService = true;
+ deactivatedStorkService = true;
+ String[] split = bpk.split("\\+");
+ generalOA.setIdentificationType(split[1].substring(1));
+
+ if (bpk.startsWith(Constants.IDENIFICATIONTYPE_BASEID_FN))
+ generalOA.setIdentificationNumber(at.gv.egovernment.moa.util.StringUtils.deleteLeadingZeros(split[2]));
+ else
+ generalOA.setIdentificationNumber(split[2]);
+
+ }
+
+ }
+
+ public String setGeneralOAConfig() {
+
+ return Constants.STRUTS_SUCCESS;
+ }
+
+ public String setSAML1OAConfig() {
+
+ return Constants.STRUTS_SUCCESS;
+ }
+
+ public String setPVP2OAConfig() {
+
+ return Constants.STRUTS_SUCCESS;
+ }
+
+ public String setSSOOAConfig() {
+
+ return Constants.STRUTS_SUCCESS;
+ }
+
+ public String setSTORKOAConfig() {
+
+ return Constants.STRUTS_SUCCESS;
+ }
+
+ // Getter and Setter
+ public void setServletResponse(HttpServletResponse arg0) {
+ this.response = arg0;
+
+ }
+
+ public void setServletRequest(HttpServletRequest arg0) {
+ this.request = arg0;
+
+ }
+
+ public HttpServletRequest getRequest() {
+ return request;
+ }
+
+ public void setRequest(HttpServletRequest request) {
+ this.request = request;
+ }
+
+ public HttpServletResponse getResponse() {
+ return response;
+ }
+
+ public void setResponse(HttpServletResponse response) {
+ this.response = response;
+ }
+
+ public OAGeneralConfig getGeneralOA() {
+ return generalOA;
+ }
+
+ public void setGeneralOA(OAGeneralConfig generalOA) {
+ this.generalOA = generalOA;
+ }
+
+ public OAPVP2Config getPvp2OA() {
+ return pvp2OA;
+ }
+
+ public void setPvp2OA(OAPVP2Config pvp2oa) {
+ pvp2OA = pvp2oa;
+ }
+
+ public OASAML1Config getSaml1OA() {
+ return saml1OA;
+ }
+
+ public void setSaml1OA(OASAML1Config saml1oa) {
+ saml1OA = saml1oa;
+ }
+
+ public OASSOConfig getSsoOA() {
+ return ssoOA;
+ }
+
+ public void setSsoOA(OASSOConfig ssoOA) {
+ this.ssoOA = ssoOA;
+ }
+
+ public OASTORKConfig getStorkOA() {
+ return storkOA;
+ }
+
+ public void setStorkOA(OASTORKConfig storkOA) {
+ this.storkOA = storkOA;
+ }
+
+ /**
+ * @param oaidobj the oaidobj to set
+ */
+ public void setOaidobj(String oaidobj) {
+ this.oaidobj = oaidobj;
+ }
+
+ /**
+ * @return the authUser
+ */
+ public AuthenticatedUser getAuthUser() {
+ return authUser;
+ }
+
+ /**
+ * @return the newOA
+ */
+ public boolean isNewOA() {
+ return newOA;
+ }
+
+ /**
+ * @param newOA the newOA to set
+ */
+ public void setNewOA(boolean newOA) {
+ this.newOA = newOA;
+ }
+
+ /**
+ * @return the nextPage
+ */
+ public String getNextPage() {
+ return nextPage;
+ }
+
+ /**
+ * @return the formID
+ */
+ public String getFormID() {
+ return formID;
+ }
+
+ /**
+ * @param formID the formID to set
+ */
+ public void setFormID(String formID) {
+ this.formID = formID;
+ }
+
+ /**
+ * @return the onlyBusinessService
+ */
+ public boolean isOnlyBusinessService() {
+ return onlyBusinessService;
+ }
+
+ /**
+ * @param onlyStorkService the onlyStorkService to set
+ */
+ public void setOnlyStorkService(boolean onlyStorkService) {
+ this.onlyStorkService = onlyStorkService;
+ }
+
+ /**
+ * @return the onlyStorkService
+ */
+ public boolean isOnlyStorkService() {
+ return onlyStorkService;
+ }
+
+ /**
+ * @param onlyBusinessService the onlyBusinessService to set
+ */
+ public void setOnlyBusinessService(boolean onlyBusinessService) {
+ this.onlyBusinessService = onlyBusinessService;
+ }
+
+
+ /**
+ * @return the subTargetSet
+ */
+ public boolean isSubTargetSet() {
+ return subTargetSet;
+ }
+
+ /**
+ * @param subTargetSet the subTargetSet to set
+ */
+ public void setSubTargetSet(boolean subTargetSet) {
+ this.subTargetSet = subTargetSet;
+ }
+
+ /**
+ * @return the deaktivededBusinessService
+ */
+ public boolean isDeaktivededBusinessService() {
+ return deaktivededBusinessService;
+ }
+
+ /**
+ * @return the deactivatedStorkService
+ */
+ public boolean isDeactivatedStorkService() {
+ return deactivatedStorkService;
+ }
+
+ /**
+ * @param deactivatedStorkService the deactivatedStorkService to set
+ */
+
+ public void setDeactivatedStorkService(boolean deactivatedStorkService) {
+
+ this.deactivatedStorkService = deactivatedStorkService;
+ }
+
+ /**
+ * @param deaktivededBusinessService the deaktivededBusinessService to set
+ */
+ public void setDeaktivededBusinessService(boolean deaktivededBusinessService) {
+ this.deaktivededBusinessService = deaktivededBusinessService;
+ }
+
+ /**
+ * @return the formOA
+ */
+ public FormularCustomization getFormOA() {
+ return formOA;
+ }
+
+ /**
+ * @param formOA the formOA to set
+ */
+ public void setFormOA(FormularCustomization formOA) {
+ this.formOA = formOA;
+ }
+
+ /**
+ * @return the stream
+ */
+ public InputStream getStream() {
+ return stream;
+ }
+
+ public OAOAuth20Config getOauth20OA() {
+ return oauth20OA;
+ }
+
+ public void setOauth20OA(OAOAuth20Config oauth20OA) {
+ this.oauth20OA = oauth20OA;
+ }
+
}
diff --git a/id/ConfigWebTool/src/main/resources/applicationResources.properties b/id/ConfigWebTool/src/main/resources/applicationResources.properties
index a033205ed..5859ce477 100644
--- a/id/ConfigWebTool/src/main/resources/applicationResources.properties
+++ b/id/ConfigWebTool/src/main/resources/applicationResources.properties
@@ -185,7 +185,10 @@ webpages.oaconfig.general.mandate.profiles=Profile
webpages.oaconfig.general.mandate.usemandate=Vollmachten (ja/nein)
webpages.oaconfig.general.friendlyname=Name der Online-Applikation
webpages.oaconfig.general.isbusinessservice=Privatwirtschaftliche Applikation
+webpages.oaconfig.general.isstorkservice=Stork Applikation
webpages.oaconfig.general.public.header=Öffentlicher Bereich
+webpages.oaconfig.general.stork.header=STORK Bereich
+webpages.oaconfig.general.stork.countrycode=Landesvorwahl
webpages.oaconfig.general.target.friendlyname=Bezeichnung des Bereichs (Frei w\u00E4hlbar)
webpages.oaconfig.general.target.admin.checkbox=Anderen Bereich frei definieren
webpages.oaconfig.general.target.admin=Bereich (Frei w\u00E4hlbar)
diff --git a/id/ConfigWebTool/src/main/webapp/js/common.js b/id/ConfigWebTool/src/main/webapp/js/common.js
index 5fbbdafd1..7e42eaf30 100644
--- a/id/ConfigWebTool/src/main/webapp/js/common.js
+++ b/id/ConfigWebTool/src/main/webapp/js/common.js
@@ -22,17 +22,33 @@
*******************************************************************************/
function oaBusinessService() {
if ($('#OAisbusinessservice').attr('checked') == 'checked') {
-
- $('#oa_config_businessservice').css('display', "block");
+ $('#OAisstorkservice').attr('checked',false);
+ $('#oa_config_storkservice').css('display', "none");
+ $('#oa_config_businessservice').css('display', "block");
$('#oa_config_publicservice').css('display', "none");
} else {
-
- $('#oa_config_businessservice').css('display', "none");
+ $('#oa_config_storkservice').css('display', "none");
+ $('#oa_config_businessservice').css('display', "none");
$('#oa_config_publicservice').css('display', "block");
}
}
+function oaStorkService() {
+ if ($('#OAisstorkservice').attr('checked') == 'checked') {
+ $('#OAisbusinessservice').attr('checked',false);
+ $('#oa_config_storkservice').css('display', "block");
+ $('#oa_config_businessservice').css('display', "none");
+ $('#oa_config_publicservice').css('display', "none");
+
+ } else {
+ $('#oa_config_storkservice').css('display', "none");
+ $('#oa_config_businessservice').css('display', "none");
+ $('#oa_config_publicservice').css('display', "block");
+
+ }
+}
+
function oaSSOService() {
if ($('#OAuseSSO').attr('checked') == 'checked') {
@@ -199,6 +215,7 @@ function userOnLoad() {
}
function oaOnLoad() {
oaBusinessService();
+ oaStorkService();
oaSSOService();
oaLegacyService();
AdminTarget();
diff --git a/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp b/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp
index 1f42bf092..cf8626ae3 100644
--- a/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp
+++ b/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp
@@ -59,16 +59,28 @@
key="webpages.oaconfig.general.friendlyname"
cssClass="textfield_long">
-
-
-
+
+
+
+
+
+
+
+
@@ -89,6 +101,17 @@
disabled="%{isDeaktivededBusinessService()}">
+
+
+
<%=LanguageHelper.getGUIString("webpages.oaconfig.general.stork.header", request) %>
+
+
+
diff --git a/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd b/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd
index d20ec1c68..b2c9eb58c 100644
--- a/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd
+++ b/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd
@@ -11,14 +11,16 @@
-
+
+
-
+
+
--
cgit v1.2.3
From 4ade7db6124eec07aebf087721d3d478f92bdaad Mon Sep 17 00:00:00 2001
From: Florian Reimair
Date: Wed, 12 Mar 2014 09:59:19 +0100
Subject: added consent-checkbox to config ui
---
.../moa/id/configuration/data/oa/OASTORKConfig.java | 10 ++++++++++
.../moa/id/configuration/struts/action/EditOAAction.java | 1 +
.../src/main/resources/applicationResources.properties | 1 +
id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp | 6 ++++++
.../gv/egovernment/moa/id/config/auth/OAAuthParameter.java | 5 ++++-
.../moa/id/protocols/stork2/AttributeCollector.java | 7 ++++++-
.../src/main/resources/config/moaid_config_2.0.xsd | 13 +++++++++----
7 files changed, 37 insertions(+), 6 deletions(-)
(limited to 'id/server/moa-id-commons/src/main')
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 929a3673c..d9f2a4d85 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
@@ -84,6 +84,7 @@ public class OASTORKConfig {
// fetch vidp config
setVidpEnabled(config.isVidpEnabled());
+ setRequireConsent(config.isRequireConsent());
attributeProviderPlugins = config.getAttributeProviders();
// - if no attribute providers are configured, add a dummy
@@ -150,6 +151,7 @@ public class OASTORKConfig {
*/
private boolean vidpEnabled = false;
private List attributeProviderPlugins = new ArrayList();
+ private boolean requireConsent;
public List getAvailableAttributeProviderPlugins() {
return AttributeProviderFactory.getAvailablePlugins();
@@ -170,4 +172,12 @@ public class OASTORKConfig {
public void setVidpEnabled(boolean update) {
vidpEnabled = update;
}
+
+ public boolean isRequireConsent() {
+ return requireConsent;
+ }
+
+ public void setRequireConsent(boolean update) {
+ requireConsent = update;
+ }
}
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 370923ca1..f8a12e58b 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
@@ -1036,6 +1036,7 @@ public class EditOAAction extends ActionSupport implements ServletRequestAware,
stork.setQaa(storkOA.getQaa());
stork.setOAAttributes(storkOA.getAttributes());
stork.setVidpEnabled(storkOA.isVidpEnabled());
+ stork.setRequireConsent(storkOA.isRequireConsent());
stork.setAttributeProviders(storkOA.getAttributeProviderPlugins());
try {
diff --git a/id/ConfigWebTool/src/main/resources/applicationResources.properties b/id/ConfigWebTool/src/main/resources/applicationResources.properties
index ef52892b3..18d19c06b 100644
--- a/id/ConfigWebTool/src/main/resources/applicationResources.properties
+++ b/id/ConfigWebTool/src/main/resources/applicationResources.properties
@@ -278,6 +278,7 @@ webpages.oaconfig.oauth20.clientSecret=Client Passwort
webpages.oaconfig.oauth20.redirectUri=Redirect Uri
webpages.oaconfig.vidp.enabled=VIDP interface aktiv
+webpages.oaconfig.vidp.requireconsent=Zustimmung f\u00FCr das Ausliefern der Attribute vom Benutzer einholen?
webpages.oaconfig.vidp.ap.new=Neuen Attribut Provider erstellen
webpages.oaconfig.vidp.ap.remove=Entfernen
webpages.oaconfig.vidp.ap.list=Liste der konfigurierten Attribut Provider
diff --git a/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp b/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp
index 78ad500ef..6749b5131 100644
--- a/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp
+++ b/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp
@@ -537,6 +537,12 @@
key="webpages.oaconfig.vidp.enabled"
cssClass="checkbox"
id="OAuseVidp" />
+
<%=LanguageHelper.getGUIString("webpages.oaconfig.vidp.ap.list", request) %>
AP Plugin | URL | Attribute (CSV) |
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java
index d1de20c4d..31ba64be0 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java
@@ -67,7 +67,6 @@ import at.gv.egovernment.moa.id.commons.db.dao.config.TemplatesType;
import at.gv.egovernment.moa.id.commons.db.dao.config.TransformsInfoType;
import at.gv.egovernment.moa.id.config.ConfigurationUtils;
import at.gv.egovernment.moa.id.config.OAParameter;
-import at.gv.egovernment.moa.id.protocols.stork2.AttributeProvider;
import at.gv.egovernment.moa.id.util.FormBuildUtils;
import at.gv.egovernment.moa.logging.Logger;
import at.gv.egovernment.moa.util.MiscUtil;
@@ -350,6 +349,10 @@ public List getRequestedAttributes() {
return oa_auth.getOASTORK().getOAAttributes();
}
+public boolean isRequireConsentForStorkAttributes() {
+ return oa_auth.getOASTORK().isRequireConsent();
+}
+
public List getStorkAPs() {
return oa_auth.getOASTORK().getAttributeProviders();
}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java
index 5d972ba00..7dbbb5734 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java
@@ -148,7 +148,12 @@ public class AttributeCollector implements IAction {
// else, update any existing attributes
addOrUpdateAll(container.getResponse().getPersonalAttributeList(), aquiredAttributes);
}
- new ConsentEvaluatorSepp().requestConsent(container, response, oaParam);
+
+ // ask for consent if necessary
+ if(oaParam.isRequireConsentForStorkAttributes())
+ new ConsentEvaluator().requestConsent(container, response, oaParam);
+ else
+ new ConsentEvaluator().generateSTORKResponse(response, container);
return "12345"; // AssertionId
diff --git a/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd b/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd
index b7e8f6ff3..936363169 100644
--- a/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd
+++ b/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd
@@ -883,11 +883,16 @@
-
-
-
+
+
+
-
+
+
+
--
cgit v1.2.3
From 60ac2a89fce86eb1e8344eb22535cfdd0b9aa147 Mon Sep 17 00:00:00 2001
From: Bojan Suzic
Date: Fri, 14 Mar 2014 18:37:56 +0100
Subject: attr
---
id/ConfigWebTool/ConfigurationInterface.iml | 9 ++--
id/pom.xml | 5 +++
id/server/auth/moa-id-auth.iml | 9 ++--
id/server/idserverlib/moa-id-lib.iml | 9 ++--
id/server/idserverlib/pom.xml | 5 ++-
.../id/protocols/stork2/AttributeCollector.java | 1 +
.../protocols/stork2/AttributeProviderFactory.java | 10 ++++-
.../id/protocols/stork2/AuthenticationRequest.java | 32 ++++++++++++-
.../moa/id/protocols/stork2/ConsentEvaluator.java | 8 +++-
.../stork2/MandateAttributeRequestProvider.java | 52 ++++++++++++++++++++++
.../src/main/resources/config/moaid_config_2.0.xsd | 2 +-
id/server/pom.xml | 2 +-
id/server/proxy/moa-id-proxy.iml | 9 ++--
pom.xml | 2 +-
14 files changed, 125 insertions(+), 30 deletions(-)
create mode 100644 id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateAttributeRequestProvider.java
(limited to 'id/server/moa-id-commons/src/main')
diff --git a/id/ConfigWebTool/ConfigurationInterface.iml b/id/ConfigWebTool/ConfigurationInterface.iml
index 13c327c84..77fafd064 100644
--- a/id/ConfigWebTool/ConfigurationInterface.iml
+++ b/id/ConfigWebTool/ConfigurationInterface.iml
@@ -35,7 +35,6 @@
-
@@ -106,8 +105,8 @@
-
-
+
+
@@ -125,7 +124,7 @@
-
+
@@ -165,7 +164,7 @@
-
+
diff --git a/id/pom.xml b/id/pom.xml
index bd3344638..5eb67cc9f 100644
--- a/id/pom.xml
+++ b/id/pom.xml
@@ -43,6 +43,11 @@
org.slf4j:1.5*
org.slf4j:1.6*
+ SamlEngine:1.1*
+ SamlEngine:1.2*
+ Commons:1.1*
+ Commons:1.2*
+
diff --git a/id/server/auth/moa-id-auth.iml b/id/server/auth/moa-id-auth.iml
index 815c21ef2..c431a320c 100644
--- a/id/server/auth/moa-id-auth.iml
+++ b/id/server/auth/moa-id-auth.iml
@@ -23,7 +23,6 @@
-
@@ -78,8 +77,8 @@
-
-
+
+
@@ -98,7 +97,7 @@
-
+
@@ -153,7 +152,7 @@
-
+
diff --git a/id/server/idserverlib/moa-id-lib.iml b/id/server/idserverlib/moa-id-lib.iml
index 47c38c069..0bcb37f55 100644
--- a/id/server/idserverlib/moa-id-lib.iml
+++ b/id/server/idserverlib/moa-id-lib.iml
@@ -13,9 +13,8 @@
-
-
-
+
+
@@ -42,7 +41,7 @@
-
+
@@ -142,7 +141,7 @@
-
+
diff --git a/id/server/idserverlib/pom.xml b/id/server/idserverlib/pom.xml
index 59275055f..f495ba9b3 100644
--- a/id/server/idserverlib/pom.xml
+++ b/id/server/idserverlib/pom.xml
@@ -56,12 +56,12 @@
eu.stork
Commons
- 1.2.0
+ 1.4.0
eu.stork
SamlEngine
- 1.1.0
+ 1.4.0
@@ -195,6 +195,7 @@
commons-fileupload
commons-fileupload
+ 1.3
commons-httpclient
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java
index 7dbbb5734..1dfccb6c0 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java
@@ -178,6 +178,7 @@ public class AttributeCollector implements IAction {
} catch (Exception e1) {
// TODO should we return the response as is to the PEPS?
Logger.error("Error putting incomplete Stork response into temporary storage", e1);
+ e1.printStackTrace();
throw new MOAIDException("stork.11", null);
}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProviderFactory.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProviderFactory.java
index c998b5f69..a8a9d9677 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProviderFactory.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProviderFactory.java
@@ -1,6 +1,7 @@
package at.gv.egovernment.moa.id.protocols.stork2;
import at.gv.egovernment.moa.id.commons.db.dao.config.AttributeProviderPlugin;
+import at.gv.egovernment.moa.logging.Logger;
import java.util.ArrayList;
import java.util.List;
@@ -20,6 +21,7 @@ public class AttributeProviderFactory {
result.add("StorkAttributeRequestProvider");
result.add("EHvdAttributeProvider");
result.add("SignedDocAttributeRequestProvider");
+ result.add("MandateAttributeRequestProvider");
return result;
}
@@ -38,6 +40,8 @@ public class AttributeProviderFactory {
return new EHvdAttributeProviderPlugin(url, attributes);
} else if (shortname.equals("SignedDocAttributeRequestProvider")) {
return new SignedDocAttributeRequestProvider(url, attributes);
+ } else if (shortname.equals("MandateAttributeRequestProvider")) {
+ return new MandateAttributeRequestProvider(url, attributes);
} else {
return null;
}
@@ -51,10 +55,14 @@ public class AttributeProviderFactory {
*/
public static List getConfiguredPlugins(
List configuredAPs) {
+ Logger.setHierarchy("moa.id.protocols.stork2");
List result = new ArrayList();
- for (AttributeProviderPlugin current : configuredAPs)
+ for (AttributeProviderPlugin current : configuredAPs) {
+
result.add(create(current.getName(), current.getUrl(), current.getAttributes()));
+ Logger.debug("Adding configured attribute provider: " + current.getClass().getName() + current.getName() + " at " + current.getUrl());
+ }
return result;
}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AuthenticationRequest.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AuthenticationRequest.java
index 3d5fbd337..442fa8a5b 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AuthenticationRequest.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AuthenticationRequest.java
@@ -10,8 +10,11 @@ import at.gv.egovernment.moa.id.moduls.IRequest;
import at.gv.egovernment.moa.id.util.client.mis.simple.MISMandate;
import at.gv.egovernment.moa.logging.Logger;
import eu.stork.peps.auth.commons.*;
+import eu.stork.peps.auth.engine.STORKSAMLEngine;
+import eu.stork.peps.exceptions.STORKSAMLEngineException;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.runtime.RuntimeConstants;
+import org.joda.time.DateTime;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
@@ -61,13 +64,25 @@ public class AuthenticationRequest implements IAction {
// check if we have authentication request
else if (moaStorkRequest.isAuthnRequest()) {
Logger.debug("Starting AuthenticationRequest");
-
moaStorkResponse.setSTORKAuthnResponse(new STORKAuthnResponse());
+
// Get personal attributtes from MOA/IdentityLink
moaStorkResponse.setPersonalAttributeList(populateAttributes());
+
+
+ STORKSAMLEngine engine = STORKSAMLEngine.getInstance("VIDP");
+ STORKAuthnResponse authnResponse = new STORKAuthnResponse();
+
+ Logger.debug("Starting generation of SAML response");
+ try {
+ moaStorkResponse.setSTORKAuthnResponse(engine.generateSTORKAuthnResponse(moaStorkRequest.getStorkAuthnRequest(), moaStorkResponse.getStorkAuthnResponse(),httpReq.getRemoteAddr(), false));
+ } catch (STORKSAMLEngineException ex) {
+ // TODO
+ }
+
}
- moaStorkResponse.setCountry(moaStorkRequest.getSpCountry());
+ //moaStorkResponse.setCountry(moaStorkRequest.getSpCountry());
// Prepare extended attributes
Logger.debug("Preparing data container");
@@ -84,6 +99,19 @@ public class AuthenticationRequest implements IAction {
container.setRemoteAddress(httpReq.getRemoteAddr());
+ STORKAuthnResponse arep = moaStorkResponse.getStorkAuthnResponse();
+
+
+ arep.setCountry("XX");
+ arep.setInResponseTo("xxxx");
+ arep.setMessage("xxxx");
+ arep.setSamlId("xxxx");
+ arep.setStatusCode("xxxx");
+
+ // arep.setNotBefore(new DateTime().withTimeAtStartOfDay());
+ // arep.setNotOnOrAfter(new DateTime().withTimeAtStartOfDay());
+
+
Logger.debug("Data container prepared");
return (new AttributeCollector()).processRequest(container, httpReq, httpResp, moasession, oaParam);
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/ConsentEvaluator.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/ConsentEvaluator.java
index 79404d4f0..19ec754ee 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/ConsentEvaluator.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/ConsentEvaluator.java
@@ -15,11 +15,13 @@ import at.gv.egovernment.moa.id.storage.AssertionStorage;
import at.gv.egovernment.moa.logging.Logger;
import eu.stork.peps.auth.commons.PEPSUtil;
import eu.stork.peps.auth.commons.PersonalAttribute;
+import eu.stork.peps.auth.commons.STORKAuthnResponse;
import eu.stork.peps.auth.engine.STORKSAMLEngine;
import eu.stork.peps.exceptions.STORKSAMLEngineException;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
+import org.joda.time.DateTime;
import org.opensaml.common.impl.SecureRandomIdentifierGenerator;
import javax.servlet.http.HttpServletRequest;
@@ -92,7 +94,8 @@ public class ConsentEvaluator implements IAction {
} catch (Exception e1) {
// TODO should we return the response as is to the PEPS?
- Logger.error("Error putting incomplete Stork response into temporary storage", e1);
+ e1.printStackTrace();
+ Logger.error("Error putting incomplete Stork response into temporary storage", e1);
throw new MOAIDException("stork.17", null);
}
@@ -143,7 +146,8 @@ public class ConsentEvaluator implements IAction {
response.setSTORKAuthnResponse(engine.generateSTORKAuthnResponse(request.getStorkAuthnRequest(), response.getStorkAuthnResponse(), container.getRemoteAddress(), false));
else
response.setSTORKAttrResponse(engine.generateSTORKAttrQueryResponse(request.getStorkAttrQueryRequest(), response.getStorkAttrQueryResponse(), container.getRemoteAddress(), "", false));
-
+
+
//generateSAML Token
Logger.info("SAML response succesfully generated!");
} catch (STORKSAMLEngineException e) {
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateAttributeRequestProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateAttributeRequestProvider.java
new file mode 100644
index 000000000..123999166
--- /dev/null
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateAttributeRequestProvider.java
@@ -0,0 +1,52 @@
+package at.gv.egovernment.moa.id.protocols.stork2;
+
+import at.gv.e_government.reference.namespace.mandates._20040701_.Mandate;
+import at.gv.egovernment.moa.id.auth.data.AuthenticationSession;
+import at.gv.egovernment.moa.id.auth.exception.MOAIDException;
+import at.gv.egovernment.moa.id.config.auth.OAAuthParameter;
+import at.gv.egovernment.moa.logging.Logger;
+import eu.stork.peps.auth.commons.IPersonalAttributeList;
+import eu.stork.peps.auth.commons.PersonalAttribute;
+import eu.stork.peps.auth.commons.PersonalAttributeList;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Provides mandate attribute from MIS
+ *
+ */
+public class MandateAttributeRequestProvider implements AttributeProvider {
+ /** The destination. */
+ private Object destination;
+
+ /** The attributes. */
+ private String attributes;
+
+ public MandateAttributeRequestProvider(String url, String supportedAttributes) {
+ Logger.setHierarchy("moa.id.protocols.stork2");
+ destination = url;
+ attributes = supportedAttributes;
+ }
+
+ public IPersonalAttributeList acquire(PersonalAttribute attribute, String spCountyCode, AuthenticationSession moasession) throws UnsupportedAttributeException, ExternalAttributeRequestRequiredException, MOAIDException {
+ Logger.info("Acquiring attribute: " + this.getClass().getName());
+ // break if we cannot handle the requested attribute
+ if(!attributes.contains(attribute.getName()))
+ throw new UnsupportedAttributeException();
+ PersonalAttributeList result = new PersonalAttributeList();
+ //return result;
+ throw new ExternalAttributeRequestRequiredException(this);
+ }
+
+ public void performRedirect(String url, HttpServletRequest req, HttpServletResponse resp, OAAuthParameter oaParam) throws MOAIDException {
+ Logger.info("Redirecting: " + this.getClass().getName());
+
+ }
+
+ public IPersonalAttributeList parse(HttpServletRequest httpReq) throws UnsupportedAttributeException, MOAIDException {
+ Logger.info("Parsing attribute: " + this.getClass().getName());
+
+ return null; //
+ }
+}
diff --git a/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd b/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd
index 936363169..3a2b8cc62 100644
--- a/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd
+++ b/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd
@@ -892,7 +892,7 @@
-
+
diff --git a/id/server/pom.xml b/id/server/pom.xml
index 056accdad..fbaeaeaf1 100644
--- a/id/server/pom.xml
+++ b/id/server/pom.xml
@@ -18,7 +18,7 @@
proxy
auth
moa-id-commons
- stork2-saml-engine
+
diff --git a/id/server/proxy/moa-id-proxy.iml b/id/server/proxy/moa-id-proxy.iml
index d0e7de0b2..ebb14c7b0 100644
--- a/id/server/proxy/moa-id-proxy.iml
+++ b/id/server/proxy/moa-id-proxy.iml
@@ -21,7 +21,6 @@
-
@@ -75,8 +74,8 @@
-
-
+
+
@@ -95,7 +94,7 @@
-
+
@@ -150,7 +149,7 @@
-
+
diff --git a/pom.xml b/pom.xml
index c4126fbfb..045c8b545 100644
--- a/pom.xml
+++ b/pom.xml
@@ -163,7 +163,7 @@
commons-fileupload
commons-fileupload
- 1.1.1
+ 1.3
commons-httpclient
--
cgit v1.2.3