summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2019-08-05 12:44:32 +0200
committerThomas Lenz <thomas.lenz@egiz.gv.at>2019-08-05 12:44:32 +0200
commite5cfa24420c147132b8f57f004db14d4f1d1bcbf (patch)
treecaa0bf1e97b0c95044fc217ced493cfc55f2f03a
parent02f9102d84c0e51be56ea5a68238c6dfcc6eab49 (diff)
downloadEAAF-Components-1.0.8.tar.gz
EAAF-Components-1.0.8.tar.bz2
EAAF-Components-1.0.8.zip
add AbstractLocaleAuthServletTask.java into EAAF-core1.0.8
move a misplaced log message change maven repo paths to one single egiz repo
-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
-rw-r--r--eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/data/EAAFConstants.java2
-rw-r--r--eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/data/EAAFEventCodes.java5
-rw-r--r--eaaf_modules/eaaf_module_pvp2_core/pom.xml25
-rw-r--r--pom.xml2
6 files changed, 82 insertions, 29 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;
+
+}
diff --git a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/data/EAAFConstants.java b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/data/EAAFConstants.java
index b29e9843..2397ef0a 100644
--- a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/data/EAAFConstants.java
+++ b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/data/EAAFConstants.java
@@ -34,6 +34,7 @@ public class EAAFConstants {
//http request parameters for process management
public static final String PARAM_HTTP_TARGET_PENDINGREQUESTID = "pendingid";
public static final String PARAM_HTTP_ERROR_CODE = "errorid";
+ public static final String PARAM_HTTP_STOP_PROCESS = "stopAuthProcess";
public static final String EIDAS_LOA_PREFIX = "http://eidas.europa.eu/LoA/";
@@ -70,6 +71,7 @@ public class EAAFConstants {
public static final String PROCESSCONTEXT_SP_CONFIG = PROCESS_ENGINE_PREFIX + "spConfig";
public static final String PROCESS_ENGINE_REQUIRES_NO_POSTAUTH_REDIRECT
= PROCESS_ENGINE_PREFIX + "requireNoPostAuthRedirect";
+ public static final String PROCESSCONTEXT_SWITCH_LANGUAGE = "changeLanguage";
public static final int ALLOWED_TIME_JITTER = 5; //minutes
public static final String COUNTRYCODE_AUSTRIA = "AT";
diff --git a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/data/EAAFEventCodes.java b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/data/EAAFEventCodes.java
new file mode 100644
index 00000000..5ee6eb90
--- /dev/null
+++ b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/data/EAAFEventCodes.java
@@ -0,0 +1,5 @@
+package at.gv.egiz.eaaf.core.api.data;
+
+public class EAAFEventCodes {
+ public static final int PROCESS_STOPPED_BY_USER = 4102;
+}
diff --git a/eaaf_modules/eaaf_module_pvp2_core/pom.xml b/eaaf_modules/eaaf_module_pvp2_core/pom.xml
index de7d6981..a00d3f6a 100644
--- a/eaaf_modules/eaaf_module_pvp2_core/pom.xml
+++ b/eaaf_modules/eaaf_module_pvp2_core/pom.xml
@@ -13,30 +13,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
-
- <!-- repositories>
- <repository>
- <id>MOA_local</id>
- <name>MOA Dependencies</name>
- <releases>
- <enabled>true</enabled>
- <checksumPolicy>ignore</checksumPolicy>
- </releases>
- <layout>default</layout>
- <url>file://${basedir}/repository</url>
- </repository>
- <repository>
- <id>MOA_web</id>
- <name>MOA Dependencies weblocation</name>
- <releases>
- <enabled>true</enabled>
- <checksumPolicy>ignore</checksumPolicy>
- </releases>
- <layout>default</layout>
- <url>https://git.egiz.gv.at/EAAF-Components/plain/eaaf_modules/eaaf_module_pvp2_core/repository</url>
- </repository>
- </repositories-->
-
+
<dependencies>
<dependency>
<groupId>at.gv.egiz.eaaf</groupId>
diff --git a/pom.xml b/pom.xml
index 3065bd4f..e22f6d92 100644
--- a/pom.xml
+++ b/pom.xml
@@ -90,7 +90,7 @@
<repositories>
<repository>
<id>egiz-commons</id>
- <url>https://demo.egiz.gv.at/int-repo/</url>
+ <url>https://apps.egiz.gv.at/maven/</url>
<releases>
<enabled>true</enabled>
</releases>