summaryrefslogtreecommitdiff
path: root/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/protocols/RequestImpl.java
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2019-12-04 19:43:32 +0100
committerThomas Lenz <thomas.lenz@egiz.gv.at>2019-12-04 19:43:32 +0100
commit759ac5f42c6aff901dbeede4fbf1a1d2e08cad0f (patch)
tree2132024fc058b1ef5338bf50df575a3244cc3f9f /eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/protocols/RequestImpl.java
parent4f15bdc45b08724d20c66c9fd74ea6a43a03c32f (diff)
downloadEAAF-Components-759ac5f42c6aff901dbeede4fbf1a1d2e08cad0f.tar.gz
EAAF-Components-759ac5f42c6aff901dbeede4fbf1a1d2e08cad0f.tar.bz2
EAAF-Components-759ac5f42c6aff901dbeede4fbf1a1d2e08cad0f.zip
common EGIZ code-style refactoring
Diffstat (limited to 'eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/protocols/RequestImpl.java')
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/protocols/RequestImpl.java920
1 files changed, 464 insertions, 456 deletions
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 722a9304..ac0876c4 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
@@ -1,29 +1,22 @@
-/*******************************************************************************
- * 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.
+/*
+ * 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:
+ * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
+ * 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.idp.controller.protocols;
import java.io.Serializable;
@@ -35,444 +28,459 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.UUID;
-
+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 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;
import at.gv.egiz.eaaf.core.api.idp.IConfigurationWithSP;
-import at.gv.egiz.eaaf.core.api.idp.ISPConfiguration;
-import at.gv.egiz.eaaf.core.exceptions.EAAFAuthenticationException;
-import at.gv.egiz.eaaf.core.exceptions.EAAFException;
-import at.gv.egiz.eaaf.core.exceptions.EAAFStorageException;
+import at.gv.egiz.eaaf.core.api.idp.IspConfiguration;
+import at.gv.egiz.eaaf.core.exceptions.EaafAuthenticationException;
+import at.gv.egiz.eaaf.core.exceptions.EaafException;
+import at.gv.egiz.eaaf.core.exceptions.EaafStorageException;
import at.gv.egiz.eaaf.core.impl.idp.auth.data.AuthProcessDataWrapper;
-import at.gv.egiz.eaaf.core.impl.utils.HTTPUtils;
+import at.gv.egiz.eaaf.core.impl.utils.HttpUtils;
import at.gv.egiz.eaaf.core.impl.utils.Random;
-import at.gv.egiz.eaaf.core.impl.utils.TransactionIDUtils;
-
-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 long serialVersionUID = 1L;
-
- private String module = null;
- private String action = null;
-
- private String pendingRequestId = null;
- private String processInstanceId;
- private String internalSSOSessionId;
-
- private String uniqueTransactionIdentifer;
- private String uniqueSessionIdentifer;
-
- private String requestedServiceProviderIdentifer;
- private String idpAuthURL = null;
-
- private ISPConfiguration spConfiguration = null;
-
- private boolean passiv = false;
- private boolean force = false;
- private boolean isAbortedByUser = false;
-
- //every request needs authentication by default
- private boolean needAuthentication = true;
-
- //every request is not authenticated by default
- private boolean isAuthenticated = false;
-
- //every request needs no SSO by default
- private boolean needSSO = false;
-
- private boolean needUserConsent = false;
-
- private final Map<String, Object> genericDataStorage = new HashMap<String, Object>();
-
-
- /**
- * Initialize this pendingRequest object
- *
- * @param req {@link HttpServletRequest}
- * @param authConfig {@link IConfiguration}
- * @throws EAAFException
- *
- */
- public final void initialize(HttpServletRequest req, IConfigurationWithSP authConfig) throws EAAFException {
- initialize(req, authConfig, null);
-
- }
-
- /**
- * Initialize this pendingRequest object
- *
- * @param req {@link HttpServletRequest}
- * @param authConfig {@link IConfiguration}
- * @param transactionId transactionId that should be used in this pendingRequest for logging. If 'null' a new one will be generated
- *
- * @throws EAAFException
- *
- */
- public final void initialize(@NonNull HttpServletRequest req, @NonNull IConfigurationWithSP authConfig, @Nullable String transactionId) throws EAAFException {
- //use external transactionId or create new one if empty or null
- if (StringUtils.isNotEmpty(transactionId))
- uniqueTransactionIdentifer = transactionId;
- else
- uniqueTransactionIdentifer = Random.nextLongRandom();
-
- //set unique transaction identifier for logging
- TransactionIDUtils.setTransactionId(uniqueTransactionIdentifer);
-
- //initialize session object
- genericDataStorage.put(EAAFConstants.AUTH_DATA_CREATED, new Date());
- //genericDataStorage.put(EAAFConstants.VALUE_SESSIONID, Random.nextLongRandom());
-
- //check if End-Point is valid
- final String authURLString = HTTPUtils.extractAuthURLFromRequest(req);
- URL authReqURL;
- try {
- authReqURL = new URL(authURLString);
-
- } catch (final MalformedURLException e) {
- log.error("IDP AuthenticationServiceURL Prefix is not a valid URL." + authURLString, e);
- throw new EAAFAuthenticationException("errorId", new Object[]{authURLString}, e);
-
- }
- this.idpAuthURL = authConfig.validateIDPURL(authReqURL);
- if (this.idpAuthURL == null) {
- log.warn("Extract AuthenticationServiceURL: " + authReqURL + " is NOT found in configuration.");
- throw new EAAFAuthenticationException("errorId", new Object[]{authURLString});
-
- }
-
- //set unique session identifier
- final String uniqueID = (String) req.getAttribute(EAAFConstants.UNIQUESESSIONIDENTIFIER);
- if (StringUtils.isNotEmpty(uniqueID))
- this.uniqueSessionIdentifer = uniqueID;
-
- else {
- log.debug("Create new sessionIdentifier for this pendingRequest ... ");
- this.uniqueSessionIdentifer = UUID.randomUUID().toString();
-
- }
-
- //set requester's IP address
- try {
- setRawDataToTransaction(DATAID_REQUESTER_IP_ADDRESS, req.getRemoteAddr());
-
- } catch (final EAAFStorageException e) {
- log.info("Can NOT store remote IP address into 'pendingRequest'." , e);
-
- }
-
- }
-
- public final void setSPEntityId(String spIdentifier) {
- this.requestedServiceProviderIdentifer = spIdentifier;
- }
-
- @Override
- public final String getSPEntityId() {
- return this.requestedServiceProviderIdentifer;
- }
-
- @Override
- public final boolean isPassiv() {
- return passiv;
- }
-
- @Override
- public final boolean forceAuth() {
- return force;
- }
-
- public final void setPassiv(boolean passiv) {
- this.passiv = passiv;
- }
-
- public final void setForce(boolean force) {
- this.force = force;
- }
-
- @Override
- public final String requestedAction() {
- return action;
- }
-
- public final void setAction(String action) {
- this.action = action;
- }
-
- @Override
- public final String requestedModule() {
- return module;
- }
-
- public final void setModule(String module) {
- this.module = module;
- }
-
- public final void setPendingRequestId(String pendingReqId) {
- this.pendingRequestId = pendingReqId;
-
- }
-
- @Override
- @NonNull
- public final String getPendingRequestId() {
- if (pendingRequestId == null)
- throw new IllegalStateException("No PendingRequestId set!!!");
-
- return pendingRequestId;
- }
-
- @Override
- public final String getInternalSSOSessionIdentifier() {
- return this.internalSSOSessionId;
- }
-
- @Override
- public final void setInternalSSOSessionIdentifier(String internalSSOSessionId) {
- this.internalSSOSessionId = internalSSOSessionId;
-
- }
-
- @Override
- public final <T> T getSessionData(final Class<T> wrapper) {
- if (wrapper != null) {
- if (AuthProcessDataWrapper.class.isAssignableFrom(wrapper)) {
- try {
- return wrapper.getConstructor(Map.class).newInstance(this.genericDataStorage);
-
- } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException
- | IllegalArgumentException | InvocationTargetException e) {
- log.error("Can NOT instance wrapper: " + wrapper.getName(), e);
-
- }
-
- }
-
- log.error("Can NOT wrap generic data into session data. "
- + "Reason: Wrapper " + wrapper.getName() + " is NOT a valid wrapper");
- throw new RuntimeException("Can NOT wrap generic data into session data. "
- + "Reason: Wrapper " + wrapper.getName() + " is NOT a valid wrapper");
-
- }
-
- return null;
-
- }
-
- @Override
- public final ISPConfiguration getServiceProviderConfiguration() {
- return this.spConfiguration;
-
-
- }
-
- @Override
- public <T> T getServiceProviderConfiguration(final Class<T> decorator) {
- if (this.spConfiguration != null) {
- if (decorator.isAssignableFrom(this.spConfiguration.getClass())) {
- return (T) this.spConfiguration;
-
- } else
- log.error("Can not decorate SP configuration by '" + decorator.getName() + "'.");
- throw new RuntimeException("Can not decorate SP configuration by '" + decorator.getName() + "'.");
-
- }
-
- return null;
-
- }
-
- public void setOnlineApplicationConfiguration(ISPConfiguration spConfig) {
- this.spConfiguration = spConfig;
-
- }
-
- @Override
- public final String getUniqueTransactionIdentifier() {
- return this.uniqueTransactionIdentifer;
-
- }
-
- @Override
- public final String getUniqueSessionIdentifier() {
- return this.uniqueSessionIdentifer;
-
- }
-
- @Override
- public final String getProcessInstanceId() {
- return this.processInstanceId;
-
- }
-
- public final void setUniqueTransactionIdentifier(String id) {
- this.uniqueTransactionIdentifer = id;
-
- }
-
- public final void setUniqueSessionIdentifier(String id) {
- this.uniqueSessionIdentifer = id;
-
- }
-
- public void setProcessInstanceId(String id) {
- this.processInstanceId = id;
-
- }
-
- @Override
- public final String getAuthURL() {
- return this.idpAuthURL;
- }
-
- @Override
- public final String getAuthURLWithOutSlash() {
- if (this.idpAuthURL.endsWith("/"))
- return this.idpAuthURL.substring(0, this.idpAuthURL.length()-1);
- else
- return this.idpAuthURL;
-
- }
-
- @Override
- public final boolean isNeedAuthentication() {
- return needAuthentication;
- }
-
- public final void setNeedAuthentication(boolean needAuthentication) {
- this.needAuthentication = needAuthentication;
- }
-
- @Override
- public final boolean isAuthenticated() {
- return isAuthenticated;
- }
-
- @Override
- public final void setAuthenticated(boolean isAuthenticated) {
- this.isAuthenticated = isAuthenticated;
- }
-
- @Override
- public final boolean needSingleSignOnFunctionality() {
- return needSSO;
- }
- @Override
- public final void setNeedSingleSignOnFunctionality(boolean needSSO) {
- this.needSSO = needSSO;
-
- }
-
- @Override
- public final boolean isNeedUserConsent() {
- return this.needUserConsent;
-
- }
-
- @Override
- public final void setNeedUserConsent(boolean needConsent) {
- this.needUserConsent = needConsent;
-
- }
-
- @Override
- public final boolean isAbortedByUser() {
- return this.isAbortedByUser;
- }
-
- @Override
- public final void setAbortedByUser(boolean isAborted) {
- this.isAbortedByUser = isAborted;
-
- }
-
- @Override
- public final Object getRawData(String key) {
- if (StringUtils.isNotEmpty(key)) {
- return genericDataStorage.get(key);
-
- }
-
- log.info("Can not load generic request-data with key='null'");
- return null;
- }
-
- @Override
- public final <T> T getRawData(String key, final Class<T> clazz) {
- if (StringUtils.isNotEmpty(key)) {
- final Object data = genericDataStorage.get(key);
-
- if (data == null)
- return null;
-
- try {
- @SuppressWarnings("unchecked")
- final
- T test = (T) data;
- return test;
-
- } catch (final Exception e) {
- log.warn("Generic request-data object can not be casted to requested type", e);
- return null;
-
- }
-
- }
-
- log.info("Can not load generic request-data with key='null'");
- return null;
-
- }
-
- @Override
- public final void setRawDataToTransaction(String key, Object object) throws EAAFStorageException {
- if (StringUtils.isEmpty(key)) {
- log.info("Generic request-data can not be stored with a 'null' key");
- throw new EAAFStorageException("Generic request-data can not be stored with a 'null' key", null);
-
- }
-
- if (object != null) {
- if (!Serializable.class.isInstance(object)) {
- log.warn("Generic request-data can only store objects which implements the 'Seralizable' interface");
- throw new EAAFStorageException("Generic request-data can only store objects which implements the 'Seralizable' interface", null);
-
- }
- }
-
- if (genericDataStorage.containsKey(key))
- log.trace("Overwrite generic request-data with key:" + key);
- else
- log.trace("Add generic request-data with key:" + key + " to session.");
-
- genericDataStorage.put(key, object);
-
- }
-
- @Override
- public final void setRawDataToTransaction(Map<String, Object> map) throws EAAFStorageException {
- if (map == null) {
- log.info("Generic request-data can not be stored with a 'null' map");
- throw new EAAFStorageException("Generic request-data can not be stored with a 'null' map", null);
-
- }
-
- //validate and store values
- for (final Entry<String, Object> el : map.entrySet())
- setRawDataToTransaction(el.getKey(), el.getValue());
-
- }
-
+import at.gv.egiz.eaaf.core.impl.utils.TransactionIdUtils;
+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;
+
+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 long serialVersionUID = 1L;
+
+ private String module = null;
+ private String action = null;
+
+ private String pendingRequestId = null;
+ private String processInstanceId;
+ private String internalSsoSessionId;
+
+ private String uniqueTransactionIdentifer;
+ private String uniqueSessionIdentifer;
+
+ private String requestedServiceProviderIdentifer;
+ private String idpAuthUrl = null;
+
+ private IspConfiguration spConfiguration = null;
+
+ private boolean passiv = false;
+ private boolean force = false;
+ private boolean isAbortedByUser = false;
+
+ // every request needs authentication by default
+ private boolean needAuthentication = true;
+
+ // every request is not authenticated by default
+ private boolean isAuthenticated = false;
+
+ // every request needs no SSO by default
+ private boolean needSso = false;
+
+ private boolean needUserConsent = false;
+
+ private final Map<String, Object> genericDataStorage = new HashMap<>();
+
+
+ /**
+ * Initialize this pendingRequest object.
+ *
+ * @param req {@link HttpServletRequest}
+ * @param authConfig {@link IConfiguration}
+ * @throws EaafException
+ *
+ */
+ public final void initialize(final HttpServletRequest req, final IConfigurationWithSP authConfig)
+ throws EaafException {
+ initialize(req, authConfig, null);
+
+ }
+
+ /**
+ * Initialize this pendingRequest object.
+ *
+ * @param req {@link HttpServletRequest}
+ * @param authConfig {@link IConfiguration}
+ * @param transactionId transactionId that should be used in this pendingRequest for logging. If
+ * 'null' a new one will be generated
+ *
+ * @throws EaafException
+ *
+ */
+ public final void initialize(@NonNull final HttpServletRequest req,
+ @NonNull final IConfigurationWithSP authConfig, @Nullable final String transactionId)
+ throws EaafException {
+ // use external transactionId or create new one if empty or null
+ if (StringUtils.isNotEmpty(transactionId)) {
+ uniqueTransactionIdentifer = transactionId;
+ } else {
+ uniqueTransactionIdentifer = Random.nextLongRandom();
+ }
+
+ // set unique transaction identifier for logging
+ TransactionIdUtils.setTransactionId(uniqueTransactionIdentifer);
+
+ // initialize session object
+ genericDataStorage.put(EAAFConstants.AUTH_DATA_CREATED, new Date());
+ // genericDataStorage.put(EAAFConstants.VALUE_SESSIONID, Random.nextLongRandom());
+
+ // check if End-Point is valid
+ final String authUrlString = HttpUtils.extractAuthUrlFromRequest(req);
+ URL authReqUrl;
+ try {
+ authReqUrl = new URL(authUrlString);
+
+ } catch (final MalformedURLException e) {
+ log.error("IDP AuthenticationServiceURL Prefix is not a valid URL." + authUrlString, e);
+ throw new EaafAuthenticationException("errorId", new Object[] {authUrlString}, e);
+
+ }
+ this.idpAuthUrl = authConfig.validateIdpUrl(authReqUrl);
+ if (this.idpAuthUrl == null) {
+ log.warn(
+ "Extract AuthenticationServiceURL: " + authReqUrl + " is NOT found in configuration.");
+ throw new EaafAuthenticationException("errorId", new Object[] {authUrlString});
+
+ }
+
+ // set unique session identifier
+ final String uniqueID = (String) req.getAttribute(EAAFConstants.UNIQUESESSIONIDENTIFIER);
+ if (StringUtils.isNotEmpty(uniqueID)) {
+ this.uniqueSessionIdentifer = uniqueID;
+ } else {
+ log.debug("Create new sessionIdentifier for this pendingRequest ... ");
+ this.uniqueSessionIdentifer = UUID.randomUUID().toString();
+
+ }
+
+ // set requester's IP address
+ try {
+ setRawDataToTransaction(DATAID_REQUESTER_IP_ADDRESS, req.getRemoteAddr());
+
+ } catch (final EaafStorageException e) {
+ log.info("Can NOT store remote IP address into 'pendingRequest'.", e);
+
+ }
+
+ }
+
+ public final void setSpEntityId(final String spIdentifier) {
+ this.requestedServiceProviderIdentifer = spIdentifier;
+ }
+
+ @Override
+ public final String getSpEntityId() {
+ return this.requestedServiceProviderIdentifer;
+ }
+
+ @Override
+ public final boolean isPassiv() {
+ return passiv;
+ }
+
+ @Override
+ public final boolean forceAuth() {
+ return force;
+ }
+
+ public final void setPassiv(final boolean passiv) {
+ this.passiv = passiv;
+ }
+
+ public final void setForce(final boolean force) {
+ this.force = force;
+ }
+
+ @Override
+ public final String requestedAction() {
+ return action;
+ }
+
+ public final void setAction(final String action) {
+ this.action = action;
+ }
+
+ @Override
+ public final String requestedModule() {
+ return module;
+ }
+
+ public final void setModule(final String module) {
+ this.module = module;
+ }
+
+ public final void setPendingRequestId(final String pendingReqId) {
+ this.pendingRequestId = pendingReqId;
+
+ }
+
+ @Override
+ @NonNull
+ public final String getPendingRequestId() {
+ if (pendingRequestId == null) {
+ throw new IllegalStateException("No PendingRequestId set!!!");
+ }
+
+ return pendingRequestId;
+ }
+
+ @Override
+ public final String getInternalSsoSessionIdentifier() {
+ return this.internalSsoSessionId;
+ }
+
+ @Override
+ public final void setInternalSsoSessionIdentifier(final String internalSsoSessionId) {
+ this.internalSsoSessionId = internalSsoSessionId;
+
+ }
+
+ @Override
+ @Nonnull
+ public final <T> T getSessionData(@Nonnull final Class<T> wrapper) {
+ Assert.notNull(wrapper, "Wrapper must NOT null");
+ if (AuthProcessDataWrapper.class.isAssignableFrom(wrapper)) {
+ try {
+ return wrapper.getConstructor(Map.class).newInstance(this.genericDataStorage);
+
+ } catch (NoSuchMethodException | SecurityException | InstantiationException
+ | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+ log.error("Can NOT instance wrapper: " + wrapper.getName(), e);
+
+ }
+
+ }
+
+ log.error("Can NOT wrap generic data into session data. " + "Reason: Wrapper "
+ + wrapper.getName() + " is NOT a valid wrapper");
+ throw new RuntimeException("Can NOT wrap generic data into session data. " + "Reason: Wrapper "
+ + wrapper.getName() + " is NOT a valid wrapper");
+
+ }
+
+ @Override
+ public final IspConfiguration getServiceProviderConfiguration() {
+ return this.spConfiguration;
+
+
+ }
+
+ @Override
+ public <T> T getServiceProviderConfiguration(final Class<T> decorator) {
+ if (this.spConfiguration != null) {
+ if (decorator.isAssignableFrom(this.spConfiguration.getClass())) {
+ return (T) this.spConfiguration;
+
+ } else {
+ log.error("Can not decorate SP configuration by '" + decorator.getName() + "'.");
+ }
+ throw new RuntimeException(
+ "Can not decorate SP configuration by '" + decorator.getName() + "'.");
+
+ }
+
+ return null;
+
+ }
+
+ public void setOnlineApplicationConfiguration(final IspConfiguration spConfig) {
+ this.spConfiguration = spConfig;
+
+ }
+
+ @Override
+ public final String getUniqueTransactionIdentifier() {
+ return this.uniqueTransactionIdentifer;
+
+ }
+
+ @Override
+ public final String getUniqueSessionIdentifier() {
+ return this.uniqueSessionIdentifer;
+
+ }
+
+ @Override
+ public final String getProcessInstanceId() {
+ return this.processInstanceId;
+
+ }
+
+ public final void setUniqueTransactionIdentifier(final String id) {
+ this.uniqueTransactionIdentifer = id;
+
+ }
+
+ public final void setUniqueSessionIdentifier(final String id) {
+ this.uniqueSessionIdentifer = id;
+
+ }
+
+ public void setProcessInstanceId(final String id) {
+ this.processInstanceId = id;
+
+ }
+
+ @Override
+ public final String getAuthUrl() {
+ return this.idpAuthUrl;
+ }
+
+ @Override
+ public final String getAuthUrlWithOutSlash() {
+ if (this.idpAuthUrl.endsWith("/")) {
+ return this.idpAuthUrl.substring(0, this.idpAuthUrl.length() - 1);
+ } else {
+ return this.idpAuthUrl;
+ }
+
+ }
+
+ @Override
+ public final boolean isNeedAuthentication() {
+ return needAuthentication;
+ }
+
+ public final void setNeedAuthentication(final boolean needAuthentication) {
+ this.needAuthentication = needAuthentication;
+ }
+
+ @Override
+ public final boolean isAuthenticated() {
+ return isAuthenticated;
+ }
+
+ @Override
+ public final void setAuthenticated(final boolean isAuthenticated) {
+ this.isAuthenticated = isAuthenticated;
+ }
+
+ @Override
+ public final boolean needSingleSignOnFunctionality() {
+ return needSso;
+ }
+
+ @Override
+ public final void setNeedSingleSignOnFunctionality(final boolean needSso) {
+ this.needSso = needSso;
+
+ }
+
+ @Override
+ public final boolean isNeedUserConsent() {
+ return this.needUserConsent;
+
+ }
+
+ @Override
+ public final void setNeedUserConsent(final boolean needConsent) {
+ this.needUserConsent = needConsent;
+
+ }
+
+ @Override
+ public final boolean isAbortedByUser() {
+ return this.isAbortedByUser;
+ }
+
+ @Override
+ public final void setAbortedByUser(final boolean isAborted) {
+ this.isAbortedByUser = isAborted;
+
+ }
+
+ @Override
+ public final Object getRawData(final String key) {
+ if (StringUtils.isNotEmpty(key)) {
+ return genericDataStorage.get(key);
+
+ }
+
+ log.info("Can not load generic request-data with key='null'");
+ return null;
+ }
+
+ @Override
+ public final <T> T getRawData(final String key, final Class<T> clazz) {
+ if (StringUtils.isNotEmpty(key)) {
+ final Object data = genericDataStorage.get(key);
+
+ if (data == null) {
+ return null;
+ }
+
+ try {
+ @SuppressWarnings("unchecked")
+ final T test = (T) data;
+ return test;
+
+ } catch (final Exception e) {
+ log.warn("Generic request-data object can not be casted to requested type", e);
+ return null;
+
+ }
+
+ }
+
+ log.info("Can not load generic request-data with key='null'");
+ return null;
+
+ }
+
+ @Override
+ public final void setRawDataToTransaction(final String key, final Object object)
+ throws EaafStorageException {
+ if (StringUtils.isEmpty(key)) {
+ log.info("Generic request-data can not be stored with a 'null' key");
+ throw new EaafStorageException("Generic request-data can not be stored with a 'null' key",
+ null);
+
+ }
+
+ if (object != null) {
+ if (!Serializable.class.isInstance(object)) {
+ log.warn(
+ "Generic request-data can only store objects which implements the 'Seralizable' interface");
+ throw new EaafStorageException(
+ "Generic request-data can only store objects which implements the 'Seralizable' interface",
+ null);
+
+ }
+ }
+
+ if (genericDataStorage.containsKey(key)) {
+ log.trace("Overwrite generic request-data with key:" + key);
+ } else {
+ log.trace("Add generic request-data with key:" + key + " to session.");
+ }
+
+ genericDataStorage.put(key, object);
+
+ }
+
+ @Override
+ public final void setRawDataToTransaction(final Map<String, Object> map)
+ throws EaafStorageException {
+ if (map == null) {
+ log.info("Generic request-data can not be stored with a 'null' map");
+ throw new EaafStorageException("Generic request-data can not be stored with a 'null' map",
+ null);
+
+ }
+
+ // validate and store values
+ for (final Entry<String, Object> el : map.entrySet()) {
+ setRawDataToTransaction(el.getKey(), el.getValue());
+ }
+
+ }
+
}