aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/DetachedLocRefMOAConnector.java
diff options
context:
space:
mode:
authorknowcenter <knowcenter@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2007-07-24 16:34:32 +0000
committerknowcenter <knowcenter@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2007-07-24 16:34:32 +0000
commit9bdb3a0ea0ee00a0dc7bfa7fb6658859f9024d13 (patch)
tree77a3cb0d96ebba287949c408db7f37d31f6c08ef /src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/DetachedLocRefMOAConnector.java
parenta439dcdd796a5b532480531c7701309beef9e94c (diff)
downloadpdf-as-3-9bdb3a0ea0ee00a0dc7bfa7fb6658859f9024d13.tar.gz
pdf-as-3-9bdb3a0ea0ee00a0dc7bfa7fb6658859f9024d13.tar.bz2
pdf-as-3-9bdb3a0ea0ee00a0dc7bfa7fb6658859f9024d13.zip
Stable version.
Known problems: Verification with MOA 1.0.0 signatures git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@151 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/DetachedLocRefMOAConnector.java')
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/DetachedLocRefMOAConnector.java63
1 files changed, 56 insertions, 7 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/DetachedLocRefMOAConnector.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/DetachedLocRefMOAConnector.java
index 98d381a..b6e65b3 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/DetachedLocRefMOAConnector.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/DetachedLocRefMOAConnector.java
@@ -37,7 +37,7 @@ public class DetachedLocRefMOAConnector implements Connector
/**
* The SIG_ID prefix.
*/
- public static final String SIG_ID_PREFIX = "etsi-bku-detached@"; //$NON-NLS-1$
+ // public static final String SIG_ID_PREFIX = "etsi-bku-detached@"; //$NON-NLS-1$
/**
* The log.
@@ -322,6 +322,26 @@ public class DetachedLocRefMOAConnector implements Connector
* The configuration key of the sign URL.
*/
protected static final String SIGN_URL_KEY = "moa.sign.url"; //$NON-NLS-1$
+
+ /**
+ * MOA template file prefix
+ */
+ protected static final String TEMPLATE_FILE_PREFIX = "./templates/moa.";
+
+ /**
+ * signing file template sufix
+ */
+ protected static final String SIGN_TEMPLATE_FILE_SUFIX = ".sign.xml";
+
+ /**
+ * verifing template file sufix
+ */
+ protected static final String VERIFY_REQUEST_TEMPLATE_FILE_SUFIX = ".verify.request.xml";
+
+ /**
+ * verifing file template key sufix
+ */
+ protected static final String VERIFY_TEMPLATE_SUFIX = ".verify.template.xml";
/**
* The configuration key of the verify request template.
@@ -402,9 +422,21 @@ public class DetachedLocRefMOAConnector implements Connector
}
this.sign_key_identifier = getConnectorValueFromProfile(settings, profile, SIGN_KEY_IDENTIFIER_KEY);
-
- String sign_request_filename = getConnectorValueFromProfile(settings, profile, SIGN_REQUEST_TEMPLATE_KEY);
+
+ String sign_request_filename = TEMPLATE_FILE_PREFIX + settings.getValueFromKey("default.moa.algorithm.id") + SIGN_TEMPLATE_FILE_SUFIX;
+
+ // try to load template from file
this.sign_request_template = FileHelper.readFromFile(SettingsReader.relocateFile(sign_request_filename));
+
+ if(this.sign_request_template == null)
+ {
+ sign_request_filename = getConnectorValueFromProfile(settings, profile, SIGN_REQUEST_TEMPLATE_KEY);
+ this.sign_request_template = FileHelper.readFromFile(SettingsReader.relocateFile(sign_request_filename));
+ }
+
+ log.debug("\r\n\r\n" + sign_request_filename + "\r\n\r\n");
+
+ //this.sign_request_template = FileHelper.readFromFile(SettingsReader.relocateFile(sign_request_filename));
if (this.sign_request_template == null)
{
// TODO make this a settings exception
@@ -412,17 +444,34 @@ public class DetachedLocRefMOAConnector implements Connector
}
this.sign_url = getConnectorValueFromProfile(settings, profile, SIGN_URL_KEY);
-
- String verify_request_filename = getConnectorValueFromProfile(settings, profile, VERIFY_REQUEST_TEMPLATE_KEY);
+
+ String verify_request_filename = TEMPLATE_FILE_PREFIX + settings.getValueFromKey("default.moa.algorithm.id") + VERIFY_REQUEST_TEMPLATE_FILE_SUFIX;
+
+ // try to load template file for verifing
this.verify_request_template = FileHelper.readFromFile(SettingsReader.relocateFile(verify_request_filename));
+
+ if(this.verify_request_template == null)
+ {
+ verify_request_filename = getConnectorValueFromProfile(settings, profile, VERIFY_REQUEST_TEMPLATE_KEY);
+ this.verify_request_template = FileHelper.readFromFile(SettingsReader.relocateFile(verify_request_filename));
+ }
+
if (this.verify_request_template == null)
{
// TODO make this a settings exception
throw new ConnectorException(300, "Can not read the verify xml request template"); //$NON-NLS-1$
}
-
- String verify_filename = getConnectorValueFromProfile(settings, profile, VERIFY_TEMPLATE_KEY);
+
+ // load template key file
+ String verify_filename = TEMPLATE_FILE_PREFIX + settings.getValueFromKey("default.moa.algorithm.id") + VERIFY_TEMPLATE_SUFIX;
this.verify_template = FileHelper.readFromFile(SettingsReader.relocateFile(verify_filename));
+
+ if(this.verify_template == null)
+ {
+ verify_filename = getConnectorValueFromProfile(settings, profile, VERIFY_TEMPLATE_KEY);
+ this.verify_template = FileHelper.readFromFile(SettingsReader.relocateFile(verify_filename));
+ }
+
if (this.verify_template == null)
{
// TODO make this a settings exception