[SYNCOPE-1061] Better check
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/ad8e197b Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/ad8e197b Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/ad8e197b Branch: refs/heads/SYNCOPE-808 Commit: ad8e197b255f78a4147019942abe5dac71b2f46f Parents: b702803 Author: Francesco Chicchiriccò <ilgro...@apache.org> Authored: Thu Apr 13 15:53:41 2017 +0200 Committer: Francesco Chicchiriccò <ilgro...@apache.org> Committed: Thu Apr 13 15:53:41 2017 +0200 ---------------------------------------------------------------------- .../syncope/ext/saml2lsp/agent/AbstractSAML2SPServlet.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/syncope/blob/ad8e197b/ext/saml2sp/agent/src/main/java/org/apache/syncope/ext/saml2lsp/agent/AbstractSAML2SPServlet.java ---------------------------------------------------------------------- diff --git a/ext/saml2sp/agent/src/main/java/org/apache/syncope/ext/saml2lsp/agent/AbstractSAML2SPServlet.java b/ext/saml2sp/agent/src/main/java/org/apache/syncope/ext/saml2lsp/agent/AbstractSAML2SPServlet.java index bd295e3..d84bcd7 100644 --- a/ext/saml2sp/agent/src/main/java/org/apache/syncope/ext/saml2lsp/agent/AbstractSAML2SPServlet.java +++ b/ext/saml2sp/agent/src/main/java/org/apache/syncope/ext/saml2lsp/agent/AbstractSAML2SPServlet.java @@ -28,6 +28,7 @@ import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.UriBuilder; +import org.apache.commons.lang3.StringUtils; import org.apache.cxf.helpers.IOUtils; import org.apache.cxf.jaxrs.utils.JAXRSUtils; import org.apache.syncope.common.lib.SSOConstants; @@ -79,9 +80,11 @@ public abstract class AbstractSAML2SPServlet extends HttpServlet { String strForm = IOUtils.toString(response); MultivaluedMap<String, String> params = JAXRSUtils.getStructuredParams(strForm, "&", false, false); - String samlResponse = URLDecoder.decode( - params.getFirst(SSOConstants.SAML_RESPONSE), StandardCharsets.UTF_8.name()); - LOG.debug("Received SAML Response: {}", samlResponse); + String samlResponse = params.getFirst(SSOConstants.SAML_RESPONSE); + if (StringUtils.isNotBlank(samlResponse)) { + samlResponse = URLDecoder.decode(samlResponse, StandardCharsets.UTF_8.name()); + LOG.debug("Received SAML Response: {}", samlResponse); + } String relayState = params.getFirst(SSOConstants.RELAY_STATE); LOG.debug("Received Relay State: {}", relayState);