summaryrefslogtreecommitdiff
path: root/eaaf_modules
diff options
context:
space:
mode:
Diffstat (limited to 'eaaf_modules')
-rw-r--r--eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/tasks/AbstractReceiveQualEidTask.java3
-rw-r--r--eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/utils/SL20HttpBindingUtils.java12
2 files changed, 9 insertions, 6 deletions
diff --git a/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/tasks/AbstractReceiveQualEidTask.java b/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/tasks/AbstractReceiveQualEidTask.java
index 0d0f990a..84ad06e7 100644
--- a/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/tasks/AbstractReceiveQualEidTask.java
+++ b/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/tasks/AbstractReceiveQualEidTask.java
@@ -81,8 +81,7 @@ public abstract class AbstractReceiveQualEidTask extends AbstractAuthServletTask
sl20ReqObj = new JsonMapper().getMapper().readTree(Base64Url.decodeToUtf8String(sl20Result));
} catch (final JsonParseException e) {
- log.warn("SL2.0 command or result is NOT valid JSON.", e);
- log.debug("SL2.0 msg: " + sl20Result);
+ log.error("SL2.0 command or result is NOT valid JSON. Received msg: {}", sl20Result, e);
throw new SL20Exception("sl20.02", new Object[] { "SL2.0 command or result is NOT valid JSON." },
e);
diff --git a/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/utils/SL20HttpBindingUtils.java b/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/utils/SL20HttpBindingUtils.java
index cc2a8430..2b6ddb96 100644
--- a/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/utils/SL20HttpBindingUtils.java
+++ b/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/utils/SL20HttpBindingUtils.java
@@ -16,6 +16,7 @@ import org.apache.http.ParseException;
import org.apache.http.StatusLine;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.utils.URIBuilder;
+import org.apache.http.entity.ContentType;
import org.apache.http.util.EntityUtils;
import org.jose4j.base64url.Base64Url;
import org.slf4j.Logger;
@@ -57,10 +58,13 @@ public class SL20HttpBindingUtils {
throw new SlCommandoParserException("SL20 response contains NO ContentType");
}
-
- if (!response.getEntity().getContentType().getValue().startsWith("application/json")) {
+
+ final ContentType contentType = ContentType.getOrDefault(response.getEntity());
+ if (!ContentType.APPLICATION_JSON.getMimeType().equals(contentType.getMimeType())) {
+ log.error("SL20 response with statuscode: {} has wrong http ContentType: {}",
+ response.getStatusLine(), contentType);
throw new SlCommandoParserException(
- "SL20 response with a wrong ContentType: " + response.getEntity().getContentType().getValue());
+ "SL20 response with a wrong http ContentType: " + contentType);
}
@@ -190,7 +194,7 @@ public class SL20HttpBindingUtils {
}
} else {
- throw new SlCommandoParserException("Can NOT find content in http response");
+ throw new SlCommandoParserException("Can NOT find any content in http response");
}