summaryrefslogtreecommitdiff
path: root/eaaf_core/src
diff options
context:
space:
mode:
authorChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-08-06 08:27:47 +0200
committerChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-08-06 08:27:47 +0200
commit86034273ffd269ef0cb9de301f10a57905282c54 (patch)
tree8734f2556b6a1d48a234f37f7c38879ec21cd3c3 /eaaf_core/src
parent9db925f509947e011bbf6f471926595db6154fd3 (diff)
parente5cfa24420c147132b8f57f004db14d4f1d1bcbf (diff)
downloadEAAF-Components-86034273ffd269ef0cb9de301f10a57905282c54.tar.gz
EAAF-Components-86034273ffd269ef0cb9de301f10a57905282c54.tar.bz2
EAAF-Components-86034273ffd269ef0cb9de301f10a57905282c54.zip
Merge branch 'master' into nightlyBuild
Diffstat (limited to 'eaaf_core/src')
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/RequestStorage.java7
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/tasks/AbstractLocaleAuthServletTask.java70
2 files changed, 73 insertions, 4 deletions
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/RequestStorage.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/RequestStorage.java
index 9758e258..e1598b8f 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/RequestStorage.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/RequestStorage.java
@@ -176,7 +176,8 @@ public class RequestStorage implements IRequestStorage{
//generate new pendingReqId and get internalPendingReqId
- final String newRequestID = pendingReqIdGenerationStrategy.generateExternalPendingRequestId();
+ final String newRequestID = pendingReqIdGenerationStrategy.generateExternalPendingRequestId();
+ log.debug("Change pendingRequestID from " + pendingRequest.getPendingRequestId() + " to " + newRequestID);
((RequestImpl)pendingRequest).setPendingRequestId(newRequestID);
String newInternalPendingRequestId = null;
@@ -189,9 +190,7 @@ public class RequestStorage implements IRequestStorage{
}
- //change Key in cache
- log.debug("Change pendingRequestID from " + pendingRequest.getPendingRequestId()
- + " to " + newRequestID);
+ //change Key in cache
transactionStorage.changeKey(oldInternalRequestID, newInternalPendingRequestId, pendingRequest);
//only delete oldRequestID, no change.
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/tasks/AbstractLocaleAuthServletTask.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/tasks/AbstractLocaleAuthServletTask.java
new file mode 100644
index 00000000..e80a63e9
--- /dev/null
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/tasks/AbstractLocaleAuthServletTask.java
@@ -0,0 +1,70 @@
+package at.gv.egiz.eaaf.core.impl.idp.controller.tasks;
+
+import java.io.Serializable;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.text.StringEscapeUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import at.gv.egiz.eaaf.core.api.data.EAAFConstants;
+import at.gv.egiz.eaaf.core.api.data.EAAFEventCodes;
+import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;
+import at.gv.egiz.eaaf.core.exceptions.EAAFException;
+import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
+import at.gv.egiz.eaaf.core.impl.idp.auth.modules.AbstractAuthServletTask;
+
+public abstract class AbstractLocaleAuthServletTask extends AbstractAuthServletTask {
+ private static final Logger log = LoggerFactory.getLogger(AbstractLocaleAuthServletTask.class);
+
+ public static final String PROP_REQ_PARAM_LOCALE = "lang";
+
+ @Override
+ public final void execute(ExecutionContext executionContext, HttpServletRequest request, HttpServletResponse response)
+ throws TaskExecutionException {
+
+ final Serializable changeLangFlag = executionContext.get(EAAFConstants.PROCESSCONTEXT_SWITCH_LANGUAGE);
+ final String localeParam = StringEscapeUtils.escapeHtml4(request.getParameter(PROP_REQ_PARAM_LOCALE));
+ if (StringUtils.isNotEmpty(localeParam) &&
+ (changeLangFlag == null || !((Boolean)changeLangFlag)) ) {
+ log.debug("Find {} parameter. Reload last task with new locale: {}", PROP_REQ_PARAM_LOCALE, localeParam);
+ executionContext.put(EAAFConstants.PROCESSCONTEXT_SWITCH_LANGUAGE, true);
+
+
+
+ } else {
+ log.trace("Find {} parameter. Processing this task ... ",PROP_REQ_PARAM_LOCALE);
+ executionContext.remove(EAAFConstants.PROCESSCONTEXT_SWITCH_LANGUAGE);
+
+ final String stopAuthFlag = request.getParameter(EAAFConstants.PARAM_HTTP_STOP_PROCESS);
+ if (StringUtils.isNotEmpty(stopAuthFlag) && Boolean.parseBoolean(stopAuthFlag)) {
+ try {
+ log.info("Authentication process WAS stopped by entity. Stopping auth. process ... ");
+ revisionsLogger.logEvent(pendingReq, EAAFEventCodes.PROCESS_STOPPED_BY_USER);
+ pendingReq.setAbortedByUser(true);
+ pendingReq.setAuthenticated(false);
+ performRedirectToProtocolFinialization(executionContext, pendingReq, request, response);
+
+ } catch (final EAAFException e) {
+ throw new TaskExecutionException(pendingReq, e.getMessage(), e);
+
+ } catch (final Exception e) {
+ log.warn("Stopping auth.process FAILED", e);
+ throw new TaskExecutionException(pendingReq, e.getMessage(), e);
+
+ }
+
+ } else
+ executeWithLocale(executionContext, request, response);
+
+ }
+
+ }
+
+ protected abstract void executeWithLocale(ExecutionContext executionContext, HttpServletRequest request,
+ HttpServletResponse response) throws TaskExecutionException;
+
+}