summaryrefslogtreecommitdiff
path: root/BKUOnline
diff options
context:
space:
mode:
Diffstat (limited to 'BKUOnline')
-rw-r--r--BKUOnline/pom.xml1
-rw-r--r--BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java20
-rw-r--r--BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java42
-rw-r--r--BKUOnline/src/main/webapp/WEB-INF/applicationContext.xml15
-rw-r--r--BKUOnline/src/main/webapp/WEB-INF/wsdl/stal.xsd19
-rw-r--r--BKUOnline/src/main/wsdl/stal-service.xsd17
-rw-r--r--BKUOnline/src/test/java/at/gv/egiz/stal/service/STALRequestBrokerTest.java24
7 files changed, 125 insertions, 13 deletions
diff --git a/BKUOnline/pom.xml b/BKUOnline/pom.xml
index f642b32c..86778969 100644
--- a/BKUOnline/pom.xml
+++ b/BKUOnline/pom.xml
@@ -99,6 +99,7 @@
<groupId>org.glassfish.metro</groupId>
<artifactId>webservices-rt</artifactId>
+ <scope>compile</scope>
<!-- use JAX-WS RI with SJSXP instead of Woodstox -->
<!-- <exclusions>
<exclusion>
diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java
index eab5c62d..3746b8d1 100644
--- a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java
+++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java
@@ -25,6 +25,7 @@
package at.gv.egiz.stal.service.impl;
+import at.gv.egiz.stal.BulkSignRequest;
import at.gv.egiz.stal.ErrorResponse;
import at.gv.egiz.stal.HashDataInput;
import at.gv.egiz.stal.QuitRequest;
@@ -115,8 +116,25 @@ public class STALRequestBrokerImpl implements STALRequestBroker {
// and getHashDataInput() accesses request obj
// (requests are cleared only when we receive the response)
// DataObjectHashDataInput with reference caching enabled DataObject
+
+ log.info("Adding HashdataInput with id {} and digsest {}", ((SignRequest) stalRequest).getHashDataInput()
+ .get(0).getReferenceId(), ((SignRequest) stalRequest).getHashDataInput().get(0).getDigest());
hashDataInputs.addAll(((SignRequest) stalRequest).getHashDataInput());
- } else if (stalRequest instanceof QuitRequest) {
+ }
+
+ if (stalRequest instanceof BulkSignRequest) {
+
+ BulkSignRequest bulkSignRequest = (BulkSignRequest) stalRequest;
+
+ for (SignRequest signRequest : bulkSignRequest.getSignRequests()) {
+ log.info("Adding HashdataInput with id {} and digsest {}", signRequest.getHashDataInput().get(0)
+ .getReferenceId(), signRequest.getHashDataInput().get(0).getDigest());
+ hashDataInputs.addAll(signRequest.getHashDataInput());
+ }
+
+ }
+
+ else if (stalRequest instanceof QuitRequest) {
log.trace("Received QuitRequest, do not wait for responses.");
log.trace("notifying request consumers");
requests.notify();
diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java
index 836d6538..1819074a 100644
--- a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java
+++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java
@@ -120,7 +120,7 @@ public class STALServiceImpl implements STALPortType {
if (stal != null) {
List<JAXBElement<? extends RequestType>> requestsOut = ((STALRequestBroker) stal).connect();
- response.getInfoboxReadRequestOrSignRequestOrQuitRequest().addAll(requestsOut);
+ response.getInfoboxReadRequestOrSignRequestOrBulkSignRequest().addAll(requestsOut);
if (log.isDebugEnabled()) {
StringBuilder sb = new StringBuilder("Returning initial GetNextRequestResponse containing ");
@@ -136,7 +136,7 @@ public class STALServiceImpl implements STALPortType {
log.error("Failed to get STAL, returning QuitRequest.");
QuitRequestType quitT = stalObjFactory.createQuitRequestType();
JAXBElement<QuitRequestType> quit = stalObjFactory.createGetNextRequestResponseTypeQuitRequest(quitT);
- response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(quit);
+ response.getInfoboxReadRequestOrSignRequestOrBulkSignRequest().add(quit);
}
return response;
@@ -157,7 +157,7 @@ public class STALServiceImpl implements STALPortType {
try {
- List<JAXBElement<? extends ResponseType>> responsesIn = request.getInfoboxReadResponseOrSignResponseOrErrorResponse();
+ List<JAXBElement<? extends ResponseType>> responsesIn = request.getInfoboxReadResponseOrSignResponseOrBulkSignResponse();
if (log.isDebugEnabled()) {
StringBuilder sb = new StringBuilder("Received GetNextRequest containing ");
@@ -186,7 +186,7 @@ public class STALServiceImpl implements STALPortType {
if (stal != null) {
List<JAXBElement<? extends RequestType>> requestsOut = ((STALRequestBroker) stal).nextRequest(responsesIn);
- response.getInfoboxReadRequestOrSignRequestOrQuitRequest().addAll(requestsOut);
+ response.getInfoboxReadRequestOrSignRequestOrBulkSignRequest().addAll(requestsOut);
if (log.isDebugEnabled()) {
StringBuilder sb = new StringBuilder("Returning GetNextRequestResponse containing ");
@@ -202,7 +202,7 @@ public class STALServiceImpl implements STALPortType {
log.error("Failed to get STAL, returning QuitRequest.");
QuitRequestType quitT = stalObjFactory.createQuitRequestType();
JAXBElement<QuitRequestType> quit = stalObjFactory.createGetNextRequestResponseTypeQuitRequest(quitT);
- response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(quit);
+ response.getInfoboxReadRequestOrSignRequestOrBulkSignRequest().add(quit);
}
return response;
@@ -242,27 +242,51 @@ public class STALServiceImpl implements STALPortType {
if (hashDataInputs != null) {
Map<String, HashDataInput> hashDataIdMap = new HashMap<String, HashDataInput>();
+ Map<String, HashDataInput> hashDataDigestMap = new HashMap<String, HashDataInput>();
for (HashDataInput hdi : hashDataInputs) {
if (log.isTraceEnabled()) {
log.trace("Provided HashDataInput for reference {}.", hdi.getReferenceId());
}
+
+
+ if(hdi.getDigest() != null) {
+ log.trace("Provided HashDataInput for digest {}.", hdi.getDigest());
+ hashDataDigestMap.put(new String(hdi.getDigest()), hdi);
+ }
+
+ log.trace("Provided HashDataInput for reference {}.", hdi.getReferenceId());
hashDataIdMap.put(hdi.getReferenceId(), hdi);
}
List<GetHashDataInputType.Reference> reqRefs = request.getReference();
for (GetHashDataInputType.Reference reqRef : reqRefs) {
String reqRefId = reqRef.getID();
- HashDataInput reqHdi = hashDataIdMap.get(reqRefId);
+ String digest = new String(reqRef.getDigest());
+
+ log.info("looking for digest {}", digest);
+ HashDataInput reqHdi = hashDataDigestMap.get(digest);
+ if (reqHdi == null) {
+ log.info("looking for referenceId {}", reqRefId);
+ reqHdi = hashDataIdMap.get(reqRefId);
+ }
if (reqHdi == null) {
String msg = "Failed to resolve HashDataInput for reference " + reqRefId;
- log.error(msg);
+ log.info(msg);
GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType();
faultInfo.setErrorCode(1);
faultInfo.setErrorMessage(msg);
throw new GetHashDataInputFault(msg, faultInfo);
}
- InputStream hashDataIS = reqHdi.getHashDataInput();
+ InputStream hashDataIS;
+ try {
+ hashDataIS = reqHdi.getHashDataInput();
+ } catch (IOException e) {
+ GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType();
+ faultInfo.setErrorCode(1);
+ faultInfo.setErrorMessage(e.getMessage());
+ throw new GetHashDataInputFault(e.getMessage(), faultInfo);
+ }
if (hashDataIS == null) {
//HashDataInput not cached?
String msg = "Failed to obtain HashDataInput for reference " + reqRefId + ", reference not cached";
@@ -345,7 +369,7 @@ public class STALServiceImpl implements STALPortType {
GetNextRequestResponseType response = new GetNextRequestResponseType();
response.setSessionId(TEST_SESSION_ID.toString());
- List<JAXBElement<? extends RequestType>> reqs = response.getInfoboxReadRequestOrSignRequestOrQuitRequest();
+ List<JAXBElement<? extends RequestType>> reqs = response.getInfoboxReadRequestOrSignRequestOrBulkSignRequest();
if (responsesIn == null) {
log.info("[TestSession] CONNECT");
diff --git a/BKUOnline/src/main/webapp/WEB-INF/applicationContext.xml b/BKUOnline/src/main/webapp/WEB-INF/applicationContext.xml
index 7534a9c9..2ca9ce9c 100644
--- a/BKUOnline/src/main/webapp/WEB-INF/applicationContext.xml
+++ b/BKUOnline/src/main/webapp/WEB-INF/applicationContext.xml
@@ -50,10 +50,10 @@
<property name="configuration" ref="configuration"/>
</bean>
- <bean id="urlDereferencer" class="at.gv.egiz.bku.utils.urldereferencer.URLDereferencerImpl"
- factory-method="getInstance">
- <property name="SSLSocketFactory" ref="sslSocketFactory"/>
+ <bean id="urlDereferencer" class="at.gv.egiz.bku.spring.URLDereferencerFactoryBean">
+ <property name="sslSocketFactory" ref="sslSocketFactory"/>
<property name="hostnameVerifier" ref="hostnameVerifier"/>
+ <property name="configuration" ref="configuration"/>
</bean>
<!-- security manager for the command invoker -->
@@ -144,6 +144,14 @@
value="http://www.buergerkarte.at/namespaces/securitylayer/1.2#" />
<constructor-arg value="CreateCMSSignatureRequest" />
</bean>
+ <bean id="bulkCommandFactory"
+ class="at.gv.egiz.bku.slcommands.impl.BulkCommandFactory"
+ parent="abstractCommandFactory" />
+ <bean id="bulkRequest" class="javax.xml.namespace.QName">
+ <constructor-arg
+ value="http://www.buergerkarte.at/namespaces/securitylayer/1.2#" />
+ <constructor-arg value="BulkRequest"/>
+ </bean>
<bean id="getStatusCommandFactory" class="at.gv.egiz.bku.slcommands.impl.GetStatusCommandFactory"
parent="abstractCommandFactory" />
<bean id="getStatusRequest" class="javax.xml.namespace.QName">
@@ -161,6 +169,7 @@
<entry key-ref="infoboxUpdateRequest" value-ref="infoboxUpdateCommandFactory" />
<entry key-ref="createXMLSignatureRequest" value-ref="createXMLSignatureCommandFactory" />
<entry key-ref="createCMSSignatureRequest" value-ref="createCMSSignatureCommandFactory" />
+ <entry key-ref="bulkRequest" value-ref="bulkCommandFactory" />
<entry key-ref="getStatusRequest" value-ref="getStatusCommandFactory" />
</map>
</property>
diff --git a/BKUOnline/src/main/webapp/WEB-INF/wsdl/stal.xsd b/BKUOnline/src/main/webapp/WEB-INF/wsdl/stal.xsd
index 750cf355..8dc20ec7 100644
--- a/BKUOnline/src/main/webapp/WEB-INF/wsdl/stal.xsd
+++ b/BKUOnline/src/main/webapp/WEB-INF/wsdl/stal.xsd
@@ -38,6 +38,7 @@
<choice maxOccurs="unbounded">
<element name="InfoboxReadResponse" type="tns:InfoboxReadResponseType"/>
<element name="SignResponse" type="tns:SignResponseType"/>
+ <element name="BulkSignResponse" type="tns:BulkSignResponseType"/>
<element name="ErrorResponse" type="tns:ErrorResponseType"/>
<element name="StatusResponse" type="tns:StatusResponseType"/>
</choice>
@@ -87,6 +88,7 @@
<choice maxOccurs="unbounded">
<element name="InfoboxReadRequest" type="tns:InfoboxReadRequestType"/>
<element name="SignRequest" type="tns:SignRequestType"/>
+ <element name="BulkSignRequest" type="tns:BulkSignRequestType"/>
<element name="QuitRequest" type="tns:QuitRequestType"/>
<element name="StatusRequest" type="tns:StatusRequestType"/>
</choice>
@@ -134,6 +136,8 @@
</element>
<element name="SignatureMethod" type="string" minOccurs="0"/>
<element name="DigestMethod" type="string" minOccurs="0"/>
+ <element name="displayName" type="string" minOccurs="0"/>
+ <element name="mimeType" type="string" minOccurs="0"/>
<element name="ExcludedByteRange" minOccurs="0">
<complexType>
<attribute name="from" type="unsignedLong" use="required"/>
@@ -144,6 +148,20 @@
</extension>
</complexContent>
</complexType>
+
+ <complexType name="BulkSignRequestType">
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element name="SignResponse" type="tns:SignRequestType"/>
+ </sequence>
+ </complexType>
+
+
+ <complexType name="BulkSignResponseType">
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element name="SignResponse" type="tns:SignResponseType"/>
+ </sequence>
+ </complexType>
+
<complexType name="QuitRequestType">
<complexContent>
<extension base="tns:RequestType"/>
@@ -159,6 +177,7 @@
<element name="Reference" maxOccurs="unbounded">
<complexType>
<attribute name="ID" type="string"/>
+ <attribute use="optional" name="digest" type="base64Binary"/>
</complexType>
</element>
</sequence>
diff --git a/BKUOnline/src/main/wsdl/stal-service.xsd b/BKUOnline/src/main/wsdl/stal-service.xsd
index 59cebac6..0f452df9 100644
--- a/BKUOnline/src/main/wsdl/stal-service.xsd
+++ b/BKUOnline/src/main/wsdl/stal-service.xsd
@@ -47,6 +47,7 @@
<choice maxOccurs="unbounded">
<element name="InfoboxReadResponse" type="tns:InfoboxReadResponseType"/>
<element name="SignResponse" type="tns:SignResponseType"/>
+ <element name="BulkSignResponse" type="tns:BulkSignResponseType"/>
<element name="ErrorResponse" type="tns:ErrorResponseType"/>
<element name="StatusResponse" type="tns:StatusResponseType"/>
<element ref="tns:OtherResponse"/>
@@ -99,6 +100,7 @@
<choice maxOccurs="unbounded">
<element name="InfoboxReadRequest" type="tns:InfoboxReadRequestType"/>
<element name="SignRequest" type="tns:SignRequestType"/>
+ <element name="BulkSignRequest" type="tns:BulkSignRequestType"/>
<element name="QuitRequest" type="tns:QuitRequestType"/>
<element name="StatusRequest" type="tns:StatusRequestType"/>
<element ref="tns:OtherRequest"/>
@@ -143,6 +145,20 @@
</extension>
</complexContent>
</complexType>
+
+ <complexType name="BulkSignRequestType">
+ <sequence minOccurs="1" maxOccurs="unbounded" >
+ <element name="SignRequests" type="tns:SignRequestType"/>
+ </sequence>
+ </complexType>
+
+
+ <complexType name="BulkSignResponseType">
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element name="SignResponses" type="tns:SignResponseType"/>
+ </sequence>
+ </complexType>
+
<complexType name="QuitRequestType">
<complexContent>
<extension base="tns:RequestType"/>
@@ -158,6 +174,7 @@
<element name="Reference" maxOccurs="unbounded">
<complexType>
<attribute name="ID" type="string"/>
+ <attribute use="optional" name="digest" type="base64Binary"/>
</complexType>
</element>
</sequence>
diff --git a/BKUOnline/src/test/java/at/gv/egiz/stal/service/STALRequestBrokerTest.java b/BKUOnline/src/test/java/at/gv/egiz/stal/service/STALRequestBrokerTest.java
index bfbff5a4..c096fa8f 100644
--- a/BKUOnline/src/test/java/at/gv/egiz/stal/service/STALRequestBrokerTest.java
+++ b/BKUOnline/src/test/java/at/gv/egiz/stal/service/STALRequestBrokerTest.java
@@ -143,6 +143,12 @@ public class STALRequestBrokerTest {
public String getFilename() {
return "file.txt";
}
+
+ @Override
+ public byte[] getDigest() {
+ return null;
+ }
+
};
r1.setHashDataInput(Collections.singletonList(hdi));
requests.add(r1);
@@ -196,6 +202,12 @@ public class STALRequestBrokerTest {
public String getFilename() {
return "file.txt";
}
+
+ @Override
+ public byte[] getDigest() {
+ return null;
+ }
+
};
r1.setHashDataInput(Collections.singletonList(hdi));
requests.add(r1);
@@ -262,6 +274,12 @@ public class STALRequestBrokerTest {
public String getFilename() {
return "file.txt";
}
+
+ @Override
+ public byte[] getDigest() {
+ return null;
+ }
+
};
r1.setHashDataInput(Collections.singletonList(hdi));
requests.add(r1);
@@ -297,6 +315,12 @@ public class STALRequestBrokerTest {
public String getFilename() {
return "file.xml";
}
+
+ @Override
+ public byte[] getDigest() {
+ return null;
+ }
+
};
r2.setHashDataInput(Collections.singletonList(hdi2));
requests2.add(r2);