aboutsummaryrefslogtreecommitdiff
path: root/id/server/moa-id-commons/src/main/java/at/gv
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2015-07-17 09:18:28 +0200
committerThomas Lenz <tlenz@iaik.tugraz.at>2015-07-17 09:18:28 +0200
commit98dbb23fa5dcd9518beb56fd2410667b385b5524 (patch)
treeb95ad14a2401f553d72d6dc911814980689866b5 /id/server/moa-id-commons/src/main/java/at/gv
parentd774a81910498c9ee1277c1611d57b07bf069fbd (diff)
downloadmoa-id-spss-98dbb23fa5dcd9518beb56fd2410667b385b5524.tar.gz
moa-id-spss-98dbb23fa5dcd9518beb56fd2410667b385b5524.tar.bz2
moa-id-spss-98dbb23fa5dcd9518beb56fd2410667b385b5524.zip
first beta version of new MOA-ID WebGUI module for configuration
Diffstat (limited to 'id/server/moa-id-commons/src/main/java/at/gv')
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/MOAIDConstants.java109
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java242
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationUtil.java34
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java90
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MigrationTest.java2
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java10
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/DatabaseConfigPropertyImpl.java3
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/KeyValueUtils.java13
8 files changed, 336 insertions, 167 deletions
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/MOAIDConstants.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/MOAIDConstants.java
new file mode 100644
index 000000000..e084c07e5
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/MOAIDConstants.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2014 Federal Chancellery Austria
+ * MOA-ID has been developed in a cooperation between BRZ, the Federal
+ * Chancellery Austria - ICT staff unit, and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+package at.gv.egovernment.moa.id.commons;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author tlenz
+ *
+ */
+public class MOAIDConstants {
+
+ //general configuration constants
+
+ public static final String FILE_URI_PREFIX = "file:/";
+
+ public static final String PREFIX_WPBK = "urn:publicid:gv.at:wbpk+";
+ public static final String PREFIX_STORK = "urn:publicid:gv.at:storkid+";
+
+ 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_STORK = "STORK";
+
+ public static final String KEYBOXIDENTIFIER_SECURE = "SecureSignatureKeypair";
+ public static final String KEYBOXIDENTIFIER_CERTIFIED = "CertifiedKeypair";
+
+ public static final String TESTCREDENTIALROOTOID = "1.2.40.0.10.2.4.1";
+
+ public static final String REDIRECTTARGET_TOP = "_top";
+ public static final String REDIRECTTARGET_SELF = "_self";
+ public static final String REDIRECTTARGET_PARENT = "_parent";
+ public static final String REDIRECTTARGET_BLANK = "_blank";
+
+ public static final Map<String, String> BUSINESSSERVICENAMES;
+ public static final List<String> ALLOWED_WBPK_PREFIXES;
+ public static final List<String> ALLOWED_KEYBOXIDENTIFIER;
+ public static final List<String> ALLOWED_REDIRECTTARGETNAMES;
+ public static final List<String> ALLOWED_STORKATTRIBUTEPROVIDERS;
+
+
+ static {
+ Hashtable<String, String> tmp = new Hashtable<String, String>();
+ tmp.put(IDENIFICATIONTYPE_FN, "Firmenbuchnummer");
+ tmp.put(IDENIFICATIONTYPE_ZVR, "Vereinsnummer");
+ tmp.put(IDENIFICATIONTYPE_ERSB, "ERsB Kennzahl");
+ tmp.put(IDENIFICATIONTYPE_STORK, "STORK");
+ BUSINESSSERVICENAMES = Collections.unmodifiableMap(tmp);
+
+ List<String> awbpk = new ArrayList<String>();
+ awbpk.add(IDENIFICATIONTYPE_FN);
+ awbpk.add(IDENIFICATIONTYPE_ERSB);
+ awbpk.add(IDENIFICATIONTYPE_ZVR);
+ awbpk.add(PREFIX_WPBK + IDENIFICATIONTYPE_FN);
+ awbpk.add(PREFIX_WPBK + IDENIFICATIONTYPE_ERSB);
+ awbpk.add(PREFIX_WPBK + IDENIFICATIONTYPE_ZVR);
+ ALLOWED_WBPK_PREFIXES = Collections.unmodifiableList(awbpk);
+
+ List<String> keyboxIDs = new ArrayList<String>();
+ awbpk.add(KEYBOXIDENTIFIER_SECURE);
+ awbpk.add(KEYBOXIDENTIFIER_CERTIFIED);
+ ALLOWED_KEYBOXIDENTIFIER = Collections.unmodifiableList(keyboxIDs);
+
+ List<String> redirectTargets = new ArrayList<String>();
+ redirectTargets.add(REDIRECTTARGET_BLANK);
+ redirectTargets.add(REDIRECTTARGET_PARENT);
+ redirectTargets.add(REDIRECTTARGET_SELF);
+ redirectTargets.add(REDIRECTTARGET_TOP);
+ ALLOWED_REDIRECTTARGETNAMES = Collections.unmodifiableList(redirectTargets);
+
+ }
+
+ static {
+ List<String> storkAttrProvider = new ArrayList<String>();
+ storkAttrProvider.add("StorkAttributeRequestProvider");
+ storkAttrProvider.add("EHvdAttributeProvider_deprecated");
+ storkAttrProvider.add("EHvdAttributeProvider");
+ storkAttrProvider.add("SignedDocAttributeRequestProvider");
+ storkAttrProvider.add("MandateAttributeRequestProvider");
+ storkAttrProvider.add("PVPAuthenticationProvider");
+ ALLOWED_STORKATTRIBUTEPROVIDERS = Collections.unmodifiableList(storkAttrProvider);
+
+ }
+
+}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java
index 694ff0720..4f47efb78 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java
@@ -30,6 +30,7 @@ import java.security.cert.CertificateException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -110,12 +111,10 @@ public class ConfigurationMigrationUtils {
* but no MOA-ID configuration prefix
*
* @param oa MOA-ID 2.x OnlineApplication configuration
+ * @param storkConfig
* @return MOA-ID 3.x OnlineApplication configuration without prefix but never Null
*/
- public static Map<String, String> convertHyberJaxBOnlineApplicationToKeyValue(OnlineApplication oa) {
- //TODO: add C-PEPS countries and STORK attributes from general config!!!!
- //TODO: add correct list identifiers for metadata handling
-
+ public static Map<String, String> convertHyberJaxBOnlineApplicationToKeyValue(OnlineApplication oa, STORK storkConfig) {
Map<String, String> result = new HashMap<String, String>();
if (oa != null) {
//convert oaID and friendlyname
@@ -296,6 +295,34 @@ public class ConfigurationMigrationUtils {
result.put(MOAIDConfigurationConstants.SERVICE_AUTH_SSO_USERREQUEST, Boolean.TRUE.toString());
}
+ //convert interfederation configuration
+ InterfederationIDPType moaIDP = oa.getInterfederationIDP();
+ if (moaIDP != null) {
+ result.put(MOAIDConfigurationConstants.PREFIX_SERVICES, MOAIDConfigurationConstants.PREFIX_IIDP);
+ result.put(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_ATTRIBUTQUERY_URL,
+ moaIDP.getAttributeQueryURL());
+ result.put(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_SSO_INBOUND,
+ String.valueOf(moaIDP.isInboundSSO()));
+ result.put(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_SSO_OUTBOUND,
+ String.valueOf(moaIDP.isOutboundSSO()));
+
+ result.put(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_SSO_STORE,
+ String.valueOf(moaIDP.isStoreSSOSession()));
+ result.put(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_LOCALAUTHONERROR,
+ String.valueOf(moaIDP.isPerformLocalAuthenticationOnError()));
+ result.put(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_PASSIVEREQUEST,
+ String.valueOf(moaIDP.isPerformPassivRequest()));
+ }
+
+ //convert STORK <-> PVP2X gateway configuration
+ InterfederationGatewayType gateway = oa.getInterfederationGateway();
+ if (gateway != null) {
+ result.put(MOAIDConfigurationConstants.PREFIX_SERVICES, MOAIDConfigurationConstants.PREFIX_GATEWAY);
+ result.put(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_FORWARD_IDPIDENTIFIER,
+ gateway.getForwardIDPIdentifier());
+
+ }
+
//convert STORK config
OASTORK config = oaauth.getOASTORK();
if(config != null) {
@@ -309,46 +336,6 @@ public class ConfigurationMigrationUtils {
else
result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_MINQAALEVEL, "4");
- if (config.getCPEPS() != null) {
- for (int i=0; i<config.getCPEPS().size(); i++) {
- result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST
- + "." + String.valueOf(i) + "."
- + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST_ENABLED,
- Boolean.TRUE.toString());
-
- result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST
- + "." + String.valueOf(i) + "."
- + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST_COUNTRYCODE,
- config.getCPEPS().get(i).getCountryCode());
-
- }
- }
-
- if (config.getOAAttributes() != null) {
- for (int i=0; i<config.getOAAttributes().size(); i++) {
- result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST
- + "." + String.valueOf(i) + "."
- + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST_NAME,
- config.getOAAttributes().get(i).getName());
-
- result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST
- + "." + String.valueOf(i) + "."
- + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST_REQUESTED,
- Boolean.TRUE.toString());
-
-
- if (config.getOAAttributes().get(i).isMandatory() != null)
- result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST
- + "." + String.valueOf(i) + "."
- + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST_MANDATORY,
- config.getOAAttributes().get(i).isMandatory().toString());
- else
- result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST
- + "." + String.valueOf(i) + "."
- + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST_MANDATORY,
- Boolean.FALSE.toString());
- }
- }
// fetch vidp config
if (config.isRequireConsent() != null)
@@ -380,6 +367,120 @@ public class ConfigurationMigrationUtils {
}
}
+
+ //only fetch C-PEPS and attributes if service is an OA
+ if (!result.containsKey(MOAIDConfigurationConstants.PREFIX_SERVICES)) {
+ //fetch C-PEPS config
+ List<String> configuredCPEPs = new ArrayList<String>();
+ if (storkConfig != null && storkConfig.getCPEPS() != null) {
+ for (CPEPS el : storkConfig.getCPEPS()) {
+ if (MiscUtil.isNotEmpty(el.getCountryCode()))
+ configuredCPEPs.add(el.getCountryCode());
+
+ }
+ }
+ int listCounter = 0;
+ if (config.getCPEPS() != null) {
+ Iterator<CPEPS> oaCPEPSInterator = config.getCPEPS().iterator();
+ while(oaCPEPSInterator.hasNext()) {
+ CPEPS oaCpeps = oaCPEPSInterator.next();
+ String oaCountryCode = oaCpeps.getCountryCode();
+ if (MiscUtil.isNotEmpty(oaCountryCode)) {
+ if (configuredCPEPs.contains(oaCountryCode))
+ configuredCPEPs.remove(oaCountryCode);
+
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST
+ + "." + String.valueOf(listCounter) + "."
+ + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST_ENABLED,
+ Boolean.TRUE.toString());
+
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST
+ + "." + String.valueOf(listCounter) + "."
+ + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST_COUNTRYCODE,
+ oaCountryCode);
+
+ listCounter++;
+ }
+ }
+ }
+ Iterator<String> confCPEPS = configuredCPEPs.iterator();
+ while (confCPEPS.hasNext()) {
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST
+ + "." + String.valueOf(listCounter) + "."
+ + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST_ENABLED,
+ Boolean.TRUE.toString());
+
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST
+ + "." + String.valueOf(listCounter) + "."
+ + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST_COUNTRYCODE,
+ confCPEPS.next());
+ listCounter++;
+
+ }
+
+ //fetch STORK attributes
+ List<String> configuredAttributs = new ArrayList<String>();
+ if (storkConfig != null && storkConfig.getAttributes() != null) {
+ for (StorkAttribute el : storkConfig.getAttributes()) {
+ if (MiscUtil.isNotEmpty(el.getName()))
+ configuredAttributs.add(el.getName());
+
+ }
+ }
+ listCounter = 0;
+ if (config.getOAAttributes() != null) {
+ Iterator<OAStorkAttribute> oaAttributeInterator = config.getOAAttributes().iterator();
+ while (oaAttributeInterator.hasNext()) {
+ OAStorkAttribute oaAttr = oaAttributeInterator.next();
+ if (MiscUtil.isNotEmpty(oaAttr.getName())) {
+ if (configuredAttributs.contains(oaAttr.getName()))
+ configuredAttributs.remove(oaAttr.getName());
+
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST
+ + "." + String.valueOf(listCounter) + "."
+ + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST_NAME,
+ oaAttr.getName());
+
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST
+ + "." + String.valueOf(listCounter) + "."
+ + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST_REQUESTED,
+ Boolean.TRUE.toString());
+
+
+ if (oaAttr.isMandatory() != null)
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST
+ + "." + String.valueOf(listCounter) + "."
+ + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST_MANDATORY,
+ oaAttr.isMandatory().toString());
+ else
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST
+ + "." + String.valueOf(listCounter) + "."
+ + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST_MANDATORY,
+ Boolean.FALSE.toString());
+ listCounter++;
+ }
+ }
+ }
+ Iterator<String> configuredAttributsInterator = configuredAttributs.iterator();
+ while (configuredAttributsInterator.hasNext()) {
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST
+ + "." + String.valueOf(listCounter) + "."
+ + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST_NAME,
+ configuredAttributsInterator.next());
+
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST
+ + "." + String.valueOf(listCounter) + "."
+ + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST_REQUESTED,
+ Boolean.TRUE.toString());
+
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST
+ + "." + String.valueOf(listCounter) + "."
+ + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST_MANDATORY,
+ Boolean.FALSE.toString());
+ listCounter++;
+
+ }
+ }
}
//convert protocols SAML1
@@ -479,9 +580,9 @@ public class ConfigurationMigrationUtils {
TransformsInfoType bkuSelectTemplate = templates.getBKUSelectionTemplate();
if (bkuSelectTemplate != null && MiscUtil.isNotEmpty(bkuSelectTemplate.getFilename())) {
try {
- result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION,
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_DATA,
Base64Utils.encode(bkuSelectTemplate.getTransformation()));
- result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_FILENAME,
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_PREVIEW,
bkuSelectTemplate.getFilename());
} catch (Exception e) {
@@ -495,9 +596,9 @@ public class ConfigurationMigrationUtils {
TransformsInfoType sendAssertionTemplate = templates.getSendAssertionTemplate();
if (sendAssertionTemplate != null && MiscUtil.isNotEmpty(sendAssertionTemplate.getFilename())) {
try {
- result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION,
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_DATA,
Base64Utils.encode(sendAssertionTemplate.getTransformation()));
- result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_FILENAME,
+ result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_PREVIEW,
sendAssertionTemplate.getFilename());
} catch (Exception e) {
@@ -577,38 +678,11 @@ public class ConfigurationMigrationUtils {
}
}
}
-
- //convert interfederation configuration
- InterfederationIDPType moaIDP = oa.getInterfederationIDP();
- if (moaIDP != null) {
- result.put(MOAIDConfigurationConstants.PREFIX_SERVICES, MOAIDConfigurationConstants.PREFIX_IIDP);
- result.put(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_ATTRIBUTQUERY_URL,
- moaIDP.getAttributeQueryURL());
- result.put(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_SSO_INBOUND,
- String.valueOf(moaIDP.isInboundSSO()));
- result.put(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_SSO_OUTBOUND,
- String.valueOf(moaIDP.isOutboundSSO()));
-
- result.put(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_SSO_STORE,
- String.valueOf(moaIDP.isStoreSSOSession()));
- result.put(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_LOCALAUTHONERROR,
- String.valueOf(moaIDP.isPerformLocalAuthenticationOnError()));
- result.put(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_PASSIVEREQUEST,
- String.valueOf(moaIDP.isPerformPassivRequest()));
- }
-
- //convert STORK <-> PVP2X gateway configuration
- InterfederationGatewayType gateway = oa.getInterfederationGateway();
- if (gateway != null) {
- result.put(MOAIDConfigurationConstants.PREFIX_SERVICES, MOAIDConfigurationConstants.PREFIX_GATEWAY);
- result.put(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_FORWARD_IDPIDENTIFIER,
- gateway.getForwardIDPIdentifier());
-
- }
-
+
//set onlineapplication identifier if nothing is set
- if (!result.containsKey(MOAIDConfigurationConstants.PREFIX_SERVICES))
+ if (!result.containsKey(MOAIDConfigurationConstants.PREFIX_SERVICES)) {
result.put(MOAIDConfigurationConstants.PREFIX_SERVICES, MOAIDConfigurationConstants.PREFIX_OA);
+ }
}
return result;
@@ -922,11 +996,11 @@ public class ConfigurationMigrationUtils {
templates.setAditionalAuthBlockText(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_AUTHBLOCKTEXT));
//store BKU-selection and send-assertion templates
- if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION))) {
+ if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_DATA))) {
TransformsInfoType el1 = new TransformsInfoType();
try {
- el1.setTransformation(Base64Utils.decode(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION), false));
- el1.setFilename(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_FILENAME));
+ el1.setTransformation(Base64Utils.decode(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_DATA), false));
+ el1.setFilename(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_PREVIEW));
templates.setBKUSelectionTemplate(el1);
} catch (IOException e) {
@@ -934,11 +1008,11 @@ public class ConfigurationMigrationUtils {
}
}
- if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION))) {
+ if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_DATA))) {
TransformsInfoType el1 = new TransformsInfoType();
try {
- el1.setTransformation(Base64Utils.decode(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION), false));
- el1.setFilename(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_FILENAME));
+ el1.setTransformation(Base64Utils.decode(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_DATA), false));
+ el1.setFilename(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_PREVIEW));
templates.setSendAssertionTemplate(el1);
} catch (IOException e) {
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationUtil.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationUtil.java
index bac2d0011..399533d3f 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationUtil.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationUtil.java
@@ -23,6 +23,7 @@ import at.gv.egiz.components.configuration.api.Configuration;
import at.gv.egiz.components.configuration.api.ConfigurationException;
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.STORK;
import at.gv.egovernment.moa.logging.Logger;
import at.gv.egovernment.moa.util.MiscUtil;
@@ -86,11 +87,24 @@ public class ConfigurationUtil {
Properties result = new Properties();
+ if (config == null) {
+ return null;
+
+ }
+ STORK storkConfig = null;
+ try {
+ storkConfig = config.getAuthComponentGeneral().getForeignIdentities().getSTORK();
+
+ } catch (Exception e) {
+ Logger.debug("No general STORK configuration found.");
+
+ }
+
//convert all online applications
List<OnlineApplication> oaList = config.getOnlineApplication();
for (int i=0; i<oaList.size(); i++) {
OnlineApplication oa = oaList.get(i);
- Map<String, String> keyValueOA = ConfigurationMigrationUtils.convertHyberJaxBOnlineApplicationToKeyValue(oa);
+ Map<String, String> keyValueOA = ConfigurationMigrationUtils.convertHyberJaxBOnlineApplicationToKeyValue(oa, storkConfig);
String serviceIdentifier = keyValueOA.get(MOAIDConfigurationConstants.PREFIX_SERVICES);
if (MiscUtil.isEmpty(serviceIdentifier)) {
@@ -106,7 +120,13 @@ public class ConfigurationUtil {
+ key,
keyValueOA.get(key));
- }
+ }
+ //set correct metadata list identifier
+ result.put(MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES
+ + "." + serviceIdentifier + "." + String.valueOf(i) + "."
+ + MOAIDConfigurationConstants.METADATA_LIST +".0",
+ MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES
+ + "." + serviceIdentifier);
}
Map<String, String> keyValueGeneral = ConfigurationMigrationUtils.convertHyberJaxBMOAIDConfigToKeyValue(config);
@@ -189,8 +209,12 @@ public class ConfigurationUtil {
Properties inProperties = new Properties();
inProperties.load(inStream);
- System.getProperties().setProperty("location", "file:" + outputDBConfigFilePath);
- ApplicationContext context = new ClassPathXmlApplicationContext("configuration.beans.xml");
+ System.getProperties().setProperty("moa.id.webconfig", "file:" + outputDBConfigFilePath);
+ ApplicationContext context = new ClassPathXmlApplicationContext(
+ new String[]{
+ "configuration.beans.xml",
+ "moaid.migration.beans.xml"
+ });
Configuration dbConfiguration = (Configuration) context.getBean("moaidconfig");
List<String> keys = null;
@@ -217,7 +241,7 @@ public class ConfigurationUtil {
// remove existing entries
for (String key : keys) {
try {
- dbConfiguration.setStringValue(key, null);
+ dbConfiguration.deleteIds(key);
} catch (ConfigurationException e) {
System.out.println("Could NOT persist the configuration file's information in the database.");
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java
index 34e3f3c7e..fab5b437f 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java
@@ -1,54 +1,20 @@
package at.gv.egovernment.moa.id.commons.config;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
+import at.gv.egovernment.moa.id.commons.MOAIDConstants;
/**
*
*
*/
-public final class MOAIDConfigurationConstants {
+public final class MOAIDConfigurationConstants extends MOAIDConstants {
private MOAIDConfigurationConstants() {
// restrict instantiation
}
-
- //general configuration constants
-
- public static final String PREFIX_WPBK = "urn:publicid:gv.at:wbpk+";
- public static final String PREFIX_STORK = "urn:publicid:gv.at:storkid+";
+ public static final String METADATA_LIST = "__LI";
- 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_STORK = "STORK";
+ public static final String WEBGUI_EMPTY_ELEMENT = "null";
- public static final Map<String, String> BUSINESSSERVICENAMES;
-
- public static final List<String> ALLOWED_WBPK_PREFIXES;
-
- static {
- Hashtable<String, String> tmp = new Hashtable<String, String>();
- tmp.put(IDENIFICATIONTYPE_FN, "Firmenbuchnummer");
- tmp.put(IDENIFICATIONTYPE_ZVR, "Vereinsnummer");
- tmp.put(IDENIFICATIONTYPE_ERSB, "ERsB Kennzahl");
- tmp.put(IDENIFICATIONTYPE_STORK, "STORK");
- BUSINESSSERVICENAMES = Collections.unmodifiableMap(tmp);
-
- List<String> awbpk = new ArrayList<String>();
- awbpk.add(IDENIFICATIONTYPE_FN);
- awbpk.add(IDENIFICATIONTYPE_ERSB);
- awbpk.add(IDENIFICATIONTYPE_ZVR);
- awbpk.add(PREFIX_WPBK + IDENIFICATIONTYPE_FN);
- awbpk.add(PREFIX_WPBK + IDENIFICATIONTYPE_ERSB);
- awbpk.add(PREFIX_WPBK + IDENIFICATIONTYPE_ZVR);
- ALLOWED_WBPK_PREFIXES = Collections.unmodifiableList(awbpk);
- }
-
-
//Basic key namespaces
public static final String PREFIX_MOAID = "moa.id";
public static final String PREFIX_GENERAL = "general";
@@ -97,7 +63,7 @@ public final class MOAIDConfigurationConstants {
public static final String SERVICE_AUTH_TARGET_PUBLIC_TARGET = SERVICE_AUTH_TARGET_PUBLIC + ".target";
public static final String SERVICE_AUTH_TARGET_PUBLIC_TARGET_SUB = SERVICE_AUTH_TARGET_PUBLIC + ".target.sub";
public static final String SERVICE_AUTH_TARGET_PUBLIC_USE_SUB = SERVICE_AUTH_TARGET_PUBLIC + ".use.sub";
- public static final String SERVICE_AUTH_TARGET_PUBLIC_USE_OWN = SERVICE_AUTH_TARGET_PUBLIC + ".use.own";
+ public static final String SERVICE_AUTH_TARGET_PUBLIC_USE_OWN = SERVICE_AUTH_TARGET_PUBLIC + ".own.use";
public static final String SERVICE_AUTH_TARGET_PUBLIC_OWN_TARGET = SERVICE_AUTH_TARGET_PUBLIC + ".own.target";
public static final String SERVICE_AUTH_TARGET_PUBLIC_OWN_NAME = SERVICE_AUTH_TARGET_PUBLIC + ".own.name";
@@ -111,13 +77,15 @@ public final class MOAIDConfigurationConstants {
public static final String SERVICE_AUTH_BKU_TEMPLATE_FIRST_VALUE = SERVICE_AUTH_BKU_TEMPLATE + ".first.url";
public static final String SERVICE_AUTH_BKU_TEMPLATE_SECOND_VALUE = SERVICE_AUTH_BKU_TEMPLATE + ".second.url";
public static final String SERVICE_AUTH_BKU_TEMPLATE_THIRD_VALUE = SERVICE_AUTH_BKU_TEMPLATE + ".third.url";
- public static final String SERVICE_AUTH_BKU_AUTHBLOCKTEXT = SERVICE_AUTH_BKU + "authblock.additionaltext";
- public static final String SERVICE_AUTH_BKU_AUTHBLOCK_REMOVEBPK = SERVICE_AUTH_BKU + "authblock.removebPK";
+ public static final String SERVICE_AUTH_BKU_AUTHBLOCKTEXT = AUTH + ".authblock.additionaltext";
+ public static final String SERVICE_AUTH_BKU_AUTHBLOCK_REMOVEBPK = AUTH + ".authblock.removebPK";
private static final String SERVICE_AUTH_TEMPLATES = AUTH + "." + TEMPLATES;
- public static final String SERVICE_AUTH_TEMPLATES_BKUSELECTION = SERVICE_AUTH_TEMPLATES + ".bkuselection";
+ public static final String SERVICE_AUTH_TEMPLATES_BKUSELECTION_DATA = SERVICE_AUTH_TEMPLATES + ".bkuselection.data";
+ public static final String SERVICE_AUTH_TEMPLATES_BKUSELECTION_PREVIEW = SERVICE_AUTH_TEMPLATES + ".bkuselection.preview";
public static final String SERVICE_AUTH_TEMPLATES_BKUSELECTION_FILENAME = SERVICE_AUTH_TEMPLATES + ".bkuselection.filename";
- public static final String SERVICE_AUTH_TEMPLATES_SENDASSERTION = SERVICE_AUTH_TEMPLATES + ".sendAssertion";
+ public static final String SERVICE_AUTH_TEMPLATES_SENDASSERTION_DATA = SERVICE_AUTH_TEMPLATES + ".sendAssertion.data";
+ public static final String SERVICE_AUTH_TEMPLATES_SENDASSERTION_PREVIEW = SERVICE_AUTH_TEMPLATES + ".sendAssertion.preview";
public static final String SERVICE_AUTH_TEMPLATES_SENDASSERTION_FILENAME = SERVICE_AUTH_TEMPLATES + ".sendAssertion.filename";
private static final String SERVICE_AUTH_TEMPLATES_CUSTOMIZATION = SERVICE_AUTH_TEMPLATES + ".customize";
public static final String SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_FONTTYPE = SERVICE_AUTH_TEMPLATES_CUSTOMIZATION + ".fonttype";
@@ -184,8 +152,8 @@ public final class MOAIDConfigurationConstants {
private static final String SERVICE_PROTOCOLS_PVP2X = PROTOCOLS + "." + PVP2X;
public static final String SERVICE_PROTOCOLS_PVP2X_RELOAD = SERVICE_PROTOCOLS_PVP2X + ".reload";
public static final String SERVICE_PROTOCOLS_PVP2X_URL = SERVICE_PROTOCOLS_PVP2X + ".URL";
- public static final String SERVICE_PROTOCOLS_PVP2X_CERTIFICATE = SERVICE_PROTOCOLS_PVP2X + ".certificate";
- public static final String SERVICE_PROTOCOLS_PVP2X_CERTIFICATE_SUBJECT = SERVICE_PROTOCOLS_PVP2X + ".certificate.subject";
+ public static final String SERVICE_PROTOCOLS_PVP2X_CERTIFICATE = SERVICE_PROTOCOLS_PVP2X + ".certificate.data";
+ public static final String SERVICE_PROTOCOLS_PVP2X_CERTIFICATE_SUBJECT = SERVICE_PROTOCOLS_PVP2X + ".certificate.preview";
private static final String SERVICE_PROTOCOLS_OPENID = PROTOCOLS + "." + OPENID;
public static final String SERVICE_PROTOCOLS_OPENID_CLIENTID = SERVICE_PROTOCOLS_OPENID + ".clientID";
@@ -270,6 +238,7 @@ public final class MOAIDConfigurationConstants {
public static final String GENERAL_PROTOCOLS_PVP2X_METADATA_CONTACT_TYPE = GENERAL_PROTOCOLS_PVP2X_METADATA_CONTACT + ".type";
public static final String GENERAL_AUTH_AUTHBLOCK_TRANSFORMATION_NAME = GENERAL_AUTH + ".authblock.transformation.preview";
+ public static final String GENERAL_AUTH_AUTHBLOCK_TRANSFORMATION_FILENAME = GENERAL_AUTH + ".authblock.transformation.filename";
public static final String GENERAL_AUTH_AUTHBLOCK_TRANSFORMATION_BASE64 = GENERAL_AUTH + ".authblock.transformation.data";
public static final String GENERAL_AUTH_STORK = GENERAL_AUTH + "." + STORK;
@@ -282,35 +251,4 @@ public final class MOAIDConfigurationConstants {
public static final String GENERAL_AUTH_STORK_ATTRIBUTES_LIST = GENERAL_AUTH_STORK + ".attributes";
public static final String GENERAL_AUTH_STORK_ATTRIBUTES_LIST_NAME = "friendlyname";
public static final String GENERAL_AUTH_STORK_ATTRIBUTES_LIST_MANDATORY = "mandatory";
-
-// // old!!!!!!!!!!! //
-// // keys for the object in the key-value database
-// public static final String ONLINE_APPLICATIONS_KEY = "OnlineApplications";
-// public static final String AUTH_COMPONENT_GENERAL_KEY = "AuthComponentGeneral";
-// public static final String CHAINING_MODES_KEY = "ChainingModes";
-// public static final String TRUSTED_CERTIFICATES_KEY = "TruestedCertificates";
-// public static final String DEFAULT_BKUS_KEY = "DefaultBKUs";
-// public static final String SLREQUEST_TEMPLATES_KEY = "SLRequestTemplates";
-// public static final String TIMESTAMP_ITEM_KEY = "TimestampItem";
-// public static final String PVP2REFRESH_ITEM_KEY = "Pvp2RefreshItem";
-// public static final String GENERIC_CONFIGURATION_KEY = "GenericConfiguration";
-//
-// /**
-// * Returns all relevant (database-) keys that {@link MOAIDConfiguration} contains.
-// * @return the keys as {@code String[]}
-// */
-// public static final String[] getMOAIDConfigurationKeys() {
-// return new String[] { AUTH_COMPONENT_GENERAL_KEY, CHAINING_MODES_KEY, TRUSTED_CERTIFICATES_KEY,
-// DEFAULT_BKUS_KEY, SLREQUEST_TEMPLATES_KEY, TIMESTAMP_ITEM_KEY, PVP2REFRESH_ITEM_KEY };
-// }
-//
-// /**
-// * Returns all (database-) keys that {@link MOAIDConfiguration} contains.
-// * @return the keys as {@code String[]}
-// */
-// public static final String[] getAllMOAIDConfigurationKeys() {
-// return new String[] { ONLINE_APPLICATIONS_KEY, AUTH_COMPONENT_GENERAL_KEY, CHAINING_MODES_KEY,
-// TRUSTED_CERTIFICATES_KEY, DEFAULT_BKUS_KEY, SLREQUEST_TEMPLATES_KEY, TIMESTAMP_ITEM_KEY,
-// PVP2REFRESH_ITEM_KEY };
-// }
}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MigrationTest.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MigrationTest.java
index 7dbbac5b4..c472299b9 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MigrationTest.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MigrationTest.java
@@ -40,7 +40,7 @@ public class MigrationTest {
String inputFile = "D:/Projekte/svn/moa-id/MOAID-2.0_config_labda_12.05.2015.xml";
String outputFile = "D:/Projekte/svn/moa-id/MOAID-3.0_config.propery";
- String moaidconfig = "D:/Projekte/svn/moa-id/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/conf/moa-id/moa-id.properties";
+ String moaidconfig = "D:/Projekte/svn/moa-id/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/conf/moa-id-configuration/moa-id.properties";
try {
FileInputStream input = new FileInputStream(inputFile);
File out = new File(outputFile);
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java
index 832c82e78..805bcb33e 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java
@@ -38,6 +38,16 @@ public class MOAIDConfigurationImpl extends DatabaseConfigPropertyImpl implement
// this.configPropertyDao = configPropertyDao;
// }
+ public void setStringValue(String id, String value) throws ConfigurationException {
+ super.setStringValue(id, value);
+
+ }
+
+ public void deleteIds(String idSearch) throws ConfigurationException {
+ super.deleteIds(idSearch);
+
+ }
+
/* (non-Javadoc)
* @see at.gv.egovernment.moa.id.commons.config.persistence.MOAIDConfiguration#getPropertySubset(java.lang.String)
*/
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/DatabaseConfigPropertyImpl.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/DatabaseConfigPropertyImpl.java
index 00c191228..f47b0c9e2 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/DatabaseConfigPropertyImpl.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/DatabaseConfigPropertyImpl.java
@@ -82,7 +82,7 @@ public class DatabaseConfigPropertyImpl extends AbstractConfigurationImpl {
* @see at.gv.egiz.components.configuration.api.AbstractConfigurationImpl#storeKey(java.lang.String, java.lang.String)
*/
@Override
- @Transactional(value="transactionManager")
+ @Transactional("transactionManager")
protected void storeKey(String key, String value) throws ConfigurationException {
if (null == em) {
log.error("No EntityManager set!");
@@ -176,6 +176,7 @@ public class DatabaseConfigPropertyImpl extends AbstractConfigurationImpl {
* @see at.gv.egiz.components.configuration.api.AbstractConfigurationImpl#deleteIds(java.lang.String)
*/
@Override
+ @Transactional("transactionManager")
public void deleteIds(String idSearch) throws ConfigurationException {
String[] keyList = findConfigurationId(idSearch);
for (String el : keyList) {
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/KeyValueUtils.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/KeyValueUtils.java
index 0e4616825..f20647fb0 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/KeyValueUtils.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/utils/KeyValueUtils.java
@@ -29,6 +29,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.Set;
import at.gv.egovernment.moa.util.MiscUtil;
@@ -213,5 +214,17 @@ public class KeyValueUtils {
return counters.get(counters.size()-1) + 1;
}
}
+
+ /**
+ * Find the highest free list counter
+ *
+ * @param keySet {Set<String>} of list keys
+ * @param listPrefix {String} prefix of the list
+ * @return {int} highest free list counter
+ */
+ public static int findNextFreeListCounter(Set<String> keySet,
+ String listPrefix) {
+ return findNextFreeListCounter((String[]) keySet.toArray(), listPrefix);
+ }
}