aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/main/java/at/gv
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2016-02-18 19:22:52 +0100
committerThomas Lenz <tlenz@iaik.tugraz.at>2016-02-18 19:22:52 +0100
commit0d827d781679187d4a73e7b51510539a69a46d79 (patch)
tree97a3f003124132c4b8de22ed80eaeca2cbc895a7 /id/server/idserverlib/src/main/java/at/gv
parent9bafb2671b297d39574c346c896347f197282081 (diff)
downloadmoa-id-spss-0d827d781679187d4a73e7b51510539a69a46d79.tar.gz
moa-id-spss-0d827d781679187d4a73e7b51510539a69a46d79.tar.bz2
moa-id-spss-0d827d781679187d4a73e7b51510539a69a46d79.zip
fix error handling: always make a redirect to MOA-ID in case of error
Diffstat (limited to 'id/server/idserverlib/src/main/java/at/gv')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/AbstractController.java45
1 files changed, 18 insertions, 27 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/AbstractController.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/AbstractController.java
index acff2e40e..8c0708fd5 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/AbstractController.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/AbstractController.java
@@ -126,42 +126,33 @@ public abstract class AbstractController extends MOAIDAuthConstants {
loggedException = exceptionThrown;
try {
- //switch to protocol-finalize method to generate a protocol-specific error message
- if (MiscUtil.isNotEmpty(pendingRequestID)) {
+ //switch to protocol-finalize method to generate a protocol-specific error message
+
+ //put exception into transaction store for redirect
+ String key = Random.nextRandom();
+ transactionStorage.put(key, loggedException);
- //put exception into transaction store for redirect
- String key = Random.nextRandom();
- transactionStorage.put(key, loggedException);
-
- //build up redirect URL
- String redirectURL = null;
- redirectURL = ServletUtils.getBaseUrl(req);
- redirectURL += "/"+AbstractAuthProtocolModulController.FINALIZEPROTOCOL_ENDPOINT
- + "?" + ERROR_CODE_PARAM + "=" + key
- + "&" + MOAIDAuthConstants.PARAM_TARGET_PENDINGREQUESTID + "=" + pendingRequestID;
+ //build up redirect URL
+ String redirectURL = null;
+ redirectURL = ServletUtils.getBaseUrl(req);
+ redirectURL += "/"+AbstractAuthProtocolModulController.FINALIZEPROTOCOL_ENDPOINT
+ + "?" + ERROR_CODE_PARAM + "=" + key
+ + "&" + MOAIDAuthConstants.PARAM_TARGET_PENDINGREQUESTID + "=" + pendingRequestID;
- resp.setContentType("text/html");
- resp.setStatus(302);
+ resp.setContentType("text/html");
+ resp.setStatus(302);
- resp.addHeader("Location", redirectURL);
- Logger.debug("REDIRECT TO: " + redirectURL);
+ resp.addHeader("Location", redirectURL);
+ Logger.debug("REDIRECT TO: " + redirectURL);
- return;
-
- } else {
- //write exception into browser window, because protocol-specific error message
- // is not possible without pendingRequest
- handleErrorNoRedirect(loggedException, req, resp, true);
-
- }
-
+ return;
+
} catch (MOADatabaseException e) {
Logger.warn("Exception can not be stored to Database.", e);
handleErrorNoRedirect(loggedException, req, resp, true);
}
-
-
+
}
/**