[java-opensaml COMMIT] in /trunk: opensaml-saml-impl/src/test/java/org/opensaml/saml/saml1/binding/decoding/impl/HTTP...
noreply at shibboleth.net
noreply at shibboleth.net
Fri Oct 21 14:54:19 EDT 2016
Author: putmanb
Date: Fri Oct 21 14:54:18 2016
New Revision: 4547
URL: http://svn.shibboleth.net/view/java-opensaml?rev=4547&view=rev
Log:
OSJ-155: Consider changes to decoders vis-a-vis Content-Type header eval
For the SOAP decoders, missing Content-Type should be not valid, b/c of the original
issue and servlet spec 3.1.1.
Modified:
trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml1/binding/decoding/impl/HTTPSOAP11DecoderTest.java
trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPSOAP11DecoderTest.java
trunk/opensaml-soap-impl/src/main/java/org/opensaml/soap/soap11/decoder/http/impl/HTTPSOAP11Decoder.java
trunk/opensaml-soap-impl/src/test/java/org/opensaml/soap/soap11/decoder/http/impl/HTTPSOAP11DecoderTest.java
Modified: trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml1/binding/decoding/impl/HTTPSOAP11DecoderTest.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml1/binding/decoding/impl/HTTPSOAP11DecoderTest.java?rev=4547&r1=4546&r2=4547&view=diff
==============================================================================
--- trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml1/binding/decoding/impl/HTTPSOAP11DecoderTest.java (original)
+++ trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml1/binding/decoding/impl/HTTPSOAP11DecoderTest.java Fri Oct 21 14:54:18 2016
@@ -45,6 +45,7 @@
protected void setUp() throws Exception {
httpRequest = new MockHttpServletRequest();
httpRequest.setMethod("POST");
+ httpRequest.setContentType("text/xml; charset=utf-8");
decoder = new HTTPSOAP11Decoder();
decoder.setParserPool(parserPool);
Modified: trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPSOAP11DecoderTest.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPSOAP11DecoderTest.java?rev=4547&r1=4546&r2=4547&view=diff
==============================================================================
--- trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPSOAP11DecoderTest.java (original)
+++ trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPSOAP11DecoderTest.java Fri Oct 21 14:54:18 2016
@@ -45,6 +45,7 @@
protected void setUp() throws Exception {
httpRequest = new MockHttpServletRequest();
httpRequest.setMethod("POST");
+ httpRequest.setContentType("text/xml; charset=utf-8");
decoder = new HTTPSOAP11Decoder();
decoder.setParserPool(parserPool);
Modified: trunk/opensaml-soap-impl/src/main/java/org/opensaml/soap/soap11/decoder/http/impl/HTTPSOAP11Decoder.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-soap-impl/src/main/java/org/opensaml/soap/soap11/decoder/http/impl/HTTPSOAP11Decoder.java?rev=4547&r1=4546&r2=4547&view=diff
==============================================================================
--- trunk/opensaml-soap-impl/src/main/java/org/opensaml/soap/soap11/decoder/http/impl/HTTPSOAP11Decoder.java (original)
+++ trunk/opensaml-soap-impl/src/main/java/org/opensaml/soap/soap11/decoder/http/impl/HTTPSOAP11Decoder.java Fri Oct 21 14:54:18 2016
@@ -142,7 +142,7 @@
protected void validateHttpRequest(HttpServletRequest request) throws MessageDecodingException {
super.validateHttpRequest(request);
- if (!HttpServletSupport.validateContentType(request, SUPPORTED_MEDIA_TYPES, true, false)) {
+ if (!HttpServletSupport.validateContentType(request, SUPPORTED_MEDIA_TYPES, false, false)) {
log.warn("Saw unsupported request Content-Type: {}", request.getContentType());
throw new MessageDecodingException(
String.format("Content-Type '%s' was not a supported media type", request.getContentType()));
Modified: trunk/opensaml-soap-impl/src/test/java/org/opensaml/soap/soap11/decoder/http/impl/HTTPSOAP11DecoderTest.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-soap-impl/src/test/java/org/opensaml/soap/soap11/decoder/http/impl/HTTPSOAP11DecoderTest.java?rev=4547&r1=4546&r2=4547&view=diff
==============================================================================
--- trunk/opensaml-soap-impl/src/test/java/org/opensaml/soap/soap11/decoder/http/impl/HTTPSOAP11DecoderTest.java (original)
+++ trunk/opensaml-soap-impl/src/test/java/org/opensaml/soap/soap11/decoder/http/impl/HTTPSOAP11DecoderTest.java Fri Oct 21 14:54:18 2016
@@ -108,6 +108,26 @@
}
/**
+ * Test missing content type.
+ *
+ * @throws ComponentInitializationException
+ * @throws MessageDecodingException
+ * @throws IOException
+ * @throws SecurityException
+ */
+ @Test(expectedExceptions=MessageDecodingException.class)
[... 16 lines stripped ...]
More information about the commits
mailing list