summaryrefslogtreecommitdiff
path: root/eaaf_core
diff options
context:
space:
mode:
authorThomas <>2023-05-15 08:36:30 +0200
committerThomas <>2023-05-15 08:36:30 +0200
commit5865c9e49fb399c7690ed87925ba7b8ad5d98f13 (patch)
treea37acda465cab14f290f27127045cb1518e1b0ce /eaaf_core
parentbfeebfeb693f1f2ef0d2f6abb34bdf0aeffa3af4 (diff)
downloadEAAF-Components-5865c9e49fb399c7690ed87925ba7b8ad5d98f13.tar.gz
EAAF-Components-5865c9e49fb399c7690ed87925ba7b8ad5d98f13.tar.bz2
EAAF-Components-5865c9e49fb399c7690ed87925ba7b8ad5d98f13.zip
refact(core): change process-data holder-implementation to use Jackson serialization for storage
Diffstat (limited to 'eaaf_core')
-rw-r--r--eaaf_core/checks/spotbugs-exclude.xml8
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java2
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractController.java2
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/ProtocolFinalizationController.java2
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/protocols/RequestImpl.java38
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/controller/ProtocolFinalizationControllerTest.java2
6 files changed, 45 insertions, 9 deletions
diff --git a/eaaf_core/checks/spotbugs-exclude.xml b/eaaf_core/checks/spotbugs-exclude.xml
index b12ecc01..03938cd1 100644
--- a/eaaf_core/checks/spotbugs-exclude.xml
+++ b/eaaf_core/checks/spotbugs-exclude.xml
@@ -51,4 +51,12 @@
</OR>
<Bug pattern="CRLF_INJECTION_LOGS" />
</Match>
+ <Match>
+ <OR>
+ <Class name="at.gv.egiz.eaaf.core.impl.idp.controller.protocols.RequestImpl" />
+ </OR>
+ <OR>
+ <Bug pattern="JACKSON_UNSAFE_DESERIALIZATION" />
+ </OR>
+ </Match>
</FindBugsFilter>
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java
index 98ea339e..08fcf6f8 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java
@@ -43,7 +43,6 @@ import at.gv.egiz.eaaf.core.api.IRequest;
import at.gv.egiz.eaaf.core.api.IRequestStorage;
import at.gv.egiz.eaaf.core.api.IStatusMessenger;
import at.gv.egiz.eaaf.core.api.data.EaafConstants;
-import at.gv.egiz.eaaf.core.api.data.ExceptionContainer;
import at.gv.egiz.eaaf.core.api.gui.IGuiBuilderConfiguration;
import at.gv.egiz.eaaf.core.api.gui.IGuiBuilderConfigurationFactory;
import at.gv.egiz.eaaf.core.api.gui.IGuiFormBuilder;
@@ -69,6 +68,7 @@ import at.gv.egiz.eaaf.core.exceptions.GuiBuildException;
import at.gv.egiz.eaaf.core.exceptions.InvalidProtocolRequestException;
import at.gv.egiz.eaaf.core.exceptions.ProcessExecutionException;
import at.gv.egiz.eaaf.core.exceptions.ProtocolNotActiveException;
+import at.gv.egiz.eaaf.core.impl.data.ExceptionContainer;
import at.gv.egiz.eaaf.core.impl.data.Pair;
import at.gv.egiz.eaaf.core.impl.gui.AbstractGuiFormBuilderConfiguration;
import at.gv.egiz.eaaf.core.impl.http.HttpUtils;
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 4fa2676d..ab0ce9d5 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
@@ -36,7 +36,6 @@ import at.gv.egiz.components.eventlog.api.EventConstants;
import at.gv.egiz.eaaf.core.api.IRequest;
import at.gv.egiz.eaaf.core.api.IStatusMessenger;
import at.gv.egiz.eaaf.core.api.data.EaafConstants;
-import at.gv.egiz.eaaf.core.api.data.ExceptionContainer;
import at.gv.egiz.eaaf.core.api.idp.IConfigurationWithSP;
import at.gv.egiz.eaaf.core.api.idp.auth.services.IProtocolAuthenticationService;
import at.gv.egiz.eaaf.core.api.logging.IRevisionLogger;
@@ -46,6 +45,7 @@ import at.gv.egiz.eaaf.core.exceptions.EaafException;
import at.gv.egiz.eaaf.core.exceptions.PendingReqIdValidationException;
import at.gv.egiz.eaaf.core.exceptions.ProcessExecutionException;
import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
+import at.gv.egiz.eaaf.core.impl.data.ExceptionContainer;
import at.gv.egiz.eaaf.core.impl.data.Pair;
/**
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 099aa180..06da298b 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
@@ -37,10 +37,10 @@ import at.gv.egiz.eaaf.core.api.IRequest;
import at.gv.egiz.eaaf.core.api.IRequestStorage;
import at.gv.egiz.eaaf.core.api.IStatusMessenger;
import at.gv.egiz.eaaf.core.api.data.EaafConstants;
-import at.gv.egiz.eaaf.core.api.data.ExceptionContainer;
import at.gv.egiz.eaaf.core.api.idp.IModulInfo;
import at.gv.egiz.eaaf.core.api.utils.IPendingRequestIdGenerationStrategy;
import at.gv.egiz.eaaf.core.exceptions.EaafException;
+import at.gv.egiz.eaaf.core.impl.data.ExceptionContainer;
import at.gv.egiz.eaaf.core.impl.idp.auth.services.ProtocolAuthenticationService;
import at.gv.egiz.eaaf.core.impl.utils.TransactionIdUtils;
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/protocols/RequestImpl.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/protocols/RequestImpl.java
index df13fda9..eb32d03f 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/protocols/RequestImpl.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/protocols/RequestImpl.java
@@ -33,12 +33,15 @@ import javax.annotation.Nonnull;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+
import at.gv.egiz.eaaf.core.api.IRequest;
import at.gv.egiz.eaaf.core.api.data.EaafConstants;
import at.gv.egiz.eaaf.core.api.idp.IConfiguration;
@@ -49,12 +52,20 @@ import at.gv.egiz.eaaf.core.exceptions.EaafException;
import at.gv.egiz.eaaf.core.exceptions.EaafStorageException;
import at.gv.egiz.eaaf.core.impl.http.HttpUtils;
import at.gv.egiz.eaaf.core.impl.idp.auth.data.AuthProcessDataWrapper;
+import at.gv.egiz.eaaf.core.impl.json.EscapedJsonDeserializer;
+import at.gv.egiz.eaaf.core.impl.json.EscapedJsonSerializer;
import at.gv.egiz.eaaf.core.impl.utils.TransactionIdUtils;
-
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+@Getter
+@Setter
+@NoArgsConstructor
public abstract class RequestImpl implements IRequest, Serializable {
- private static final Logger log = LoggerFactory.getLogger(RequestImpl.class);
-
public static final String DATAID_REQUESTER_IP_ADDRESS = "reqestImpl_requesterIPAddr";
private static final String ERROR_CODE_INTERNAL_00 = "eaaf.core.00";
@@ -75,6 +86,9 @@ public abstract class RequestImpl implements IRequest, Serializable {
private String requestedServiceProviderIdentifer;
private String idpAuthUrl = null;
+ @JsonTypeInfo(include = JsonTypeInfo.As.PROPERTY, use = JsonTypeInfo.Id.CLASS, property = "@class")
+ @JsonSerialize(using = EscapedJsonSerializer.class)
+ @JsonDeserialize(using = EscapedJsonDeserializer.class)
private ISpConfiguration spConfiguration = null;
private boolean passiv = false;
@@ -227,6 +241,7 @@ public abstract class RequestImpl implements IRequest, Serializable {
this.passiv = passiv;
}
+
public final void setForce(final boolean force) {
this.force = force;
}
@@ -298,12 +313,14 @@ public abstract class RequestImpl implements IRequest, Serializable {
}
+ @JsonIgnore
@Override
public final ISpConfiguration getServiceProviderConfiguration() {
return this.spConfiguration;
}
+ @JsonIgnore
@Override
public <T> T getServiceProviderConfiguration(final Class<T> decorator) {
if (this.spConfiguration != null) {
@@ -322,17 +339,25 @@ public abstract class RequestImpl implements IRequest, Serializable {
}
+ /**
+ * Inject Service-Provider configuration into that authentication process.
+ *
+ * @param spConfig SP configuration
+ */
+ @JsonIgnore
public void setOnlineApplicationConfiguration(final ISpConfiguration spConfig) {
this.spConfiguration = spConfig;
}
+ @JsonIgnore
@Override
public final String getUniqueTransactionIdentifier() {
return this.uniqueTransactionIdentifer;
}
+ @JsonIgnore
@Override
public final String getUniqueSessionIdentifier() {
return this.uniqueSessionIdentifer;
@@ -390,11 +415,13 @@ public abstract class RequestImpl implements IRequest, Serializable {
}
+ @JsonIgnore
@Override
public final String getAuthUrl() {
return this.idpAuthUrl;
}
+ @JsonIgnore
@Override
public final String getAuthUrlWithOutSlash() {
if (this.idpAuthUrl.endsWith("/")) {
@@ -458,6 +485,7 @@ public abstract class RequestImpl implements IRequest, Serializable {
}
+ @JsonIgnore
@Override
public boolean isProcessInIframe() {
return this.currentlyInIframe;
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/controller/ProtocolFinalizationControllerTest.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/controller/ProtocolFinalizationControllerTest.java
index e165f84b..a866f45f 100644
--- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/controller/ProtocolFinalizationControllerTest.java
+++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/controller/ProtocolFinalizationControllerTest.java
@@ -22,13 +22,13 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import at.gv.egiz.eaaf.core.api.data.EaafConfigConstants;
import at.gv.egiz.eaaf.core.api.data.EaafConstants;
-import at.gv.egiz.eaaf.core.api.data.ExceptionContainer;
import at.gv.egiz.eaaf.core.api.gui.GroupDefinition;
import at.gv.egiz.eaaf.core.api.gui.ModifyableGuiBuilderConfiguration;
import at.gv.egiz.eaaf.core.api.idp.IConfiguration;
import at.gv.egiz.eaaf.core.api.storage.ITransactionStorage;
import at.gv.egiz.eaaf.core.api.utils.IPendingRequestIdGenerationStrategy;
import at.gv.egiz.eaaf.core.exceptions.EaafException;
+import at.gv.egiz.eaaf.core.impl.data.ExceptionContainer;
import at.gv.egiz.eaaf.core.impl.gui.AbstractGuiFormBuilderConfiguration;
import at.gv.egiz.eaaf.core.impl.idp.auth.dummy.DummyDefaultErrorService;
import at.gv.egiz.eaaf.core.impl.idp.auth.services.IErrorService.ActionType;