From 729500a159c61a697c528e0c86abd132f4380b0d Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Thu, 12 Jul 2018 16:10:53 +0200 Subject: some more updates --- .../AbstractAuthProtocolModulController.java | 51 +++++++---- .../impl/idp/controller/AbstractController.java | 30 +++++- .../AbstractProcessEngineSignalController.java | 38 ++++++-- .../controller/ProtocolFinalizationController.java | 52 +++++++---- .../impl/idp/controller/protocols/RequestImpl.java | 70 ++++++++++---- .../tasks/FinalizeAuthenticationTask.java | 24 +++++ .../tasks/RestartAuthProzessManagement.java | 101 +++++++++++++-------- 7 files changed, 267 insertions(+), 99 deletions(-) (limited to 'eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller') diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractAuthProtocolModulController.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractAuthProtocolModulController.java index d72ee404..92b388a6 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractAuthProtocolModulController.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractAuthProtocolModulController.java @@ -1,3 +1,27 @@ +/******************************************************************************* + * Copyright 2017 Graz University of Technology + * EAAF-Core Components has been developed in a cooperation between EGIZ, + * A-SIT+, 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.idp.controller; @@ -14,7 +38,7 @@ import org.springframework.beans.factory.annotation.Autowired; import at.gv.egiz.components.eventlog.api.EventConstants; import at.gv.egiz.eaaf.core.api.IRequest; -import at.gv.egiz.eaaf.core.api.IStatusMessager; +import at.gv.egiz.eaaf.core.api.IStatusMessenger; import at.gv.egiz.eaaf.core.api.idp.IAction; import at.gv.egiz.eaaf.core.api.idp.IAuthData; import at.gv.egiz.eaaf.core.api.idp.IAuthenticationDataBuilder; @@ -61,9 +85,8 @@ public abstract class AbstractAuthProtocolModulController extends AbstractContro if (oaParam == null) throw new EAAFAuthenticationException( - IStatusMessager.CODES_INTERNAL_ERROR_AUTH_NOSPCONFIG, - new Object[] { pendingReq.getSPEntityId() }, - "No Service Provider configuration found."); + IStatusMessenger.CODES_INTERNAL_ERROR_AUTH_NOSPCONFIG, + new Object[] { pendingReq.getSPEntityId() }); if (authmanager.doAuthentication(req, resp, pendingReq)) { //pending request is already authenticated --> protocol-specific postProcessing can start directly @@ -103,9 +126,12 @@ public abstract class AbstractAuthProtocolModulController extends AbstractContro //if Single Sign-On functionality is enabled for this request if (pendingReq.needSingleSignOnFunctionality()) { - if (ssoManager != null) + if (ssoManager != null) { newSSOSessionId = ssoManager.createNewSSOSessionCookie(req, resp, pendingReq); - else + if (StringUtils.isEmpty(pendingReq.getInternalSSOSessionIdentifier())) + ssoManager.createNewSSOSession(pendingReq, newSSOSessionId); + + } else log.warn("SSO is requested but there is not SSO Session-Manager available"); } @@ -119,17 +145,8 @@ public abstract class AbstractAuthProtocolModulController extends AbstractContro //Store OA specific SSO session information if an SSO cookie is set if (StringUtils.isNotEmpty(newSSOSessionId)) { try { - //create new SSO session, if actually no SSO session exists - if (StringUtils.isEmpty(pendingReq.getSSOSessionIdentifier())) { - ssoManager.createNewSSOSession(pendingReq, newSSOSessionId, sloInformation); - - //MOA SSO-session already exists only update is required - } else { - ssoManager.updateSSOSession(pendingReq, newSSOSessionId, sloInformation); - - - } - + ssoManager.updateSSOSession(pendingReq, newSSOSessionId, sloInformation); + } catch (EAAFSSOException e) { log.warn("SSO Session information can not be stored -> SSO is not enabled!"); authmanager.performOnlyIDPLogOut(req, resp, pendingReq); 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 980d77ba..747891f3 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 @@ -1,3 +1,27 @@ +/******************************************************************************* + * Copyright 2017 Graz University of Technology + * EAAF-Core Components has been developed in a cooperation between EGIZ, + * A-SIT+, 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.idp.controller; @@ -21,7 +45,7 @@ import org.springframework.web.bind.annotation.ExceptionHandler; import at.gv.egiz.components.eventlog.api.EventConstants; import at.gv.egiz.eaaf.core.api.IRequest; import at.gv.egiz.eaaf.core.api.IRequestStorage; -import at.gv.egiz.eaaf.core.api.IStatusMessager; +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; @@ -58,7 +82,7 @@ public abstract class AbstractController { @Autowired(required=true) protected IRequestStorage requestStorage; @Autowired(required=true) protected IGUIFormBuilder guiBuilder; @Autowired(required=true) protected IGUIBuilderConfigurationFactory guiConfigFactory; - @Autowired(required=true) protected IStatusMessager statusMessager; + @Autowired(required=true) protected IStatusMessenger statusMessager; @Autowired protected IStatisticLogger statisticLogger; @Autowired protected IRevisionLogger revisionsLogger; @@ -196,7 +220,7 @@ public abstract class AbstractController { else { //write generic message for general exceptions - String msg = statusMessager.getMessage(IStatusMessager.CODES_INTERNAL_ERROR_GENERIC, null); + String msg = statusMessager.getMessage(IStatusMessenger.CODES_INTERNAL_ERROR_GENERIC, null); writeHTMLErrorResponse(req, resp, msg, "9199", (Exception) throwable); } diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractProcessEngineSignalController.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractProcessEngineSignalController.java index a4a86ca2..7a93e31b 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractProcessEngineSignalController.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractProcessEngineSignalController.java @@ -1,3 +1,27 @@ +/******************************************************************************* + * Copyright 2017 Graz University of Technology + * EAAF-Core Components has been developed in a cooperation between EGIZ, + * A-SIT+, 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.idp.controller; @@ -13,7 +37,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import at.gv.egiz.eaaf.core.api.IRequest; -import at.gv.egiz.eaaf.core.api.IStatusMessager; +import at.gv.egiz.eaaf.core.api.IStatusMessenger; import at.gv.egiz.eaaf.core.api.data.EAAFConstants; import at.gv.egiz.eaaf.core.api.idp.process.ProcessEngine; import at.gv.egiz.eaaf.core.exceptions.EAAFException; @@ -37,18 +61,15 @@ public abstract class AbstractProcessEngineSignalController extends AbstractCont try { if (pendingRequestID == null) { new EAAFException( - IStatusMessager.CODES_INTERNAL_ERROR_AUTH_NOPENDIGREQID, - null, - "NO PendingRequestId found" - ); + IStatusMessenger.CODES_INTERNAL_ERROR_AUTH_NOPENDIGREQID, + null); } pendingReq = requestStorage.getPendingRequest(pendingRequestID); if (pendingReq == null) { log.info("No PendingRequest with Id: " + pendingRequestID + " Maybe, a transaction timeout occure."); - throw new EAAFException(IStatusMessager.CODES_INTERNAL_ERROR_AUTH_TIMEOUT, new Object[]{pendingRequestID}, - "No PendingRequest with Id: \" + pendingRequestID + \" Maybe, a transaction timeout occure.\""); + throw new EAAFException(IStatusMessenger.CODES_INTERNAL_ERROR_AUTH_TIMEOUT, new Object[]{pendingRequestID}); } @@ -58,8 +79,7 @@ public abstract class AbstractProcessEngineSignalController extends AbstractCont // process instance is mandatory if (pendingReq.getProcessInstanceId() == null) { - throw new EAAFIllegalStateException(new Object[]{"MOA session does not provide process instance id."}, - "No execution environemnt found for this pending request"); + throw new EAAFIllegalStateException(new Object[]{"MOA session does not provide process instance id."}); } diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/ProtocolFinalizationController.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/ProtocolFinalizationController.java index 3659ff4f..2dc97486 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 @@ -1,3 +1,27 @@ +/******************************************************************************* + * Copyright 2017 Graz University of Technology + * EAAF-Core Components has been developed in a cooperation between EGIZ, + * A-SIT+, 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.idp.controller; @@ -16,7 +40,7 @@ import org.springframework.web.bind.annotation.RequestMethod; import at.gv.egiz.components.eventlog.api.EventConstants; import at.gv.egiz.eaaf.core.api.IRequest; -import at.gv.egiz.eaaf.core.api.IStatusMessager; +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.exceptions.EAAFAuthenticationException; @@ -62,10 +86,8 @@ public class ProtocolFinalizationController extends AbstractAuthProtocolModulCon } else { handleErrorNoRedirect( new EAAFException( - IStatusMessager.CODES_INTERNAL_ERROR_AUTH_NOPENDIGREQID, - null, - "NO Error with this Id found" - ), req, resp, false); + IStatusMessenger.CODES_INTERNAL_ERROR_AUTH_NOPENDIGREQID, + null), req, resp, false); } @@ -87,10 +109,8 @@ public class ProtocolFinalizationController extends AbstractAuthProtocolModulCon log.debug("Request contains NO ErrorId"); handleErrorNoRedirect( new EAAFException( - IStatusMessager.CODES_INTERNAL_ERROR_AUTH_NOPENDIGREQID, - null, - "Request containts NO error id." - ), req, resp, false); + IStatusMessenger.CODES_INTERNAL_ERROR_AUTH_NOPENDIGREQID, + null), req, resp, false); } @@ -114,10 +134,9 @@ public class ProtocolFinalizationController extends AbstractAuthProtocolModulCon log.error("No PendingRequest with ID " + pendingRequestID + " found.!"); handleErrorNoRedirect( new EAAFException( - IStatusMessager.CODES_INTERNAL_ERROR_AUTH_TIMEOUT, + IStatusMessenger.CODES_INTERNAL_ERROR_AUTH_TIMEOUT, new Object[]{pendingRequestID, - }, - "No pendigReq with Id: " + pendingRequestID), req, resp, false); + }), req, resp, false); } else { try { @@ -128,9 +147,8 @@ public class ProtocolFinalizationController extends AbstractAuthProtocolModulCon //send authentication aborted error to Service Provider buildProtocolSpecificErrorResponse( new EAAFAuthenticationException( - IStatusMessager.CODES_INTERNAL_ERROR_AUTH_USERSTOP, - new Object[] {}, - "User stops authentication process"), + IStatusMessenger.CODES_INTERNAL_ERROR_AUTH_USERSTOP, + new Object[] {}), req, resp, pendingReq); //do not remove the full active SSO-Session @@ -150,9 +168,7 @@ public class ProtocolFinalizationController extends AbstractAuthProtocolModulCon handleErrorNoRedirect( new EAAFException( "auth.20", - null, - "PendingRequest is NOT authenticated --> Abort authentication process!" - ), req, resp, true); + null), req, resp, true); } 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 6a7f4440..a453a8a3 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,3 +1,27 @@ +/******************************************************************************* + * Copyright 2017 Graz University of Technology + * EAAF-Core Components has been developed in a cooperation between EGIZ, + * A-SIT+, 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.idp.controller.protocols; @@ -41,7 +65,7 @@ public abstract class RequestImpl implements IRequest, Serializable{ private String pendingRequestId; private String processInstanceId; - private String ssoSessionId; + private String internalSSOSessionId; private String uniqueTransactionIdentifer; private String uniqueSessionIdentifer; @@ -94,15 +118,13 @@ public abstract class RequestImpl implements IRequest, Serializable{ } catch (MalformedURLException e) { log.error("IDP AuthenticationServiceURL Prefix is not a valid URL." + authURLString, e); - throw new EAAFAuthenticationException("errorId", new Object[]{authURLString}, - "IDP AuthenticationServiceURL Prefix is not a valid URL.", 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}, - "Extract AuthenticationServiceURL: " + authReqURL + " is NOT found in configuration."); + throw new EAAFAuthenticationException("errorId", new Object[]{authURLString}); } @@ -128,25 +150,21 @@ public abstract class RequestImpl implements IRequest, Serializable{ } -// /** -// * This method map the protocol specific requested attributes to PVP 2.1 attributes. -// * -// * @return List of PVP 2.1 attribute names with maps all protocol specific attributes -// */ -// public abstract Collection getRequestedAttributes(MetadataProvider metadataProvider); - 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; } @@ -159,6 +177,7 @@ public abstract class RequestImpl implements IRequest, Serializable{ this.force = force; } + @Override public final String requestedAction() { return action; } @@ -167,6 +186,7 @@ public abstract class RequestImpl implements IRequest, Serializable{ this.action = action; } + @Override public final String requestedModule() { return module; } @@ -180,30 +200,36 @@ public abstract class RequestImpl implements IRequest, Serializable{ } + @Override public final String getPendingRequestId() { return pendingRequestId; } - public final String getSSOSessionIdentifier() { - return this.ssoSessionId; + @Override + public final String getInternalSSOSessionIdentifier() { + return this.internalSSOSessionId; } - public final void setSSOSessionIdentifier(String internalSSOSessionId) { - this.ssoSessionId = internalSSOSessionId; + @Override + public final void setInternalSSOSessionIdentifier(String internalSSOSessionId) { + this.internalSSOSessionId = internalSSOSessionId; } + @Override public final Map genericFullDataStorage() { return this.genericDataStorage; } + @Override public final ISPConfiguration getServiceProviderConfiguration() { return this.spConfiguration; } + @Override public T getServiceProviderConfiguration(final Class decorator) { if (this.spConfiguration != null) { if (decorator.isAssignableFrom(this.spConfiguration.getClass())) { @@ -224,16 +250,19 @@ public abstract class RequestImpl implements IRequest, Serializable{ } + @Override public final String getUniqueTransactionIdentifier() { return this.uniqueTransactionIdentifer; } + @Override public final String getUniqueSessionIdentifier() { return this.uniqueSessionIdentifer; } + @Override public final String getProcessInstanceId() { return this.processInstanceId; @@ -254,10 +283,12 @@ public abstract class RequestImpl implements IRequest, Serializable{ } + @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); @@ -266,6 +297,7 @@ public abstract class RequestImpl implements IRequest, Serializable{ } + @Override public final boolean isNeedAuthentication() { return needAuthentication; } @@ -274,6 +306,7 @@ public abstract class RequestImpl implements IRequest, Serializable{ this.needAuthentication = needAuthentication; } + @Override public final boolean isAuthenticated() { return isAuthenticated; } @@ -282,6 +315,7 @@ public abstract class RequestImpl implements IRequest, Serializable{ this.isAuthenticated = isAuthenticated; } + @Override public final boolean needSingleSignOnFunctionality() { return needSSO; } @@ -290,6 +324,7 @@ public abstract class RequestImpl implements IRequest, Serializable{ } + @Override public final boolean isNeedUserConsent() { return this.needUserConsent; @@ -300,6 +335,7 @@ public abstract class RequestImpl implements IRequest, Serializable{ } + @Override public final boolean isAbortedByUser() { return this.isAbortedByUser; } @@ -309,6 +345,7 @@ public abstract class RequestImpl implements IRequest, Serializable{ } + @Override public final Object getGenericData(String key) { if (StringUtils.isNotEmpty(key)) { return genericDataStorage.get(key); @@ -319,6 +356,7 @@ public abstract class RequestImpl implements IRequest, Serializable{ return null; } + @Override public final T getGenericData(String key, final Class clazz) { if (StringUtils.isNotEmpty(key)) { Object data = genericDataStorage.get(key); diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/tasks/FinalizeAuthenticationTask.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/tasks/FinalizeAuthenticationTask.java index 4ab63503..ad187a91 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/tasks/FinalizeAuthenticationTask.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/tasks/FinalizeAuthenticationTask.java @@ -1,3 +1,27 @@ +/******************************************************************************* + * Copyright 2017 Graz University of Technology + * EAAF-Core Components has been developed in a cooperation between EGIZ, + * A-SIT+, 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.idp.controller.tasks; diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/tasks/RestartAuthProzessManagement.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/tasks/RestartAuthProzessManagement.java index ae63614e..b3e4d874 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/tasks/RestartAuthProzessManagement.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/tasks/RestartAuthProzessManagement.java @@ -1,3 +1,27 @@ +/******************************************************************************* + * Copyright 2017 Graz University of Technology + * EAAF-Core Components has been developed in a cooperation between EGIZ, + * A-SIT+, 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.idp.controller.tasks; @@ -37,47 +61,52 @@ public class RestartAuthProzessManagement extends AbstractAuthServletTask { @Override public void execute(ExecutionContext executionContext, HttpServletRequest request, HttpServletResponse response) throws TaskExecutionException { - try { - //create a new execution context and copy all elements to new context - ExecutionContext newec = new ExecutionContextImpl(); - Set entries = executionContext.keySet(); - for (String key : entries) { - newec.put(key, executionContext.get(key)); - - } + try { - log.debug("Select new auth.-process and restart restart process-engine ... "); - - // select and create new process instance - String processDefinitionId = ModuleRegistration.getInstance().selectProcess(newec); - if (processDefinitionId == null) { - log.warn("No suitable authentication process found for SessionID " + pendingReq.getPendingRequestId()); - throw new EAAFException("process.02", new Object[] { pendingReq.getPendingRequestId()}, - "No suitable authentication process found for SessionID " + pendingReq); - } - - String processInstanceId = processEngine.createProcessInstance(processDefinitionId, newec); - - // keep process instance id in moa session - ((RequestImpl)pendingReq).setProcessInstanceId(processInstanceId); - - // make sure pending request has been persisted before running the process - try { - requestStoreage.storePendingRequest(pendingReq); + if (this.pendingReq.isAbortedByUser()) { + log.debug("AuthProcess was stopped. Forward to finalization ... "); + performRedirectToProtocolFinialization(pendingReq, response); + + } else { + //create a new execution context and copy all elements to new context + ExecutionContext newec = new ExecutionContextImpl(); + Set entries = executionContext.keySet(); + for (String key : entries) { + newec.put(key, executionContext.get(key)); + + } + + log.debug("Select new auth.-process and restart restart process-engine ... "); - } catch (EAAFException e) { - log.error("Database Error! MOASession is not stored!"); - throw new EAAFException("init.04", new Object[] { pendingReq.getPendingRequestId() }, - "Database Error! MOASession is not stored!"); + // select and create new process instance + String processDefinitionId = ModuleRegistration.getInstance().selectProcess(newec); + if (processDefinitionId == null) { + log.warn("No suitable authentication process found for SessionID " + pendingReq.getPendingRequestId()); + throw new EAAFException("process.02", new Object[] { pendingReq.getPendingRequestId()}); + } + + String processInstanceId = processEngine.createProcessInstance(processDefinitionId, newec); + + // keep process instance id in moa session + ((RequestImpl)pendingReq).setProcessInstanceId(processInstanceId); + + // make sure pending request has been persisted before running the process + try { + requestStoreage.storePendingRequest(pendingReq); + + } catch (EAAFException e) { + log.error("Database Error! MOASession is not stored!"); + throw new EAAFException("init.04", new Object[] { pendingReq.getPendingRequestId() }); + + } + + log.info("Restart process-engine with auth.process:" + processDefinitionId); + + // start process + processEngine.start(pendingReq); } - log.info("Restart process-engine with auth.process:" + processDefinitionId); - - // start process - processEngine.start(pendingReq); - - } catch (EAAFException e) { throw new TaskExecutionException(pendingReq, e.getMessage(), e); -- cgit v1.2.3