summaryrefslogtreecommitdiff
path: root/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java
diff options
context:
space:
mode:
Diffstat (limited to 'eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java')
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java54
1 files changed, 30 insertions, 24 deletions
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java
index ffa1163f..a64ad45e 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java
@@ -19,6 +19,27 @@
package at.gv.egiz.eaaf.core.impl.idp.auth.services;
+import java.io.IOException;
+import java.util.HashSet;
+
+import javax.annotation.PostConstruct;
+import javax.naming.ConfigurationException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.text.StringEscapeUtils;
+import org.owasp.encoder.Encode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
+import org.springframework.lang.NonNull;
+import org.springframework.lang.Nullable;
+import org.springframework.stereotype.Service;
+import org.springframework.util.SerializationUtils;
+
import at.gv.egiz.components.eventlog.api.EventConstants;
import at.gv.egiz.eaaf.core.api.IRequest;
import at.gv.egiz.eaaf.core.api.IRequestStorage;
@@ -58,25 +79,8 @@ import at.gv.egiz.eaaf.core.impl.idp.controller.ProtocolFinalizationController;
import at.gv.egiz.eaaf.core.impl.idp.controller.protocols.RequestImpl;
import at.gv.egiz.eaaf.core.impl.utils.KeyValueUtils;
import at.gv.egiz.eaaf.core.impl.utils.ServletUtils;
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.text.StringEscapeUtils;
-import org.owasp.encoder.Encode;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationContext;
-import org.springframework.lang.NonNull;
-import org.springframework.lang.Nullable;
-import org.springframework.stereotype.Service;
-import org.springframework.util.SerializationUtils;
-import javax.annotation.PostConstruct;
-import javax.naming.ConfigurationException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.HashSet;
+
@Service
@@ -107,8 +111,10 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
@Autowired(required = false)
private ISsoManager ssoManager;
+
@Autowired
private IStatisticLogger statisticLogger;
+
@Autowired
private IRevisionLogger revisionsLogger;
@@ -233,7 +239,7 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
final HttpServletResponse resp, final IRequest protocolRequest) throws EaafException, IOException {
try {
IErrorService.IHandleData errorData = errorTicketService.createHandleData(throwable, req);
-
+
if (errorData.getActionType().equals(IErrorService.ActionType.TICKET_REDIRECT) || errorData.getActionType()
.equals(IErrorService.ActionType.NOTICKET_REDIRECT)) {
@@ -245,7 +251,6 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
.validateAndGetPendingRequestId(req.getParameter(EaafConstants.PARAM_HTTP_ERROR_CODE));
transactionStorage.put(errorId, serialized, -1);
-
// log Error to technical log
errorData.logExceptionToTechnicalLog(logOnInfoLevel);
@@ -282,7 +287,6 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
} catch (final Throwable e) {
// if building error response results in error, we try with with handleErrorNoRedirect
handleErrorNoRedirect(e, req, resp, true);
-
}
}
@@ -304,10 +308,11 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
"Requested protocol module Class is NULL or does not implement the IModulInfo interface.");
}
-
+
return (IModulInfo) applicationContext.getBean(clazz);
}
+
@Override
public void handleErrorNoRedirect(final Throwable throwable, final HttpServletRequest req,
final HttpServletResponse resp, final boolean writeExceptionToStatisticLog) throws EaafException, IOException {
@@ -334,6 +339,7 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
}
}
+
@Override
public void forwardToErrorHandler(Pair<IRequest, Throwable> errorToHandle, String errorKey,
final HttpServletRequest req, final HttpServletResponse resp) throws GuiBuildException {
@@ -413,7 +419,6 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
}
-
@PostConstruct
private void initializer() {
log.trace("Initializing {} ...", ProtocolAuthenticationService.class.getName());
@@ -500,6 +505,7 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
PARAM_GUI_ERRORCODEPARAMS, ArrayUtils.toString(errorCodeParams));
errorTicketService.displayErrorData(c, errorData);
+
} else {
log.info("Can not ADD error message, because 'GUIBuilderConfiguration' is not modifieable ");
}
@@ -558,7 +564,7 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
private String generateErrorRedirectUrl(final HttpServletRequest req, String errorKey) {
String redirectUrl = null;
redirectUrl = ServletUtils.getBaseUrl(req);
- redirectUrl += "/" + ProtocolFinalizationController.ENDPOINT_ERRORHANDLING + "?"
+ redirectUrl += ProtocolFinalizationController.ENDPOINT_ERRORHANDLING + "?"
+ EaafConstants.PARAM_HTTP_ERROR_CODE + "=" + errorKey;
return redirectUrl;