diff options
Diffstat (limited to 'id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config')
3 files changed, 165 insertions, 4 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/ConfigurationBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/ConfigurationBuilder.java index b5275cdd5..5a598b03d 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/ConfigurationBuilder.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/ConfigurationBuilder.java @@ -94,6 +94,13 @@ public class ConfigurationBuilder { /** an XPATH-Expression */ protected static final String AUTH_TEMPLATE_XPATH = ROOT + CONF + "AuthComponent/" + CONF + "Templates/" + CONF + "Template/@URL"; + /** an XPATH-Expression */ + public static final String AUTH_TEMPLATE_ONLINEMANDATES_BKU_XPATH = + ROOT + CONF + "AuthComponent/" + CONF + "Templates/" + CONF + "OnlineMandates/" + CONF + "BKU"; + + + //protected static final String AUTH_MANDATE_TEMPLATE_XPATH = +// ROOT + CONF + "AuthComponent/" + CONF + "Templates/" + CONF + "MandateTemplate/@URL"; /** an XPATH-Expression */ protected static final String INPUT_PROCESSOR_TEMPLATE_XPATH = ROOT + CONF + "AuthComponent/" + CONF + "Templates/" + CONF + "InputProcessorSignTemplate/@URL"; @@ -145,6 +152,11 @@ public class ConfigurationBuilder { /** an XPATH-Expression */ protected static final String OA_AUTH_COMPONENT_TEMPLATE_XPATH = CONF + "Templates/" + CONF + "Template/@URL"; + /** an XPATH-Expression */ + public static final String OA_AUTH_COMPONENT_TEMPLATE_ONLINEMANDATES_BKU_XPATH = + CONF + "Templates/" + CONF + "OnlineMandates/" + CONF + "BKU"; + //protected static final String OA_AUTH_COMPONENT_MANDATE_TEMPLATE_XPATH = + //CONF + "Templates/" + CONF + "MandateTemplate/@URL"; /** an XPATH-Expression */ protected static final String OA_AUTH_COMPONENT_TRANSFORMS_INFO_FILENAME_XPATH = CONF + "TransformsInfo/@filename"; /** an XPATH-Expression */ @@ -465,10 +477,12 @@ public class ConfigurationBuilder { String bkuSelectionTemplateURL = XPathUtils.getAttributeValue(configElem_, AUTH_BKUSELECT_TEMPLATE_XPATH, null); String templateURL = - XPathUtils.getAttributeValue(configElem_, AUTH_TEMPLATE_XPATH, null); + XPathUtils.getAttributeValue(configElem_, AUTH_TEMPLATE_XPATH, null); String inputProcessorSignTemplateURL = XPathUtils.getAttributeValue(configElem_, INPUT_PROCESSOR_TEMPLATE_XPATH, null); + OnlineMandatesTemplates[] templatesOnlineMandates = buildTemplateOnlineMandates(configElem_); + List OA_set = new ArrayList(); NodeList OAIter = XPathUtils.selectNodeList(configElem_, OA_XPATH); @@ -536,7 +550,9 @@ public class ConfigurationBuilder { oap.setProvideIdentityLink(BoolUtils.valueOf(authComponent.getAttribute("provideIdentityLink"))); oap.setProvideCertificate(BoolUtils.valueOf(authComponent.getAttribute("provideCertificate"))); oap.setBkuSelectionTemplateURL(buildTemplateURL(authComponent, OA_AUTH_COMPONENT_BKUSELECT_TEMPLATE_XPATH, bkuSelectionTemplateURL)); - oap.setTemplateURL(buildTemplateURL(authComponent, OA_AUTH_COMPONENT_TEMPLATE_XPATH, templateURL)); + oap.setTemplateURL(buildTemplateURL(authComponent, OA_AUTH_COMPONENT_TEMPLATE_XPATH, templateURL)); + oap.setTemplateOnlineMandates(buildTemplateOnlineMandatesOA(authComponent, templatesOnlineMandates)); + oap.setInputProcessorSignTemplateURL(buildTemplateURL(authComponent, INPUT_PROCESSOR_TEMPLATE_XPATH, inputProcessorSignTemplateURL)); // load OA specific transforms if present String[] transformsInfoFileNames = buildTransformsInfoFileNames(authComponent, OA_AUTH_COMPONENT_TRANSFORMS_INFO_FILENAME_XPATH); @@ -590,6 +606,77 @@ public class ConfigurationBuilder { } return templateURL; } + + + + protected OnlineMandatesTemplates[] buildTemplateOnlineMandates(Node contextNode) { + String xpathExpr = AUTH_TEMPLATE_ONLINEMANDATES_BKU_XPATH; + List onlineMandatesTemplatesList = new ArrayList(); + + NodeIterator bkuIter = XPathUtils.selectNodeIterator(contextNode, xpathExpr); + + Element bkuElem; + while ((bkuElem = (Element) bkuIter.nextNode()) != null) { + String bkuUrl = XPathUtils.getAttributeValue(bkuElem, "@URL", null); + String moaidTemplateUrl = XPathUtils.getAttributeValue(bkuElem, CONF + "MOA-ID-Template/@URL", null); + String mandateTemplateUrl = XPathUtils.getAttributeValue(bkuElem, CONF + "MandateTemplate/@URL", null); + + OnlineMandatesTemplates template = new OnlineMandatesTemplates(); + template.setBkuURL(bkuUrl); + if (moaidTemplateUrl != null) { + moaidTemplateUrl = FileUtils.makeAbsoluteURL(moaidTemplateUrl, rootConfigFileDir_); + } + if (moaidTemplateUrl != null) { + mandateTemplateUrl = FileUtils.makeAbsoluteURL(mandateTemplateUrl, rootConfigFileDir_); + } + template.setMoaIdTemplateURL(moaidTemplateUrl); + template.setMandatesTemplateURL(mandateTemplateUrl); + + onlineMandatesTemplatesList.add(template); + + } + + if (onlineMandatesTemplatesList.isEmpty()) + return null; + + OnlineMandatesTemplates[] onlinemandatesTemplates = new OnlineMandatesTemplates[onlineMandatesTemplatesList.size()]; + onlineMandatesTemplatesList.toArray(onlinemandatesTemplates); + + return onlinemandatesTemplates; + + } + + protected OnlineMandatesTemplates[] buildTemplateOnlineMandatesOA(Node contextNode, OnlineMandatesTemplates[] defaultTemplatesOnlineMandates) { + + String xpathExpr = OA_AUTH_COMPONENT_TEMPLATE_ONLINEMANDATES_BKU_XPATH; + List onlineMandatesTemplatesList = new ArrayList(); + + NodeIterator bkuIter = XPathUtils.selectNodeIterator(contextNode, xpathExpr); + + Element bkuElem; + while ((bkuElem = (Element) bkuIter.nextNode()) != null) { + String bkuUrl = XPathUtils.getAttributeValue(bkuElem, "@URL", null); + String moaidTemplateUrl = XPathUtils.getAttributeValue(bkuElem, CONF + "MOA-ID-Template/@URL", null); + String mandateTemplateUrl = XPathUtils.getAttributeValue(bkuElem, CONF + "MandateTemplate/@URL", null); + + OnlineMandatesTemplates template = new OnlineMandatesTemplates(); + template.setBkuURL(bkuUrl); + template.setMoaIdTemplateURL(moaidTemplateUrl); + template.setMandatesTemplateURL(mandateTemplateUrl); + + onlineMandatesTemplatesList.add(template); + + } + + if (onlineMandatesTemplatesList.isEmpty()) + return defaultTemplatesOnlineMandates; + + OnlineMandatesTemplates[] onlinemandatesTemplates = new OnlineMandatesTemplates[onlineMandatesTemplatesList.size()]; + onlineMandatesTemplatesList.toArray(onlinemandatesTemplates); + + return onlinemandatesTemplates; + + } /** diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/OnlineMandatesTemplates.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/OnlineMandatesTemplates.java new file mode 100644 index 000000000..9ff2467a0 --- /dev/null +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/OnlineMandatesTemplates.java @@ -0,0 +1,54 @@ +package at.gv.egovernment.moa.id.config;
+
+public class OnlineMandatesTemplates {
+
+ private String bkuURL;
+
+ private String moaIdTemplateURL;
+
+ private String mandatesTemplateURL;
+
+ /**
+ * @return the bkuURL
+ */
+ public String getBkuURL() {
+ return bkuURL;
+ }
+
+ /**
+ * @param bkuURL the bkuURL to set
+ */
+ public void setBkuURL(String bkuURL) {
+ this.bkuURL = bkuURL;
+ }
+
+ /**
+ * @return the moaIdTemplateURL
+ */
+ public String getMoaIdTemplateURL() {
+ return moaIdTemplateURL;
+ }
+
+ /**
+ * @param moaIdTemplateURL the moaIdTemplateURL to set
+ */
+ public void setMoaIdTemplateURL(String moaIdTemplateURL) {
+ this.moaIdTemplateURL = moaIdTemplateURL;
+ }
+
+ /**
+ * @return the mandatesTemplateURL
+ */
+ public String getMandatesTemplateURL() {
+ return mandatesTemplateURL;
+ }
+
+ /**
+ * @param mandatesTemplateURL the mandatesTemplateURL to set
+ */
+ public void setMandatesTemplateURL(String mandatesTemplateURL) {
+ this.mandatesTemplateURL = mandatesTemplateURL;
+ }
+
+
+}
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 aa5aa21a3..fbaf32c1c 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 @@ -16,6 +16,7 @@ package at.gv.egovernment.moa.id.config.auth; import at.gv.egovernment.moa.id.config.OAParameter; +import at.gv.egovernment.moa.id.config.OnlineMandatesTemplates; /** * Configuration parameters belonging to an online application, @@ -79,6 +80,8 @@ public class OAAuthParameter extends OAParameter { * template for web page "Anmeldung mit Bürgerkarte" */ private String templateURL; + + private OnlineMandatesTemplates[] templateOnlineMandates; /** * template for web page "Signatur der Anmeldedaten" */ @@ -167,7 +170,8 @@ public class OAAuthParameter extends OAParameter { return provideCertificate; } - /** + +/** * Returns the key box identifier. * @return String */ @@ -193,6 +197,7 @@ public class OAAuthParameter extends OAParameter { return templateURL; } + /** * Returns the inputProcessorSignTemplateURL url. * @return The inputProcessorSignTemplateURL url or <code>null</code> if no url for @@ -239,6 +244,21 @@ public class OAAuthParameter extends OAParameter { this.transformsInfos = transformsInfos; } /** + * @return the templateOnlineMandates + */ +public OnlineMandatesTemplates[] getTemplateOnlineMandates() { + return templateOnlineMandates; +} + +/** + * @param templateOnlineMandates the templateOnlineMandates to set + */ +public void setTemplateOnlineMandates( + OnlineMandatesTemplates[] templateOnlineMandates) { + this.templateOnlineMandates = templateOnlineMandates; +} + +/** * Sets the provideAuthBlock. * @param provideAuthBlock The provideAuthBlock to set */ @@ -295,7 +315,7 @@ public class OAAuthParameter extends OAParameter { public void setTemplateURL(String templateURL) { this.templateURL = templateURL; } - + /** * Sets the input processor sign form template url. * |