aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authortknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2008-03-04 13:18:44 +0000
committertknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2008-03-04 13:18:44 +0000
commit364cb2a6dc344804504636df7b890793a44077d6 (patch)
treefe91ca9b924f75edc7ff614543699774824a9df3 /src/main/java
parentd85b325b85ccec65e86c02bf3373a334e3e68472 (diff)
downloadpdf-as-3-364cb2a6dc344804504636df7b890793a44077d6.tar.gz
pdf-as-3-364cb2a6dc344804504636df7b890793a44077d6.tar.bz2
pdf-as-3-364cb2a6dc344804504636df7b890793a44077d6.zip
SignatureProfile extended in order to retrieve further profile information via API call.
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@251 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/gv/egiz/pdfas/api/commons/SignatureProfile.java32
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java23
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/api/commons/SignatureProfileImpl.java46
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureObject.java4
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/EnvelopedBase64BKUConnector.java6
5 files changed, 107 insertions, 4 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/api/commons/SignatureProfile.java b/src/main/java/at/gv/egiz/pdfas/api/commons/SignatureProfile.java
index 52bd27f..d5545e6 100644
--- a/src/main/java/at/gv/egiz/pdfas/api/commons/SignatureProfile.java
+++ b/src/main/java/at/gv/egiz/pdfas/api/commons/SignatureProfile.java
@@ -3,6 +3,8 @@
*/
package at.gv.egiz.pdfas.api.commons;
+import java.util.Set;
+
/**
* Definition of a signature profile.
*
@@ -26,4 +28,34 @@ public interface SignatureProfile
*/
public String getMOAKeyIdentifier();
+ // start - modified by tknall
+
+ /**
+ * Returns the value of a field with a given key for the current profile.
+ * <p>
+ * e.g.<br/><code>signaturProfile.getField(SignatureTypes.SIG_ISSUER)</code><br/>
+ * returns <code>"Issuer-Certificate"</code>
+ * </p>
+ * <code>null</code> is returned if a field with key <code>key</code>
+ * could not be found.
+ *
+ * @param key
+ * The key for the field to be returned or <code>null</code> if
+ * there is not such field.
+ * @return The value of the field with key <code>key</key>.
+ * @see at.knowcenter.wag.egov.egiz.sig.SignatureTypes
+ */
+ public String getField(String key);
+
+ // added by tknall
+
+ /**
+ * Returns a set containing all field keys (properties starting with
+ * <code>sig_obj.CURRENT_PROFILE.key.</code> of the current profiles. The
+ * set should be unmodifiable.
+ */
+ public Set getFieldKeys();
+
+ // stop - modified by tknall
+
}
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java b/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java
index 704f9fd..39b4aff 100644
--- a/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java
+++ b/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java
@@ -122,7 +122,28 @@ public class PdfAsObject implements PdfAs
final String profileId = profile.getType();
final String moaKeyIdentifier = settings.getSetting("sig_obj." + profileId + "." + MOA_SIGN_KEY_IDENTIFIER_KEY, defaultMoaKeyIdentifiert);
- SignatureProfile signatureProfile = new SignatureProfileImpl(profileId, moaKeyIdentifier);
+ // modified by tknall
+ SignatureProfileImpl signatureProfile = new SignatureProfileImpl(profileId, moaKeyIdentifier);
+
+ // start - added by tknall
+
+ // add key values
+ final String parentProperty = "sig_obj." + profileId + ".key.";
+ ArrayList keys = settings.getKeys(parentProperty);
+ if (keys != null) {
+ Iterator keyIt = keys.iterator();
+ while (keyIt.hasNext()) {
+ String key = (String) keyIt.next();
+ if (key != null && key.length() > 0) {
+ String value = settings.getValueFromKey(parentProperty + key);
+ if (value != null && value.length() > 0) {
+ signatureProfile.setField(key, value);
+ }
+ }
+ }
+ }
+ // stop - added by tknall
+
profileInformation.add(signatureProfile);
}
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/api/commons/SignatureProfileImpl.java b/src/main/java/at/gv/egiz/pdfas/impl/api/commons/SignatureProfileImpl.java
index 0d2bfdd..f0422f6 100644
--- a/src/main/java/at/gv/egiz/pdfas/impl/api/commons/SignatureProfileImpl.java
+++ b/src/main/java/at/gv/egiz/pdfas/impl/api/commons/SignatureProfileImpl.java
@@ -3,6 +3,10 @@
*/
package at.gv.egiz.pdfas.impl.api.commons;
+import java.util.Collections;
+import java.util.Hashtable;
+import java.util.Set;
+
import at.gv.egiz.pdfas.api.commons.SignatureProfile;
/**
@@ -22,7 +26,17 @@ public class SignatureProfileImpl implements SignatureProfile
* The MOA key identifiert of this profile.
*/
protected String moaKeyIdentifier = null;
-
+
+ // start - added by tknall
+
+ /**
+ * A Hashtable containing all field values (as String) for the current profiles
+ * (<code>sig_obj.PROFILE.key.*</code>).
+ */
+ protected Hashtable fields = new Hashtable();
+
+ // stop - added by tknall
+
/**
* Constructor.
*
@@ -53,4 +67,34 @@ public class SignatureProfileImpl implements SignatureProfile
return this.moaKeyIdentifier;
}
+ // start - added by tknall
+
+ /**
+ * Returns the value of a field with a given key for the current profile.
+ * <p>e.g.<br/><code>signaturProfile.getField(SignatureTypes.SIG_ISSUER)</code><br/>
+ * returns <code>"Issuer-Certificate"</code></p>
+ * <code>null</code> is returned if a field with key <code>key</code> could not be found.
+ * @param key The key for the field to be returned or <code>null</code> if there is not such field.
+ * @return The value of the field with key <code>key</key>.
+ * @see at.knowcenter.wag.egov.egiz.sig.SignatureTypes
+ */
+ public String getField(String key) {
+ return (String) this.fields.get(key);
+ }
+
+ /**
+ * Sets the value <code>value</code> for a certain field with key <code>key</code>.
+ * @param key The key of the field.
+ * @param value The value of the field with key <code>key</code>.
+ */
+ public void setField(String key, String value) {
+ this.fields.put(key, value);
+ }
+
+ public Set getFieldKeys() {
+ return Collections.unmodifiableSet(this.fields.keySet());
+ }
+
+ // stop - added by tknall
+
}
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureObject.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureObject.java
index fc58bd1..cd67c95 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureObject.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureObject.java
@@ -189,7 +189,7 @@ public class SignatureObject implements Serializable
/**
* Filters the issuer name in order to find matches.
* @author tknall
- * @see {@link normalizeIssuer}
+ * @see #normalizeIssuer
*/
private LDAPIssuerNameFilter issuerNameFilter = new LDAPIssuerNameFilter() {
public Name applyFilter(Name name) {
@@ -1056,7 +1056,7 @@ public class SignatureObject implements Serializable
* comparison with registered ldap mappings.)
* @param issuer The issuer.
* @return normalized issuer
- * @see {@link issuerNameFilter}
+ * @see #issuerNameFilter
* @author tknall
*/
private String normalizeIssuer(String issuer) {
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/EnvelopedBase64BKUConnector.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/EnvelopedBase64BKUConnector.java
index 742a9a8..40a7732 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/EnvelopedBase64BKUConnector.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/EnvelopedBase64BKUConnector.java
@@ -313,6 +313,8 @@ public class EnvelopedBase64BKUConnector implements Connector, LocalConnector
String verify_request_xml = verify_request_template.replaceFirst(TemplateReplaces.XML_CONTENT_REPLACE, xml_content);
+// log.debug("\r\n\r\n" + verify_request_xml + "\r\n\r\n");
+
return verify_request_xml;
}
@@ -487,11 +489,15 @@ public class EnvelopedBase64BKUConnector implements Connector, LocalConnector
String verify_request_filename = getConnectorValueFromProfile(settings, profile, VERIFY_REQUEST_TEMPLATE_KEY);
this.verify_request_template = FileHelper.readFromFile(SettingsReader.relocateFile(verify_request_filename));
+ log.debug("Verify request template filename = " + verify_request_filename);
+
if (this.verify_request_template == null)
{
throw new ConnectorException(ErrorCode.SETTING_NOT_FOUND, "Can not read the verify xml request template"); //$NON-NLS-1$
}
+ log.debug("Verify request template = " + this.verify_request_template);
+
String verify_filename = getConnectorValueFromProfile(settings, profile, VERIFY_TEMPLATE_KEY);
this.verify_template = FileHelper.readFromFile(SettingsReader.relocateFile(verify_filename));
if (this.verify_template == null)