From 5865c9e49fb399c7690ed87925ba7b8ad5d98f13 Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Mon, 15 May 2023 08:36:30 +0200 Subject: refact(core): change process-data holder-implementation to use Jackson serialization for storage --- eaaf_core/checks/spotbugs-exclude.xml | 8 ++ .../services/ProtocolAuthenticationService.java | 2 +- .../impl/idp/controller/AbstractController.java | 2 +- .../controller/ProtocolFinalizationController.java | 2 +- .../impl/idp/controller/protocols/RequestImpl.java | 38 +++++- .../ProtocolFinalizationControllerTest.java | 2 +- eaaf_core_api/checks/spotbugs-exclude.xml | 12 ++ eaaf_core_api/pom.xml | 17 +++ .../eaaf/core/api/data/ExceptionContainer.java | 103 --------------- .../exceptions/EaafAuthenticationException.java | 9 ++ .../egiz/eaaf/core/exceptions/EaafException.java | 9 +- eaaf_core_utils/checks/spotbugs-exclude.xml | 7 + eaaf_core_utils/pom.xml | 15 +++ .../eaaf/core/impl/data/ExceptionContainer.java | 143 +++++++++++++++++++++ .../core/impl/idp/conf/SpConfigurationImpl.java | 37 +++++- .../auth/sl20/exceptions/SL20Exception.java | 8 ++ .../sl20/exceptions/SlCommandoParserException.java | 5 + pom.xml | 7 +- 18 files changed, 306 insertions(+), 120 deletions(-) create mode 100644 eaaf_core_api/checks/spotbugs-exclude.xml delete mode 100644 eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/data/ExceptionContainer.java create mode 100644 eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/data/ExceptionContainer.java 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 @@ + + + + + + + + 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 getServiceProviderConfiguration(final Class 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; diff --git a/eaaf_core_api/checks/spotbugs-exclude.xml b/eaaf_core_api/checks/spotbugs-exclude.xml new file mode 100644 index 00000000..1c4cf203 --- /dev/null +++ b/eaaf_core_api/checks/spotbugs-exclude.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/eaaf_core_api/pom.xml b/eaaf_core_api/pom.xml index ce140dea..8cf64e77 100644 --- a/eaaf_core_api/pom.xml +++ b/eaaf_core_api/pom.xml @@ -48,6 +48,10 @@ com.google.code.findbugs jsr305 + + com.fasterxml.jackson.core + jackson-annotations + javax.servlet javax.servlet-api @@ -63,6 +67,19 @@ src/main/resources + + + + com.github.spotbugs + spotbugs-maven-plugin + ${spotbugs-maven-plugin.version} + + true + checks/spotbugs-exclude.xml + + + + diff --git a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/data/ExceptionContainer.java b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/data/ExceptionContainer.java deleted file mode 100644 index 80c7094c..00000000 --- a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/data/ExceptionContainer.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2017 Graz University of Technology EAAF-Core Components has been developed in a - * cooperation between EGIZ, A-SIT Plus, A-SIT, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European - * Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work except in - * compliance with the Licence. You may obtain a copy of the Licence at: - * https://joinup.ec.europa.eu/news/understanding-eupl-v12 - * - * Unless required by applicable law or agreed to in writing, software distributed under the Licence - * is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the Licence for the specific language governing permissions and limitations under - * the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text file for details on the - * various modules and licenses. The "NOTICE" text file is part of the distribution. Any derivative - * works that you distribute must include a readable copy of the "NOTICE" text file. -*/ - -package at.gv.egiz.eaaf.core.api.data; - -import java.io.Serializable; - -import at.gv.egiz.eaaf.core.api.IRequest; - -/** - * AuthProcess exception containter for Front-Channel exception handling. - * - * @author tlenz - * - */ -public class ExceptionContainer implements Serializable { - - private static final long serialVersionUID = 5355860753609684995L; - private Throwable exceptionThrown = null; - private IRequest pendingReq = null; - - /** - * Create an exception container. - * - * @param pendingReq Pending request that has an exception - * @param exception error - */ - public ExceptionContainer(final IRequest pendingReq, final Throwable exception) { - this.pendingReq = pendingReq; - this.exceptionThrown = exception; - - } - - /** - * Get the error. - * - * @return the exceptionThrown - */ - public Throwable getExceptionThrown() { - return this.exceptionThrown; - } - - public IRequest getPendingRequest() { - return this.pendingReq; - - } - - /** - * Get the unique sessionId for this error. - * - * @return the uniqueSessionID - */ - public String getUniqueSessionID() { - if (this.pendingReq != null) { - return this.pendingReq.getUniqueSessionIdentifier(); - } else { - return null; - } - } - - /** - * Get the unique transactionId for this error. - * - * @return the uniqueTransactionID - */ - public String getUniqueTransactionID() { - if (this.pendingReq != null) { - return this.pendingReq.getUniqueTransactionIdentifier(); - } else { - return null; - } - } - - /** - * Get the service-provider identifier. - * - * @return the uniqueServiceProviderId - */ - public String getUniqueServiceProviderId() { - if (this.pendingReq != null && this.pendingReq.getServiceProviderConfiguration() != null) { - return this.pendingReq.getServiceProviderConfiguration().getUniqueIdentifier(); - } else { - return null; - } - } - -} diff --git a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/exceptions/EaafAuthenticationException.java b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/exceptions/EaafAuthenticationException.java index 22c8a8ca..732834e1 100644 --- a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/exceptions/EaafAuthenticationException.java +++ b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/exceptions/EaafAuthenticationException.java @@ -19,10 +19,19 @@ package at.gv.egiz.eaaf.core.exceptions; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + public class EaafAuthenticationException extends EaafException { private static final long serialVersionUID = -4793625336456467005L; + @JsonCreator + public EaafAuthenticationException( + @JsonProperty("errorId") final String internalMsgId) { + super(internalMsgId); + } + public EaafAuthenticationException(final String internalMsgId, final Object[] params) { super(internalMsgId, params); diff --git a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/exceptions/EaafException.java b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/exceptions/EaafException.java index e1719abc..d2d42b31 100644 --- a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/exceptions/EaafException.java +++ b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/exceptions/EaafException.java @@ -23,15 +23,22 @@ import java.util.Arrays; import javax.annotation.Nullable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + import at.gv.egiz.eaaf.core.impl.logging.LogMessageProviderFactory; +import lombok.Setter; public class EaafException extends Exception { private static final long serialVersionUID = -4527097018108560426L; private String errorId = null; + + @Setter private Object[] params = null; - public EaafException(final String errorId) { + @JsonCreator + public EaafException(@JsonProperty("errorId") final String errorId) { super(LogMessageProviderFactory.getMessager().getMessage(errorId, null)); this.errorId = errorId; } diff --git a/eaaf_core_utils/checks/spotbugs-exclude.xml b/eaaf_core_utils/checks/spotbugs-exclude.xml index c1271f91..58ed1595 100644 --- a/eaaf_core_utils/checks/spotbugs-exclude.xml +++ b/eaaf_core_utils/checks/spotbugs-exclude.xml @@ -28,5 +28,12 @@ + + + + + + + \ No newline at end of file diff --git a/eaaf_core_utils/pom.xml b/eaaf_core_utils/pom.xml index d6743c8a..f8a39521 100644 --- a/eaaf_core_utils/pom.xml +++ b/eaaf_core_utils/pom.xml @@ -80,6 +80,21 @@ joda-time joda-time + + + com.fasterxml.jackson.core + jackson-core + provided + + + com.fasterxml.jackson.core + jackson-databind + provided + + + com.fasterxml.jackson.core + jackson-annotations + org.bitbucket.b_c diff --git a/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/data/ExceptionContainer.java b/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/data/ExceptionContainer.java new file mode 100644 index 00000000..cdb41147 --- /dev/null +++ b/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/data/ExceptionContainer.java @@ -0,0 +1,143 @@ +/* + * Copyright 2017 Graz University of Technology EAAF-Core Components has been developed in a + * cooperation between EGIZ, A-SIT Plus, A-SIT, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European + * Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work except in + * compliance with the Licence. You may obtain a copy of the Licence at: + * https://joinup.ec.europa.eu/news/understanding-eupl-v12 + * + * Unless required by applicable law or agreed to in writing, software distributed under the Licence + * is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the Licence for the specific language governing permissions and limitations under + * the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text file for details on the + * various modules and licenses. The "NOTICE" text file is part of the distribution. Any derivative + * works that you distribute must include a readable copy of the "NOTICE" text file. +*/ + +package at.gv.egiz.eaaf.core.impl.data; + +import java.io.Serializable; +import java.util.Collections; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +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.impl.json.EscapedJsonDeserializer; +import at.gv.egiz.eaaf.core.impl.json.EscapedJsonSerializer; +import at.gv.egiz.eaaf.core.impl.utils.EaafSerializationUtils; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +/** + * AuthProcess exception containter for Front-Channel exception handling. + * + * @author tlenz + * + */ +@Getter +@Setter +@NoArgsConstructor +public class ExceptionContainer implements Serializable { + + private static final long serialVersionUID = 5355860753609684995L; + + private static final Set> ALLOWED_CLASS_TYPES = Stream.of( + Throwable.class, StackTraceElement.class, StackTraceElement[].class, Collections.EMPTY_LIST.getClass()) + .collect(Collectors.toUnmodifiableSet()); + + /** + * Error that was thrown. + */ + private byte[] internalExceptionThrown = null; + + /** + * pendingReq that throws this error. + */ + @JsonTypeInfo(include = JsonTypeInfo.As.PROPERTY, use = JsonTypeInfo.Id.CLASS, property = "@class") + @JsonSerialize(using = EscapedJsonSerializer.class) + @JsonDeserialize(using = EscapedJsonDeserializer.class) + private IRequest pendingReq = null; + + /** + * Create an exception container. + * + * @param pendingReq Pending request that has an exception + * @param exception error + */ + public ExceptionContainer(final IRequest pendingReq, final Throwable exception) { + this.pendingReq = pendingReq; + this.internalExceptionThrown = EaafSerializationUtils.serialize(exception); + + } + + /** + * Get the exception that was thrown in this process. + * + * @return Processing error + */ + @JsonIgnore + public Throwable getExceptionThrown() { + return (Throwable) EaafSerializationUtils.typeSpecificDeserialize( + internalExceptionThrown, ALLOWED_CLASS_TYPES, Throwable.class); + + } + + @JsonIgnore + public IRequest getPendingRequest() { + return this.pendingReq; + + } + + /** + * Get the unique sessionId for this error. + * + * @return the uniqueSessionID + */ + @JsonIgnore + public String getUniqueSessionID() { + if (this.pendingReq != null) { + return this.pendingReq.getUniqueSessionIdentifier(); + } else { + return null; + } + } + + /** + * Get the unique transactionId for this error. + * + * @return the uniqueTransactionID + */ + @JsonIgnore + public String getUniqueTransactionID() { + if (this.pendingReq != null) { + return this.pendingReq.getUniqueTransactionIdentifier(); + } else { + return null; + } + } + + /** + * Get the service-provider identifier. + * + * @return the uniqueServiceProviderId + */ + @JsonIgnore + public String getUniqueServiceProviderId() { + if (this.pendingReq != null && this.pendingReq.getServiceProviderConfiguration() != null) { + return this.pendingReq.getServiceProviderConfiguration().getUniqueIdentifier(); + } else { + return null; + } + } + +} diff --git a/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/idp/conf/SpConfigurationImpl.java b/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/idp/conf/SpConfigurationImpl.java index 2f4e18fa..fa0fe7f5 100644 --- a/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/idp/conf/SpConfigurationImpl.java +++ b/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/idp/conf/SpConfigurationImpl.java @@ -25,23 +25,35 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import com.fasterxml.jackson.annotation.JsonIgnore; 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.idp.IConfiguration; import at.gv.egiz.eaaf.core.api.idp.ISpConfiguration; import at.gv.egiz.eaaf.core.impl.utils.KeyValueUtils; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.extern.slf4j.Slf4j; +@Slf4j +@NoArgsConstructor public class SpConfigurationImpl implements ISpConfiguration { private static final long serialVersionUID = 688541755446463453L; - private static final Logger log = LoggerFactory.getLogger(SpConfigurationImpl.class); - private final Map spConfiguration; - private final Set targetAreasWithNoInteralBaseIdRestriction; - private final Set targetAreasWithNoBaseIdTransmissionRestriction; + @Getter + @Setter + private Map spConfiguration; + + @Getter + @Setter + private Set targetAreasWithNoInteralBaseIdRestriction; + + @Getter + @Setter + private Set targetAreasWithNoBaseIdTransmissionRestriction; /** * Service-provider configuration holder. @@ -71,12 +83,14 @@ public class SpConfigurationImpl implements ISpConfiguration { } } + @JsonIgnore @Override public final Map getFullConfiguration() { return this.spConfiguration; } + @JsonIgnore @Override public final String getConfigurationValue(final String key) { if (key == null) { @@ -87,6 +101,7 @@ public class SpConfigurationImpl implements ISpConfiguration { } + @JsonIgnore @Override public final String getConfigurationValue(final String key, final String defaultValue) { final String value = getConfigurationValue(key); @@ -97,12 +112,14 @@ public class SpConfigurationImpl implements ISpConfiguration { } } + @JsonIgnore @Override public final boolean isConfigurationValue(final String key) { return isConfigurationValue(key, false); } + @JsonIgnore @Override public final boolean isConfigurationValue(final String key, final boolean defaultValue) { final String value = getConfigurationValue(key); @@ -114,6 +131,7 @@ public class SpConfigurationImpl implements ISpConfiguration { return defaultValue; } + @JsonIgnore @Override public final boolean containsConfigurationKey(final String key) { if (key == null) { @@ -124,6 +142,7 @@ public class SpConfigurationImpl implements ISpConfiguration { } + @JsonIgnore @Override public String getUniqueIdentifier() { return getConfigurationValue(EaafConfigConstants.SERVICE_UNIQUEIDENTIFIER); @@ -142,16 +161,19 @@ public class SpConfigurationImpl implements ISpConfiguration { } + @JsonIgnore @Override public final Set getTargetsWithNoBaseIdInternalProcessingRestriction() { return this.targetAreasWithNoInteralBaseIdRestriction; } + @JsonIgnore @Override public final Set getTargetsWithNoBaseIdTransferRestriction() { return this.targetAreasWithNoBaseIdTransmissionRestriction; } + @JsonIgnore @Override public List getRequiredLoA() { log.warn( @@ -159,6 +181,7 @@ public class SpConfigurationImpl implements ISpConfiguration { return null; } + @JsonIgnore @Override public String getLoAMatchingMode() { log.warn("Method not implemented: " + SpConfigurationImpl.class.getName() @@ -166,6 +189,7 @@ public class SpConfigurationImpl implements ISpConfiguration { return null; } + @JsonIgnore @Override public String getAreaSpecificTargetIdentifier() { log.warn("Method not implemented: " + SpConfigurationImpl.class.getName() @@ -173,6 +197,7 @@ public class SpConfigurationImpl implements ISpConfiguration { return null; } + @JsonIgnore @Override public String getFriendlyName() { log.warn( diff --git a/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/exceptions/SL20Exception.java b/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/exceptions/SL20Exception.java index 08373a2d..2f01a0b9 100644 --- a/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/exceptions/SL20Exception.java +++ b/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/exceptions/SL20Exception.java @@ -1,11 +1,19 @@ package at.gv.egiz.eaaf.modules.auth.sl20.exceptions; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + import at.gv.egiz.eaaf.core.exceptions.EaafAuthenticationException; public class SL20Exception extends EaafAuthenticationException { private static final long serialVersionUID = -6716465236880571576L; + @JsonCreator + public SL20Exception(@JsonProperty("errorId") final String messageId) { + super(messageId); + } + public SL20Exception(final String messageId, final Object[] parameters) { super(messageId, parameters); diff --git a/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/exceptions/SlCommandoParserException.java b/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/exceptions/SlCommandoParserException.java index 4993796a..307507cf 100644 --- a/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/exceptions/SlCommandoParserException.java +++ b/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/exceptions/SlCommandoParserException.java @@ -4,6 +4,11 @@ public class SlCommandoParserException extends SL20Exception { private static final long serialVersionUID = 1L; + public SlCommandoParserException() { + super("sl20.02", null); + + } + public SlCommandoParserException(final String msg) { super("sl20.02", new Object[] { msg }); diff --git a/pom.xml b/pom.xml index d06c8f10..784350ba 100644 --- a/pom.xml +++ b/pom.xml @@ -664,7 +664,12 @@ com.fasterxml.jackson.module jackson-module-parameter-names ${com.fasterxml.jackson.core.version} - + + + com.fasterxml.jackson.core + jackson-annotations + ${com.fasterxml.jackson.core.version} + com.google.code.gson -- cgit v1.2.3