summaryrefslogtreecommitdiff
path: root/eaaf_modules/eaaf_module_pvp2_core/src/main/java/at/gv/egiz/eaaf/modules/pvp2/impl/opensaml/EaafHttpPostDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'eaaf_modules/eaaf_module_pvp2_core/src/main/java/at/gv/egiz/eaaf/modules/pvp2/impl/opensaml/EaafHttpPostDecoder.java')
-rw-r--r--eaaf_modules/eaaf_module_pvp2_core/src/main/java/at/gv/egiz/eaaf/modules/pvp2/impl/opensaml/EaafHttpPostDecoder.java31
1 files changed, 20 insertions, 11 deletions
diff --git a/eaaf_modules/eaaf_module_pvp2_core/src/main/java/at/gv/egiz/eaaf/modules/pvp2/impl/opensaml/EaafHttpPostDecoder.java b/eaaf_modules/eaaf_module_pvp2_core/src/main/java/at/gv/egiz/eaaf/modules/pvp2/impl/opensaml/EaafHttpPostDecoder.java
index fdd44b9a..f9860839 100644
--- a/eaaf_modules/eaaf_module_pvp2_core/src/main/java/at/gv/egiz/eaaf/modules/pvp2/impl/opensaml/EaafHttpPostDecoder.java
+++ b/eaaf_modules/eaaf_module_pvp2_core/src/main/java/at/gv/egiz/eaaf/modules/pvp2/impl/opensaml/EaafHttpPostDecoder.java
@@ -6,16 +6,17 @@ import java.io.UnsupportedEncodingException;
import javax.servlet.http.HttpServletRequest;
-import at.gv.egiz.eaaf.modules.pvp2.impl.utils.Saml2Utils;
-import at.gv.egiz.eaaf.modules.pvp2.impl.utils.SamlHttpUtils;
-
import org.opensaml.core.xml.XMLObject;
import org.opensaml.messaging.decoder.MessageDecodingException;
import org.opensaml.saml.saml2.binding.decoding.impl.HTTPPostDecoder;
import com.google.common.base.Strings;
+
+import at.gv.egiz.eaaf.modules.pvp2.impl.utils.Saml2Utils;
+import at.gv.egiz.eaaf.modules.pvp2.impl.utils.SamlHttpUtils;
import lombok.extern.slf4j.Slf4j;
import net.shibboleth.utilities.java.support.codec.Base64Support;
+import net.shibboleth.utilities.java.support.codec.DecodingException;
/**
* SAML2 Post-Binding decoder with same EAAF specific hardening regarding http
@@ -51,18 +52,26 @@ public class EaafHttpPostDecoder extends HTTPPostDecoder {
throw new MessageDecodingException("No SAML message present in request");
}
- log.trace("Base64 decoding SAML message: {}", encodedMessage);
- final byte[] decodedBytes = Base64Support.decode(encodedMessage);
-
try {
- log.trace("Decoded SAML message: {}", new String(decodedBytes, "UTF-8"));
+ log.trace("Base64 decoding SAML message: {}", encodedMessage);
+ final byte[] decodedBytes = Base64Support.decode(encodedMessage);
- } catch (final UnsupportedEncodingException e) {
- log.warn("Logging of incomming message failed", e);
+ try {
+ log.trace("Decoded SAML message: {}", new String(decodedBytes, "UTF-8"));
- }
+ } catch (final UnsupportedEncodingException e) {
+ log.warn("Logging of incomming message failed", e);
+
+ }
+
+ return new ByteArrayInputStream(decodedBytes);
+
+ } catch (final DecodingException e) {
+ log.error("Unable to Base64 decode SAML message");
+ throw new MessageDecodingException("Unable to Base64 decode SAML message",e);
+ }
+
- return new ByteArrayInputStream(decodedBytes);
}
/**