aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/main/java/at/gv
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/idserverlib/src/main/java/at/gv')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java1
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/SignedDocAttributeRequestProvider.java69
2 files changed, 58 insertions, 12 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java
index e57bc0f8a..3dd2afd96 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java
@@ -115,6 +115,7 @@ public class PEPSConnectorServlet extends AuthServlet {
try {
AuthConfigurationProvider authConfigurationProvider = AuthConfigurationProvider.getInstance();
dtlUrl = authConfigurationProvider.getDocumentServiceUrl();
+ Logger.info ("PEPSConnectorServlet, using dtlUrl:"+dtlUrl);
} catch (Exception e) {
dtlUrl = "http://testvidp.buergerkarte.at/DocumentService/DocumentService";
e.printStackTrace();
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/SignedDocAttributeRequestProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/SignedDocAttributeRequestProvider.java
index 501e33a75..bb3d8b1fd 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/SignedDocAttributeRequestProvider.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/SignedDocAttributeRequestProvider.java
@@ -56,6 +56,7 @@ import org.apache.velocity.app.VelocityEngine;
import org.bouncycastle.util.encoders.UrlBase64;
import at.gv.egovernment.moa.id.auth.exception.MOAIDException;
+import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProvider;
import at.gv.egovernment.moa.id.config.auth.OAAuthParameter;
import at.gv.egovernment.moa.id.data.IAuthData;
import at.gv.egovernment.moa.id.protocols.stork2.ExternalAttributeRequestRequiredException;
@@ -108,15 +109,25 @@ public class SignedDocAttributeRequestProvider extends AttributeProvider {
super(attributes);
this.oasisDssWebFormURL = oasisDssWebFormURL;
- Properties props = new Properties();
try {
- props.load(DatabaseConnectorMySQLImpl.class.getResourceAsStream("docservice.properties"));
- dtlUrl = props.getProperty("docservice.url");
- } catch (IOException e) {
+ AuthConfigurationProvider authConfigurationProvider = AuthConfigurationProvider.getInstance();
+ dtlUrl = authConfigurationProvider.getDocumentServiceUrl();
+ Logger.info ("SignedDocAttributeRequestProvider, using dtlUrl:"+dtlUrl);
+ } catch (Exception e) {
dtlUrl = "http://testvidp.buergerkarte.at/DocumentService/DocumentService";
- Logger.error("Loading DTL config failed, using default value:"+dtlUrl);
e.printStackTrace();
- }
+ Logger.error("Loading documentservice url failed, using default value:"+dtlUrl);
+ }
+
+// Properties props = new Properties();
+// try {
+// props.load(DatabaseConnectorMySQLImpl.class.getResourceAsStream("docservice.properties"));
+// dtlUrl = props.getProperty("docservice.url");
+// } catch (IOException e) {
+// dtlUrl = "http://testvidp.buergerkarte.at/DocumentService/DocumentService";
+// Logger.error("Loading DTL config failed, using default value:"+dtlUrl);
+// e.printStackTrace();
+// }
}
/*
@@ -208,7 +219,16 @@ public class SignedDocAttributeRequestProvider extends AttributeProvider {
// set the url in the SignResponse
DocumentWithSignature documentWithSignature = new DocumentWithSignature();
DocumentType value = new DocumentType();
- value.setDocumentURL(dtlUrl);
+ if(dtlUrl.endsWith("?wsdl"))
+ {
+ String tmp = dtlUrl.replace("?wsdl", "");
+ Logger.debug("DocumentUrl ends with ? wsdl, using "+tmp+" instead.");
+ value.setDocumentURL(tmp);
+ }
+ else
+ {
+ value.setDocumentURL(dtlUrl);
+ }
documentWithSignature.setDocument(value);
if(signResponse.getOptionalOutputs()!=null)
{
@@ -356,7 +376,13 @@ public class SignedDocAttributeRequestProvider extends AttributeProvider {
byte[] data = getDocumentFromDtl(docRequest, dtlURL);//dtlUrl
//load doc from DTL
- Logger.debug("data:"+data);
+ Logger.debug("data:"+data+" "+data.length);
+ try{
+ Logger.trace("data:"+new String(data,"UTF-8"));
+ }catch(Exception e)
+ {
+ Logger.trace("data: creating String failed:"+e);
+ }
String mime = getDocumentMimeFromDtl(docId, dtlURL);//dtlUrl
Logger.debug("mime:"+mime);
@@ -367,11 +393,28 @@ public class SignedDocAttributeRequestProvider extends AttributeProvider {
IncludeObject.class);
signRequest.getOptionalInputs().getAny().removeAll(includeObjects);
+ String documentId = null;
+ Object objDoc = signRequest.getInputDocuments().getDocumentOrTransformedDataOrDocumentHash().get(0);
+ if (objDoc != null && objDoc instanceof DocumentType)
+ {
+ DocumentType document = (DocumentType)objDoc;
+ documentId = document.getID();
+ }
DocumentType document = new DocumentType();
- Base64Data b64data = new Base64Data();
- b64data.setValue(data);
- b64data.setMimeType(mime);
- document.setBase64Data(b64data);
+ if(documentId != null)
+ document.setID(documentId);
+ if(signRequest.getProfile().toLowerCase().contains("xades"))
+ {
+ document.setBase64XML(data);
+ }
+ else
+ {
+ Base64Data b64data = new Base64Data();
+ b64data.setValue(data);
+ b64data.setMimeType(mime);
+ document.setBase64Data(b64data);
+ }
+
signRequest.setInputDocuments(ApiUtils.createInputDocuments(document));
//override old signRequestString
@@ -380,6 +423,7 @@ public class SignedDocAttributeRequestProvider extends AttributeProvider {
IOUtils.copy(istr, writer, "UTF-8");
signRequestString = writer.toString();
Logger.info("Signrequest overwritten");
+ Logger.debug("Signrequest overwritten:"+signRequestString);
} catch (Exception e) {
e.printStackTrace();
throw new Exception("Could not marshall sign request", e);
@@ -470,6 +514,7 @@ public class SignedDocAttributeRequestProvider extends AttributeProvider {
URL url = null;
try
{
+ Logger.debug("getDocumentFromDtl:"+dtlUrl);
url = new URL(dtlUrl);
QName qname = new QName("http://stork.eu",
"DocumentService");