Add support to configure deflate encoding
Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/e5492d86 Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/e5492d86 Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/e5492d86 Branch: refs/heads/master Commit: e5492d86845b6bef8783d560029812bfd3664c1e Parents: b0c4e1a Author: Colm O hEigeartaigh <[email protected]> Authored: Sat Mar 26 18:15:00 2016 +0000 Committer: Colm O hEigeartaigh <[email protected]> Committed: Sat Mar 26 18:15:00 2016 +0000 ---------------------------------------------------------------------- .../fediz/service/idp/beans/samlsso/AuthnRequestParser.java | 6 +++++- .../fediz/service/idp/beans/samlsso/SamlResponseCreator.java | 2 +- .../federation/samlsso/src/test/resources/entities-realma.xml | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e5492d86/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/samlsso/AuthnRequestParser.java ---------------------------------------------------------------------- diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/samlsso/AuthnRequestParser.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/samlsso/AuthnRequestParser.java index 0f8dd49..c36f3d9 100644 --- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/samlsso/AuthnRequestParser.java +++ b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/samlsso/AuthnRequestParser.java @@ -18,6 +18,7 @@ */ package org.apache.cxf.fediz.service.idp.beans.samlsso; +import java.io.ByteArrayInputStream; import java.io.InputStream; import java.io.InputStreamReader; @@ -45,6 +46,7 @@ import org.springframework.webflow.execution.RequestContext; public class AuthnRequestParser { private static final Logger LOG = LoggerFactory.getLogger(AuthnRequestParser.class); + private boolean supportDeflateEncoding = true; public void parseSAMLRequest(RequestContext context, Idp idp, String samlRequest) throws ProcessingException { LOG.debug("Received SAML Request: {}", samlRequest); @@ -135,7 +137,9 @@ public class AuthnRequestParser { private AuthnRequest extractRequest(String samlRequest) throws Exception { byte[] deflatedToken = Base64Utility.decode(samlRequest); - InputStream tokenStream = new DeflateEncoderDecoder().inflateToken(deflatedToken); + InputStream tokenStream = supportDeflateEncoding + ? new DeflateEncoderDecoder().inflateToken(deflatedToken) + : new ByteArrayInputStream(deflatedToken); Document responseDoc = StaxUtils.read(new InputStreamReader(tokenStream, "UTF-8")); AuthnRequest request = http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e5492d86/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/samlsso/SamlResponseCreator.java ---------------------------------------------------------------------- diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/samlsso/SamlResponseCreator.java b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/samlsso/SamlResponseCreator.java index a12f257..9ba1167 100644 --- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/samlsso/SamlResponseCreator.java +++ b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/beans/samlsso/SamlResponseCreator.java @@ -61,7 +61,7 @@ import org.springframework.webflow.execution.RequestContext; public class SamlResponseCreator { private static final Logger LOG = LoggerFactory.getLogger(SamlResponseCreator.class); - private boolean supportDeflateEncoding; + private boolean supportDeflateEncoding = true; public String createSAMLResponse(RequestContext context, Idp idp, Element rpToken, String consumerURL, String requestId, String requestIssuer) http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/e5492d86/systests/federation/samlsso/src/test/resources/entities-realma.xml ---------------------------------------------------------------------- diff --git a/systests/federation/samlsso/src/test/resources/entities-realma.xml b/systests/federation/samlsso/src/test/resources/entities-realma.xml index ec7782b..83cc384 100644 --- a/systests/federation/samlsso/src/test/resources/entities-realma.xml +++ b/systests/federation/samlsso/src/test/resources/entities-realma.xml @@ -138,7 +138,7 @@ <property name="parameters"> <util:map> <entry key="sign.request" value="true" /> - <entry key="support.deflate.encoding" value="false" /> + <entry key="support.deflate.encoding" value="true" /> </util:map> </property> </bean>
