From 41ea2fdf782cd64d7d29f73c2e83f9c255810818 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 2 Feb 2020 19:32:21 +0100 Subject: some more OpenSAML3 refactoring stuff --- .../pvp2/impl/opensaml/EaafHttpPostDecoder.java | 30 ++++++++++++++++------ 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'eaaf_modules/eaaf_module_pvp2_core/src/main/java/at/gv/egiz/eaaf/modules/pvp2/impl/opensaml/EaafHttpPostDecoder.java') 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 dc60019a..d23affba 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 @@ -7,10 +7,13 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import javax.servlet.http.HttpServletRequest; +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 lombok.extern.slf4j.Slf4j; import net.shibboleth.utilities.java.support.codec.Base64Support; @@ -34,8 +37,6 @@ public class EaafHttpPostDecoder extends HTTPPostDecoder { encodedMessage = getLastParameterFromRequest(request, "SAMLResponse"); } - - if (Strings.isNullOrEmpty(encodedMessage)) { log.info("Request did not contain either a SAMLRequest or " + "SAMLResponse paramter. Invalid request for SAML 2 HTTP POST binding."); @@ -54,14 +55,27 @@ public class EaafHttpPostDecoder extends HTTPPostDecoder { } /** - * Always read the last parameter with this name from request to get a strict deterministic behavior. - *

- * If more than one parameters with the same name exists, - * this method always select the last parameter value. + * EAAF specific unmarshaller perform XML schema validation before unmarshalling + * the SAML message. + * + */ + @Override + protected XMLObject unmarshallMessage(final InputStream messageStream) throws MessageDecodingException { + return Saml2Utils.unmarshallMessage(messageStream); + + } + + /** + * Always read the last parameter with this name from request to get a strict + * deterministic behavior.
+ *
+ * If more than one parameters with the same name exists, this method + * always select the last parameter value. * - * @param request Incoming http request + * @param request Incoming http request * @param paramName Name of the http parameter - * @return the last parameter value with this name, or null if the parameter not exists + * @return the last parameter value with this name, or null if the + * parameter not exists */ @Nullable private String getLastParameterFromRequest(@Nonnull HttpServletRequest request, @Nonnull String paramName) { -- cgit v1.2.3