aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--connector/src/main/java/at/asitplus/eidas/specific/connector/provider/StatusMessageProvider.java14
-rw-r--r--connector/src/test/java/at/asitplus/eidas/specific/connector/test/utils/AuthenticationDataBuilderTest.java2
2 files changed, 11 insertions, 5 deletions
diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/provider/StatusMessageProvider.java b/connector/src/main/java/at/asitplus/eidas/specific/connector/provider/StatusMessageProvider.java
index 073f7513..e83d9d49 100644
--- a/connector/src/main/java/at/asitplus/eidas/specific/connector/provider/StatusMessageProvider.java
+++ b/connector/src/main/java/at/asitplus/eidas/specific/connector/provider/StatusMessageProvider.java
@@ -28,6 +28,7 @@ import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
+import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
@@ -94,11 +95,10 @@ public class StatusMessageProvider implements IStatusMessenger {
public String getResponseErrorCode(Throwable throwable) {
String errorCode = IStatusMessenger.CODES_EXTERNAL_ERROR_GENERIC;
if (throwable instanceof EaafException) {
- errorCode = mapInternalErrorToExternalError(((EaafException) throwable).getErrorId());
+ errorCode = ((EaafException) throwable).getErrorId();
}
- // TODO: maybe more internal switches are required
-
+
return errorCode;
}
@@ -120,7 +120,13 @@ public class StatusMessageProvider implements IStatusMessenger {
} else {
try {
- return externalError.getString(intErrorCode);
+ if (StringUtils.isNotEmpty(intErrorCode)) {
+ return externalError.getString(intErrorCode);
+
+ } else {
+ return IStatusMessenger.CODES_EXTERNAL_ERROR_GENERIC;
+
+ }
} catch (final MissingResourceException e2) {
log.info(MessageFormat.format(ERROR_NO_EXTERNALERROR_CODE, new Object[] { intErrorCode }));
diff --git a/connector/src/test/java/at/asitplus/eidas/specific/connector/test/utils/AuthenticationDataBuilderTest.java b/connector/src/test/java/at/asitplus/eidas/specific/connector/test/utils/AuthenticationDataBuilderTest.java
index 52932c8c..cea20f04 100644
--- a/connector/src/test/java/at/asitplus/eidas/specific/connector/test/utils/AuthenticationDataBuilderTest.java
+++ b/connector/src/test/java/at/asitplus/eidas/specific/connector/test/utils/AuthenticationDataBuilderTest.java
@@ -169,7 +169,7 @@ public class AuthenticationDataBuilderTest {
public void moaIdMode() throws EaafAuthenticationException, EaafBuilderException {
//initialize state
boolean isTestIdentity = RandomUtils.nextBoolean();
- pendingReq.getSessionData(EidAuthProcessDataWrapper.class).setTestIdentity(true);
+ pendingReq.getSessionData(EidAuthProcessDataWrapper.class).setTestIdentity(isTestIdentity);
pendingReq.getSessionData(AuthProcessDataWrapper.class).setEidProcess(false);
IIdentityLink idl = buildDummyIdl();
pendingReq.getSessionData(AuthProcessDataWrapper.class).setIdentityLink(idl);