diff options
Diffstat (limited to 'eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module')
5 files changed, 523 insertions, 485 deletions
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummyConfiguration.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummyConfiguration.java index 816f6871..185e1d27 100644 --- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummyConfiguration.java +++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummyConfiguration.java @@ -3,82 +3,83 @@ package at.gv.egiz.eaaf.core.impl.idp.module.test; import java.net.URI; import java.net.URL; import java.util.Map; - 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.EAAFConfigurationException; -import at.gv.egiz.eaaf.core.exceptions.EAAFException; +import at.gv.egiz.eaaf.core.api.idp.IspConfiguration; +import at.gv.egiz.eaaf.core.exceptions.EaafConfigurationException; +import at.gv.egiz.eaaf.core.exceptions.EaafException; import at.gv.egiz.eaaf.core.impl.idp.auth.builder.AbstractAuthenticationDataBuilder; public class DummyConfiguration implements IConfigurationWithSP { - private Boolean isIDLEscapingEnabled = null; - - @Override - public String getBasicConfiguration(String key) { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getBasicConfiguration(String key, String defaultValue) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Map<String, String> getBasicConfigurationWithPrefix(String prefix) { - // TODO Auto-generated method stub - return null; - } - - @Override - public ISPConfiguration getServiceProviderConfiguration(String uniqueID) throws EAAFConfigurationException { - // TODO Auto-generated method stub - return null; - } - - @Override - public <T> T getServiceProviderConfiguration(String spIdentifier, Class<T> decorator) - throws EAAFConfigurationException { - // TODO Auto-generated method stub - return null; - } - - @Override - public URI getConfigurationRootDirectory() { - // TODO Auto-generated method stub - return null; - } - - @Override - public String validateIDPURL(URL authReqUrl) throws EAAFException { - // TODO Auto-generated method stub - return null; - } - - public void setIsIDLEscapingEnabled(Boolean isIDLEscapingEnabled) { - this.isIDLEscapingEnabled = isIDLEscapingEnabled; - } - - @Override - public Boolean getBasicConfigurationBoolean(String key) { - return null; - - } - - @Override - public boolean getBasicConfigurationBoolean(String key, boolean defaultValue) { - if (AbstractAuthenticationDataBuilder.CONFIG_PROP_ENABLE_IDL_ATTRIBUTE_ESCAPEING.equals(key)) { - if (isIDLEscapingEnabled == null) - return defaultValue; - else - return isIDLEscapingEnabled; - - } - - - return false; - - } + private Boolean isIdlEscapingEnabled = null; + + @Override + public String getBasicConfiguration(final String key) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getBasicConfiguration(final String key, final String defaultValue) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Map<String, String> getBasicConfigurationWithPrefix(final String prefix) { + // TODO Auto-generated method stub + return null; + } + + @Override + public IspConfiguration getServiceProviderConfiguration(final String uniqueID) + throws EaafConfigurationException { + // TODO Auto-generated method stub + return null; + } + + @Override + public <T> T getServiceProviderConfiguration(final String spIdentifier, final Class<T> decorator) + throws EaafConfigurationException { + // TODO Auto-generated method stub + return null; + } + + @Override + public URI getConfigurationRootDirectory() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String validateIdpUrl(final URL authReqUrl) throws EaafException { + // TODO Auto-generated method stub + return null; + } + + public void setIsIdlEscapingEnabled(final Boolean isIdlEscapingEnabled) { + this.isIdlEscapingEnabled = isIdlEscapingEnabled; + } + + @Override + public boolean getBasicConfigurationBoolean(final String key) { + return false; + + } + + @Override + public boolean getBasicConfigurationBoolean(final String key, final boolean defaultValue) { + if (AbstractAuthenticationDataBuilder.CONFIG_PROP_ENABLE_IDL_ATTRIBUTE_ESCAPEING.equals(key)) { + if (isIdlEscapingEnabled == null) { + return defaultValue; + } else { + return isIdlEscapingEnabled; + } + + } + + + return false; + + } } diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummyProtocolAuthService.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummyProtocolAuthService.java index 94209dd6..87f2bcb6 100644 --- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummyProtocolAuthService.java +++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummyProtocolAuthService.java @@ -7,75 +7,77 @@ import javax.servlet.http.HttpServletResponse; import at.gv.egiz.eaaf.core.api.IRequest; import at.gv.egiz.eaaf.core.api.idp.auth.services.IProtocolAuthenticationService; -import at.gv.egiz.eaaf.core.exceptions.EAAFException; +import at.gv.egiz.eaaf.core.exceptions.EaafException; public class DummyProtocolAuthService implements IProtocolAuthenticationService { - - private IRequest pendingReq; - private HttpServletRequest httpReq; - private HttpServletResponse httpResp; - private Throwable exception; - private boolean writeToStatisticLog; - - - @Override - public void performAuthentication(HttpServletRequest req, HttpServletResponse resp, IRequest pendingReq) - throws IOException, EAAFException { - this.pendingReq = pendingReq; - this.httpReq = req; - this.httpResp = resp; - - } - - @Override - public void finalizeAuthentication(HttpServletRequest req, HttpServletResponse resp, IRequest pendingReq) - throws EAAFException, IOException { - this.pendingReq = pendingReq; - this.httpReq = req; - this.httpResp = resp; - - } - - @Override - public void buildProtocolSpecificErrorResponse(Throwable throwable, HttpServletRequest req, - HttpServletResponse resp, IRequest pendingReq) throws IOException, EAAFException { - this.pendingReq = pendingReq; - this.httpReq = req; - this.httpResp = resp; - this.exception = throwable; - - } - - @Override - public void handleErrorNoRedirect(Throwable throwable, HttpServletRequest req, HttpServletResponse resp, - boolean writeExceptionToStatisticLog) throws IOException, EAAFException { - this.httpReq = req; - this.httpResp = resp; - this.exception = throwable; - this.writeToStatisticLog = writeExceptionToStatisticLog; - - } - - public IRequest getPendingReq() { - return pendingReq; - } - - public HttpServletRequest getHttpReq() { - return httpReq; - } - - public HttpServletResponse getHttpResp() { - return httpResp; - } - - public Throwable getException() { - return exception; - } - - public boolean isWriteToStatisticLog() { - return writeToStatisticLog; - } - - + + private IRequest pendingReq; + private HttpServletRequest httpReq; + private HttpServletResponse httpResp; + private Throwable exception; + private boolean writeToStatisticLog; + + + @Override + public void performAuthentication(final HttpServletRequest req, final HttpServletResponse resp, + final IRequest pendingReq) throws IOException, EaafException { + this.pendingReq = pendingReq; + this.httpReq = req; + this.httpResp = resp; + + } + + @Override + public void finalizeAuthentication(final HttpServletRequest req, final HttpServletResponse resp, + final IRequest pendingReq) throws EaafException, IOException { + this.pendingReq = pendingReq; + this.httpReq = req; + this.httpResp = resp; + + } + + @Override + public void buildProtocolSpecificErrorResponse(final Throwable throwable, + final HttpServletRequest req, final HttpServletResponse resp, final IRequest pendingReq) + throws IOException, EaafException { + this.pendingReq = pendingReq; + this.httpReq = req; + this.httpResp = resp; + this.exception = throwable; + + } + + @Override + public void handleErrorNoRedirect(final Throwable throwable, final HttpServletRequest req, + final HttpServletResponse resp, final boolean writeExceptionToStatisticLog) + throws IOException, EaafException { + this.httpReq = req; + this.httpResp = resp; + this.exception = throwable; + this.writeToStatisticLog = writeExceptionToStatisticLog; + + } + + public IRequest getPendingReq() { + return pendingReq; + } + + public HttpServletRequest getHttpReq() { + return httpReq; + } + + public HttpServletResponse getHttpResp() { + return httpResp; + } + + public Throwable getException() { + return exception; + } + + public boolean isWriteToStatisticLog() { + return writeToStatisticLog; + } + + } diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummySPConfiguration.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummySPConfiguration.java deleted file mode 100644 index f51c95ab..00000000 --- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummySPConfiguration.java +++ /dev/null @@ -1,21 +0,0 @@ -package at.gv.egiz.eaaf.core.impl.idp.module.test; - -import java.util.Map; - -import at.gv.egiz.eaaf.core.api.idp.IConfiguration; -import at.gv.egiz.eaaf.core.impl.idp.conf.SPConfigurationImpl; - -public class DummySPConfiguration extends SPConfigurationImpl { - - public DummySPConfiguration(Map<String, String> spConfig, IConfiguration authConfig) { - super(spConfig, authConfig); - - } - - @Override - public String getAreaSpecificTargetIdentifier() { - return getConfigurationValue("target"); - - } - -} diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummySpConfiguration.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummySpConfiguration.java new file mode 100644 index 00000000..87e91609 --- /dev/null +++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummySpConfiguration.java @@ -0,0 +1,23 @@ +package at.gv.egiz.eaaf.core.impl.idp.module.test; + +import java.util.Map; + +import at.gv.egiz.eaaf.core.api.idp.IConfiguration; +import at.gv.egiz.eaaf.core.impl.idp.conf.SpConfigurationImpl; + +public class DummySpConfiguration extends SpConfigurationImpl { + + private static final long serialVersionUID = 3837138426712775909L; + + public DummySpConfiguration(final Map<String, String> spConfig, final IConfiguration authConfig) { + super(spConfig, authConfig); + + } + + @Override + public String getAreaSpecificTargetIdentifier() { + return getConfigurationValue("target"); + + } + +} diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/TestRequestImpl.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/TestRequestImpl.java index 80451399..ad80d3ad 100644 --- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/TestRequestImpl.java +++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/TestRequestImpl.java @@ -1,343 +1,376 @@ -/******************************************************************************* - * 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.module.test; import java.io.Serializable; import java.lang.reflect.InvocationTargetException; import java.util.HashMap; import java.util.Map; - -import org.apache.commons.lang3.StringUtils; - import at.gv.egiz.eaaf.core.api.IRequest; -import at.gv.egiz.eaaf.core.api.idp.ISPConfiguration; -import at.gv.egiz.eaaf.core.exceptions.EAAFStorageException; +import at.gv.egiz.eaaf.core.api.idp.IspConfiguration; +import at.gv.egiz.eaaf.core.exceptions.EaafStorageException; import at.gv.egiz.eaaf.core.impl.idp.auth.data.AuthProcessDataWrapper; +import org.apache.commons.lang3.StringUtils; /** + * Test pending-request for jUnit tests. + * * @author tlenz * */ public class TestRequestImpl implements IRequest { - private String processInstanceID = null; - private ISPConfiguration spConfig = null; - private final Map<String, Object> storage = new HashMap<String, Object>(); - private String transactionId = null; - private String pendingReqId = null; - private String authURL = null; - private boolean authenticated; - private boolean needAuthentication = false; - - /* (non-Javadoc) - * @see at.gv.egovernment.moa.id.moduls.IRequest#requestedModule() - */ - @Override - public String requestedModule() { - // TODO Auto-generated method stub - return null; - } - - /* (non-Javadoc) - * @see at.gv.egovernment.moa.id.moduls.IRequest#requestedAction() - */ - @Override - public String requestedAction() { - // TODO Auto-generated method stub - return null; - } - - /* (non-Javadoc) - * @see at.gv.egovernment.moa.id.moduls.IRequest#isPassiv() - */ - @Override - public boolean isPassiv() { - // TODO Auto-generated method stub - return false; - } - - /* (non-Javadoc) - * @see at.gv.egovernment.moa.id.moduls.IRequest#forceAuth() - */ - @Override - public boolean forceAuth() { - // TODO Auto-generated method stub - return false; - } - - /* (non-Javadoc) - * @see at.gv.egovernment.moa.id.moduls.IRequest#getGenericData(java.lang.String) - */ - @Override - public Object getRawData(String key) { - return storage.get(key); - } - - /* (non-Javadoc) - * @see at.gv.egovernment.moa.id.moduls.IRequest#getGenericData(java.lang.String, java.lang.Class) - */ - @Override - public <T> T getRawData(String key, Class<T> clazz) { - return (T)storage.get(key); - } - - - /* (non-Javadoc) - * @see at.gv.egovernment.moa.id.moduls.IRequest#getUniqueTransactionIdentifier() - */ - @Override - public String getUniqueTransactionIdentifier() { - return this.transactionId; - } - - /* (non-Javadoc) - * @see at.gv.egovernment.moa.id.moduls.IRequest#getUniqueSessionIdentifier() - */ - @Override - public String getUniqueSessionIdentifier() { - // TODO Auto-generated method stub - return null; - } - - /* (non-Javadoc) - * @see at.gv.egovernment.moa.id.moduls.IRequest#getProcessInstanceId() - */ - @Override - public String getProcessInstanceId() { - return processInstanceID; - - } - - /* (non-Javadoc) - * @see at.gv.egovernment.moa.id.moduls.IRequest#getAuthURL() - */ - @Override - public String getAuthURL() { - return this.authURL; - } - - /* (non-Javadoc) - * @see at.gv.egovernment.moa.id.moduls.IRequest#getAuthURLWithOutSlash() - */ - @Override - public String getAuthURLWithOutSlash() { - if (this.authURL != null && this.authURL.endsWith("/")) - return this.authURL.substring(0, this.authURL.length()-1); - else - return this.authURL; - } - - /* (non-Javadoc) - * @see at.gv.egovernment.moa.id.moduls.IRequest#isNeedAuthentication() - */ - @Override - public boolean isNeedAuthentication() { - return this.needAuthentication; - - } - - /* (non-Javadoc) - * @see at.gv.egovernment.moa.id.moduls.IRequest#needSingleSignOnFunctionality() - */ - @Override - public boolean needSingleSignOnFunctionality() { - // TODO Auto-generated method stub - return false; - } - - /* (non-Javadoc) - * @see at.gv.egovernment.moa.id.moduls.IRequest#setNeedSingleSignOnFunctionality(boolean) - */ - @Override - public void setNeedSingleSignOnFunctionality(boolean needSSO) { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see at.gv.egovernment.moa.id.moduls.IRequest#isAuthenticated() - */ - @Override - public boolean isAuthenticated() { - return this.authenticated; - } - - /* (non-Javadoc) - * @see at.gv.egovernment.moa.id.moduls.IRequest#setAuthenticated(boolean) - */ - @Override - public void setAuthenticated(boolean isAuthenticated) { - this.authenticated = isAuthenticated; - - } - - /** - * @param processInstanceID the processInstanceID to set - */ - public void setProcessInstanceID(String processInstanceID) { - this.processInstanceID = processInstanceID; - } - - /* (non-Javadoc) - * @see at.gv.egovernment.moa.id.moduls.IRequest#isAbortedByUser() - */ - @Override - public boolean isAbortedByUser() { - // TODO Auto-generated method stub - return false; - } - - /* (non-Javadoc) - * @see at.gv.egovernment.moa.id.moduls.IRequest#setAbortedByUser(boolean) - */ - @Override - public void setAbortedByUser(boolean isAborted) { - // TODO Auto-generated method stub - - } - - @Override - public String getSPEntityId() { - // TODO Auto-generated method stub - return null; - } - - @Override - public void setRawDataToTransaction(Map<String, Object> map) throws EAAFStorageException { - storage.putAll(map); - - } - - @Override - public String getPendingRequestId() { - return this.pendingReqId; - } - - @Override - public String getInternalSSOSessionIdentifier() { - // TODO Auto-generated method stub - return null; - } - - @Override - public void setInternalSSOSessionIdentifier(String internalSSOSessionId) { - // TODO Auto-generated method stub - - } - - @Override - public boolean isNeedUserConsent() { - // TODO Auto-generated method stub - return false; - } - - @Override - public void setNeedUserConsent(boolean needConsent) { - // TODO Auto-generated method stub - - } - - @Override - public ISPConfiguration getServiceProviderConfiguration() { - return spConfig; - - } - - @Override - public <T> T getServiceProviderConfiguration(Class<T> decorator) { - return (T)spConfig; - } - - @Override - public void setRawDataToTransaction(String key, Object object) throws EAAFStorageException { - if (StringUtils.isEmpty(key)) { - throw new EAAFStorageException("Generic request-data can not be stored with a 'null' key", null); - - } - - if (object != null) { - if (!Serializable.class.isInstance(object)) { - throw new EAAFStorageException("Generic request-data can only store objects which implements the 'Seralizable' interface", null); - - } - } - - storage.put(key, object); - - } - - public void setSpConfig(ISPConfiguration spConfig) { - this.spConfig = spConfig; - } - - @Override - public <T> T getSessionData(Class<T> wrapper) { - if (wrapper != null) { - if (AuthProcessDataWrapper.class.isAssignableFrom(wrapper)) { - try { - return wrapper.getConstructor(Map.class).newInstance(this.storage); - - } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException - | IllegalArgumentException | InvocationTargetException e) { - throw new RuntimeException("Can NOT instance wrapper: " + wrapper.getName(), e); - - } - - } - - throw new RuntimeException("Can NOT wrap generic data into session data. " - + "Reason: Wrapper " + wrapper.getName() + " is NOT a valid wrapper"); - - } - - return null; - } - - public void setTransactionId(String transactionId) { - this.transactionId = transactionId; - } - - public void setPendingReqId(String pendingReqId) { - this.pendingReqId = pendingReqId; - } - - public void setAuthURL(String authURL) { - this.authURL = authURL; - } - - public void setNeedAuthentication(boolean needAuthentication) { - this.needAuthentication = needAuthentication; - } - - - - - - - + private String processInstanceID = null; + private IspConfiguration spConfig = null; + private final Map<String, Object> storage = new HashMap<>(); + private String transactionId = null; + private String pendingReqId = null; + private String authUrl = null; + private boolean authenticated; + private boolean needAuthentication = false; + + /* + * (non-Javadoc) + * + * @see at.gv.egovernment.moa.id.moduls.IRequest#requestedModule() + */ + @Override + public String requestedModule() { + // TODO Auto-generated method stub + return null; + } + + /* + * (non-Javadoc) + * + * @see at.gv.egovernment.moa.id.moduls.IRequest#requestedAction() + */ + @Override + public String requestedAction() { + // TODO Auto-generated method stub + return null; + } + + /* + * (non-Javadoc) + * + * @see at.gv.egovernment.moa.id.moduls.IRequest#isPassiv() + */ + @Override + public boolean isPassiv() { + // TODO Auto-generated method stub + return false; + } + + /* + * (non-Javadoc) + * + * @see at.gv.egovernment.moa.id.moduls.IRequest#forceAuth() + */ + @Override + public boolean forceAuth() { + // TODO Auto-generated method stub + return false; + } + + /* + * (non-Javadoc) + * + * @see at.gv.egovernment.moa.id.moduls.IRequest#getGenericData(java.lang.String) + */ + @Override + public Object getRawData(final String key) { + return storage.get(key); + } + + /* + * (non-Javadoc) + * + * @see at.gv.egovernment.moa.id.moduls.IRequest#getGenericData(java.lang.String, java.lang.Class) + */ + @Override + public <T> T getRawData(final String key, final Class<T> clazz) { + return (T) storage.get(key); + } + + + /* + * (non-Javadoc) + * + * @see at.gv.egovernment.moa.id.moduls.IRequest#getUniqueTransactionIdentifier() + */ + @Override + public String getUniqueTransactionIdentifier() { + return this.transactionId; + } + + /* + * (non-Javadoc) + * + * @see at.gv.egovernment.moa.id.moduls.IRequest#getUniqueSessionIdentifier() + */ + @Override + public String getUniqueSessionIdentifier() { + // TODO Auto-generated method stub + return null; + } + + /* + * (non-Javadoc) + * + * @see at.gv.egovernment.moa.id.moduls.IRequest#getProcessInstanceId() + */ + @Override + public String getProcessInstanceId() { + return processInstanceID; + + } + + /* + * (non-Javadoc) + * + * @see at.gv.egovernment.moa.id.moduls.IRequest#getAuthURL() + */ + @Override + public String getAuthUrl() { + return this.authUrl; + } + + /* + * (non-Javadoc) + * + * @see at.gv.egovernment.moa.id.moduls.IRequest#getAuthURLWithOutSlash() + */ + @Override + public String getAuthUrlWithOutSlash() { + if (this.authUrl != null && this.authUrl.endsWith("/")) { + return this.authUrl.substring(0, this.authUrl.length() - 1); + } else { + return this.authUrl; + } + } + + /* + * (non-Javadoc) + * + * @see at.gv.egovernment.moa.id.moduls.IRequest#isNeedAuthentication() + */ + @Override + public boolean isNeedAuthentication() { + return this.needAuthentication; + + } + + /* + * (non-Javadoc) + * + * @see at.gv.egovernment.moa.id.moduls.IRequest#needSingleSignOnFunctionality() + */ + @Override + public boolean needSingleSignOnFunctionality() { + // TODO Auto-generated method stub + return false; + } + + /* + * (non-Javadoc) + * + * @see at.gv.egovernment.moa.id.moduls.IRequest#setNeedSingleSignOnFunctionality(boolean) + */ + @Override + public void setNeedSingleSignOnFunctionality(final boolean needSso) { + // TODO Auto-generated method stub + + } + + /* + * (non-Javadoc) + * + * @see at.gv.egovernment.moa.id.moduls.IRequest#isAuthenticated() + */ + @Override + public boolean isAuthenticated() { + return this.authenticated; + } + + /* + * (non-Javadoc) + * + * @see at.gv.egovernment.moa.id.moduls.IRequest#setAuthenticated(boolean) + */ + @Override + public void setAuthenticated(final boolean isAuthenticated) { + this.authenticated = isAuthenticated; + + } + + /** + * Set process-instance id. + * + * @param processInstanceID the processInstanceID to set + */ + public void setProcessInstanceID(final String processInstanceID) { + this.processInstanceID = processInstanceID; + } + + /* + * (non-Javadoc) + * + * @see at.gv.egovernment.moa.id.moduls.IRequest#isAbortedByUser() + */ + @Override + public boolean isAbortedByUser() { + // TODO Auto-generated method stub + return false; + } + + /* + * (non-Javadoc) + * + * @see at.gv.egovernment.moa.id.moduls.IRequest#setAbortedByUser(boolean) + */ + @Override + public void setAbortedByUser(final boolean isAborted) { + // TODO Auto-generated method stub + + } + + @Override + public String getSpEntityId() { + // TODO Auto-generated method stub + return null; + } + + @Override + public void setRawDataToTransaction(final String key, final Object object) + throws EaafStorageException { + if (StringUtils.isEmpty(key)) { + throw new EaafStorageException("Generic request-data can not be stored with a 'null' key", + null); + + } + + if (object != null) { + if (!Serializable.class.isInstance(object)) { + throw new EaafStorageException( + "Generic request-data can only store objects which implements the 'Seralizable' interface", + null); + + } + } + + storage.put(key, object); + + } + + @Override + public void setRawDataToTransaction(final Map<String, Object> map) throws EaafStorageException { + storage.putAll(map); + + } + + @Override + public String getPendingRequestId() { + return this.pendingReqId; + } + + @Override + public String getInternalSsoSessionIdentifier() { + // TODO Auto-generated method stub + return null; + } + + @Override + public void setInternalSsoSessionIdentifier(final String internalSsoSessionId) { + // TODO Auto-generated method stub + + } + + @Override + public boolean isNeedUserConsent() { + // TODO Auto-generated method stub + return false; + } + + @Override + public void setNeedUserConsent(final boolean needConsent) { + // TODO Auto-generated method stub + + } + + @Override + public IspConfiguration getServiceProviderConfiguration() { + return spConfig; + + } + + @Override + public <T> T getServiceProviderConfiguration(final Class<T> decorator) { + return (T) spConfig; + } + + + + public void setSpConfig(final IspConfiguration spConfig) { + this.spConfig = spConfig; + } + + @Override + public <T> T getSessionData(final Class<T> wrapper) { + if (wrapper != null) { + if (AuthProcessDataWrapper.class.isAssignableFrom(wrapper)) { + try { + return wrapper.getConstructor(Map.class).newInstance(this.storage); + + } catch (NoSuchMethodException | SecurityException | InstantiationException + | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + throw new RuntimeException("Can NOT instance wrapper: " + wrapper.getName(), e); + + } + + } + + throw new RuntimeException("Can NOT wrap generic data into session data. " + + "Reason: Wrapper " + wrapper.getName() + " is NOT a valid wrapper"); + + } + + return null; + } + + public void setTransactionId(final String transactionId) { + this.transactionId = transactionId; + } + + public void setPendingReqId(final String pendingReqId) { + this.pendingReqId = pendingReqId; + } + + public void setAuthUrl(final String authUrl) { + this.authUrl = authUrl; + } + + public void setNeedAuthentication(final boolean needAuthentication) { + this.needAuthentication = needAuthentication; + } + + } |