summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2021-03-05 15:50:55 +0100
committerThomas Lenz <thomas.lenz@egiz.gv.at>2021-03-05 15:50:55 +0100
commitcdd4b4fab65042f962b5ceaf09ce071f10b9526d (patch)
treefbede515c13a90804cba50d76171f12f5d32a1e7
parentfa4c8c787d5efb494e7d6c0ad80713e82095820e (diff)
parent2c83ec8f4200e7e1fa9a8df6d80c7097c72995c9 (diff)
downloadEAAF-Components-cdd4b4fab65042f962b5ceaf09ce071f10b9526d.tar.gz
EAAF-Components-cdd4b4fab65042f962b5ceaf09ce071f10b9526d.tar.bz2
EAAF-Components-cdd4b4fab65042f962b5ceaf09ce071f10b9526d.zip
Merge branch 'feature/small_changes' into 'nightlyBuild'
Feature/small changes See merge request egiz/eaaf_components!21
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidIdentityStatusLevelAttributeBuiler.java10
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidIssuingNationAttributeBuilder.java2
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidSignerCertificate.java7
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractController.java26
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractProcessEngineSignalController.java2
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/ProtocolFinalizationController.java3
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessEngineImpl.java17
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/dao/ProcessInstanceStoreDaoImpl.java2
8 files changed, 38 insertions, 31 deletions
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidIdentityStatusLevelAttributeBuiler.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidIdentityStatusLevelAttributeBuiler.java
index ee51564e..8345dcf8 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidIdentityStatusLevelAttributeBuiler.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidIdentityStatusLevelAttributeBuiler.java
@@ -1,8 +1,5 @@
package at.gv.egiz.eaaf.core.impl.idp.builder.attributes;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import at.gv.egiz.eaaf.core.api.idp.IAttributeGenerator;
import at.gv.egiz.eaaf.core.api.idp.IAuthData;
import at.gv.egiz.eaaf.core.api.idp.IEidAuthData;
@@ -10,11 +7,11 @@ import at.gv.egiz.eaaf.core.api.idp.IPvpAttributeBuilder;
import at.gv.egiz.eaaf.core.api.idp.ISpConfiguration;
import at.gv.egiz.eaaf.core.exceptions.AttributeBuilderException;
import at.gv.egiz.eaaf.core.exceptions.UnavailableAttributeException;
+import lombok.extern.slf4j.Slf4j;
+@Slf4j
@PvpMetadata
public class EidIdentityStatusLevelAttributeBuiler implements IPvpAttributeBuilder {
- private static final Logger log =
- LoggerFactory.getLogger(EidIdentityStatusLevelAttributeBuiler.class);
@Override
public String getName() {
@@ -28,12 +25,15 @@ public class EidIdentityStatusLevelAttributeBuiler implements IPvpAttributeBuild
if (authData instanceof IEidAuthData) {
if (((IEidAuthData) authData).getEidStatus() == null) {
throw new UnavailableAttributeException(getName());
+
}
return g.buildStringAttribute(getFriendlyName(), getName(),
((IEidAuthData) authData).getEidStatus().getUri());
+
} else {
log.info(getFriendlyName() + " is only available in EAAF context");
+
}
throw new UnavailableAttributeException(getName());
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidIssuingNationAttributeBuilder.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidIssuingNationAttributeBuilder.java
index fd85871c..90e8c285 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidIssuingNationAttributeBuilder.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidIssuingNationAttributeBuilder.java
@@ -41,7 +41,7 @@ public class EidIssuingNationAttributeBuilder implements IPvpAttributeBuilder {
final String countryCode = authData.getCiticenCountryCode();
if (StringUtils.isNotEmpty(countryCode)) {
return g.buildStringAttribute(EID_ISSUING_NATION_FRIENDLY_NAME, EID_ISSUING_NATION_NAME,
- countryCode);
+ countryCode.toUpperCase());
} else {
return null;
}
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidSignerCertificate.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidSignerCertificate.java
index 6f857779..daed8455 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidSignerCertificate.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidSignerCertificate.java
@@ -53,16 +53,17 @@ public class EidSignerCertificate implements IPvpAttributeBuilder {
EID_SIGNER_CERTIFICATE_NAME, Base64Utils.encodeToString(signerCertificate));
} else {
- log.info(EID_SIGNER_CERTIFICATE_FRIENDLY_NAME + " is only available in MOA-ID context");
+ log.debug("{} is not available", EID_SIGNER_CERTIFICATE_FRIENDLY_NAME);
+
}
} catch (final Exception e) {
- log.info("Signer certificate BASE64 encoding error");
+ log.info("{} BASE64 encoding error", EID_SIGNER_CERTIFICATE_FRIENDLY_NAME);
}
} else {
- log.info(EID_SIGNER_CERTIFICATE_FRIENDLY_NAME + " is only available in AuthHandler context");
+ log.info("{} is only available in AuthHandler context", EID_SIGNER_CERTIFICATE_FRIENDLY_NAME);
}
throw new UnavailableAttributeException(EID_SIGNER_CERTIFICATE_NAME);
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 0479a8c5..b05d8df0 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
@@ -26,7 +26,6 @@ import javax.annotation.Nullable;
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;
@@ -96,11 +95,11 @@ public abstract class AbstractController {
protAuthService.handleErrorNoRedirect(e, req, resp, true);
} catch (final EaafException e1) {
+ log.warn("ErrorHandling failed with error: ", e.getMessage(), e);
log.warn("Can NOT handle an 'EAAFException'. Forwarding to generic error ... ", e);
ioExceptionHandler(resp, e);
}
-
}
/**
@@ -110,20 +109,23 @@ public abstract class AbstractController {
* This handler wrote an internal server error into http response
* </p>
*
- * @param resp http response
- * @param exception exception
+ * @param req http request
+ * @param resp http response
+ * @param e Catched exception
* @throws IOException In case of an internal error.
*/
@ExceptionHandler({ Exception.class })
- public void genericExceptionHandler(final HttpServletResponse resp, final Exception exception)
- throws IOException {
- log.error("Internel Server Error.", exception);
- resp.setContentType(EaafConstants.CONTENTTYPE_HTML_UTF8);
- resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Internal Server Error!"
- + "(Errorcode=9199" + " | Description="
- + StringEscapeUtils.escapeHtml4(StringEscapeUtils.escapeEcmaScript(exception.getMessage()))
- + ")");
+ public void genericExceptionHandler(final HttpServletRequest req, final HttpServletResponse resp,
+ final Exception e) throws IOException {
+ try {
+ protAuthService.handleErrorNoRedirect(e, req, resp, true);
+
+ } catch (final EaafException e1) {
+ log.warn("ErrorHandling failed with error: ", e.getMessage(), e);
+ log.error("Can NOT handle a generic 'Exception'. Forwarding to generic error ... ", e);
+ ioExceptionHandler(resp, e);
+ }
}
/**
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractProcessEngineSignalController.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractProcessEngineSignalController.java
index 2ce728c1..ea481bdb 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractProcessEngineSignalController.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractProcessEngineSignalController.java
@@ -79,7 +79,7 @@ public abstract class AbstractProcessEngineSignalController extends AbstractCont
// process instance is mandatory
if (pendingReq.getProcessInstanceId() == null) {
throw new EaafIllegalStateException(
- new Object[] { "MOA session does not provide process instance id." });
+ new Object[] { "PendingRequest does not provide process-instance id." });
}
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 6a566f00..b2130fb4 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
@@ -176,7 +176,8 @@ public class ProtocolFinalizationController extends AbstractController {
final IRequest pendingReq = requestStorage.getPendingRequest(pendingRequestID);
if (pendingReq == null) {
- log.error("No PendingRequest with ID " + pendingRequestID + " found.!");
+ log.info("PendingReqId was valid but no PendingRequest with ID: {}. Looks already used",
+ pendingRequestID);
protAuthService.handleErrorNoRedirect(
new EaafException(IStatusMessenger.CODES_INTERNAL_ERROR_AUTH_TIMEOUT,
new Object[] { pendingRequestID, }),
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessEngineImpl.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessEngineImpl.java
index 9274ea81..61d2eb28 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessEngineImpl.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessEngineImpl.java
@@ -21,6 +21,7 @@ package at.gv.egiz.eaaf.core.impl.idp.process;
import java.io.InputStream;
import java.io.Serializable;
+import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
@@ -28,8 +29,6 @@ import java.util.concurrent.ConcurrentHashMap;
import org.apache.commons.collections4.IterableUtils;
import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
@@ -51,14 +50,17 @@ import at.gv.egiz.eaaf.core.impl.idp.process.model.ProcessNode;
import at.gv.egiz.eaaf.core.impl.idp.process.model.StartEvent;
import at.gv.egiz.eaaf.core.impl.idp.process.model.TaskInfo;
import at.gv.egiz.eaaf.core.impl.idp.process.model.Transition;
+import lombok.extern.slf4j.Slf4j;
/**
* Process engine implementation allowing starting and continuing processes as
* well as providing means for cleanup actions.
*/
+@Slf4j
public class ProcessEngineImpl implements ProcessEngine {
- private final Logger log = LoggerFactory.getLogger(getClass());
+ private static final String ERROR_PROCESS_OBJECT_NOT_EXIST =
+ "Process instance: {0} does not exist for pendingReq: {0}";
@Autowired
ProcessInstanceStoreDao piStoreDao;
@@ -156,15 +158,16 @@ public class ProcessEngineImpl implements ProcessEngine {
if (StringUtils.isEmpty(pendingReq.getProcessInstanceId())) {
log.error("Pending-request with id:" + pendingReq.getPendingRequestId()
+ " includes NO 'ProcessInstanceId'");
- throw new ProcessExecutionException("Pending-request with id:"
- + pendingReq.getPendingRequestId() + " includes NO 'ProcessInstanceId'");
+ throw new ProcessExecutionException(MessageFormat.format(ERROR_PROCESS_OBJECT_NOT_EXIST,
+ pendingReq.getProcessInstanceId(), pendingReq.getPendingRequestId()));
+
}
final ProcessInstance pi = loadProcessInstance(pendingReq.getProcessInstanceId());
if (pi == null) {
- throw new ProcessExecutionException(
- "Process instance '" + pendingReq.getProcessInstanceId() + "' does not exist.");
+ throw new ProcessExecutionException(MessageFormat.format(ERROR_PROCESS_OBJECT_NOT_EXIST,
+ pendingReq.getProcessInstanceId(), pendingReq.getPendingRequestId()));
}
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/dao/ProcessInstanceStoreDaoImpl.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/dao/ProcessInstanceStoreDaoImpl.java
index cca8872f..611572c0 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/dao/ProcessInstanceStoreDaoImpl.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/dao/ProcessInstanceStoreDaoImpl.java
@@ -72,7 +72,7 @@ public class ProcessInstanceStoreDaoImpl implements ProcessInstanceStoreDao {
log.debug("Found process instance store for instance '{}'.", processInstanceId);
} else {
- log.debug("Unable to find process instance store for instance '{}'.", processInstanceId);
+ log.info("Unable to find process instance store for instance '{}'.", processInstanceId);
}