summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractController.java17
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/ProtocolFinalizationController.java26
-rw-r--r--eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/tasks/AbstractCreateQualEidRequestTask.java12
3 files changed, 33 insertions, 22 deletions
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractController.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractController.java
index e9687833..58c8c0a9 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractController.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractController.java
@@ -47,6 +47,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
+import org.springframework.util.SerializationUtils;
import org.springframework.web.bind.annotation.ExceptionHandler;
/**
@@ -170,11 +171,21 @@ public abstract class AbstractController {
final String errorKey = Random.nextLongRandom();
if (errorToHandle.getFirst() != null) {
revisionsLogger.logEvent(errorToHandle.getFirst(), EventConstants.TRANSACTION_ERROR);
- transactionStorage.put(errorKey, new ExceptionContainer(errorToHandle.getFirst(), errorToHandle
- .getSecond()), -1);
+
+ log.trace("Serializing {} ... ", ExceptionContainer.class.getName());
+ final byte[] serializedError = SerializationUtils.serialize(
+ new ExceptionContainer(errorToHandle.getFirst(), errorToHandle.getSecond()));
+
+ log.trace("Put 'ExceptionContainer' into cache ... ");
+ transactionStorage.put(errorKey, serializedError, -1);
} else {
- transactionStorage.put(errorKey, new ExceptionContainer(null, errorToHandle.getSecond()), -1);
+ log.trace("Serializing {} ... ", ExceptionContainer.class.getName());
+ final byte[] serializedError = SerializationUtils.serialize(
+ new ExceptionContainer(null, errorToHandle.getSecond()));
+
+ log.trace("Put 'ExceptionContainer' into cache ... ");
+ transactionStorage.put(errorKey, serializedError, -1);
}
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/ProtocolFinalizationController.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/ProtocolFinalizationController.java
index 17da63f5..dc8caabd 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/ProtocolFinalizationController.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/ProtocolFinalizationController.java
@@ -24,14 +24,6 @@ import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.commons.text.StringEscapeUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-
import at.gv.egiz.components.eventlog.api.EventConstants;
import at.gv.egiz.eaaf.core.api.IRequest;
import at.gv.egiz.eaaf.core.api.IRequestStorage;
@@ -40,6 +32,15 @@ import at.gv.egiz.eaaf.core.api.data.EaafConstants;
import at.gv.egiz.eaaf.core.api.data.ExceptionContainer;
import at.gv.egiz.eaaf.core.exceptions.EaafException;
+import org.apache.commons.text.StringEscapeUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.util.SerializationUtils;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
/**
* Protocol finialization end-point.
*
@@ -73,12 +74,15 @@ public class ProtocolFinalizationController extends AbstractController {
IRequest pendingReq = null;
try {
// load stored exception from database
- final ExceptionContainer container =
- transactionStorage.get(errorid, ExceptionContainer.class);
- if (container != null) {
+ final byte[] containerSerialized =
+ transactionStorage.get(errorid, byte[].class);
+ if (containerSerialized != null) {
// remove exception if it was found
transactionStorage.remove(errorid);
+ final ExceptionContainer container =
+ (ExceptionContainer) SerializationUtils.deserialize(containerSerialized);
+
final Throwable throwable = container.getExceptionThrown();
pendingReq = container.getPendingRequest();
diff --git a/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/tasks/AbstractCreateQualEidRequestTask.java b/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/tasks/AbstractCreateQualEidRequestTask.java
index 5be5a61f..56084d94 100644
--- a/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/tasks/AbstractCreateQualEidRequestTask.java
+++ b/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/tasks/AbstractCreateQualEidRequestTask.java
@@ -2,6 +2,7 @@ package at.gv.egiz.eaaf.modules.auth.sl20.tasks;
import java.io.Serializable;
import java.net.ConnectException;
+import java.nio.charset.StandardCharsets;
import java.security.cert.CertificateEncodingException;
import java.util.ArrayList;
import java.util.List;
@@ -98,23 +99,18 @@ public abstract class AbstractCreateQualEidRequestTask extends AbstractAuthServl
final HttpPost httpReq = new HttpPost(new URIBuilder(vdaQualEidDUrl).build());
final List<NameValuePair> parameters = new ArrayList<>();
parameters.add(new BasicNameValuePair(SL20Constants.PARAM_SL20_REQ_COMMAND_PARAM,
- Base64Url.encode(sl20Req.toString().getBytes("UTF-8"))));
+ Base64Url.encode(sl20Req.toString().getBytes(StandardCharsets.UTF_8))));
//inject additional request parameters
injectAdditionalSL20RequestParams(parameters, executionContext, request);
httpReq.setEntity(new UrlEncodedFormEntity(parameters));
- // build http GET request
- // URIBuilder sl20ReqUri = new URIBuilder(vdaQualeIDUrl);
- // sl20ReqUri.addParameter(SL20Constants.PARAM_SL20_REQ_COMMAND_PARAM,
- // Base64Url.encode(sl20Req.toString().getBytes()));
- // HttpGet httpReq = new HttpGet(sl20ReqUri.build());
-
// set native client header
httpReq.addHeader(SL20Constants.HTTP_HEADER_SL20_CLIENT_TYPE, SL20Constants.HTTP_HEADER_VALUE_NATIVE);
- log.trace("Request VDA via SL20 with: " + Base64Url.encode(sl20Req.toString().getBytes("UTF-8")));
+ log.trace("Request VDA via SL20 with: {}",
+ Base64Url.encode(sl20Req.toString().getBytes(StandardCharsets.UTF_8)));
// request VDA
final HttpResponse httpResp = httpClientFactory.getHttpClient(false).execute(httpReq);