[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/e38b4c63
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/e38b4c63
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/e38b4c63

Branch: refs/heads/master
Commit: e38b4c63baee4ce383f4009e3573639910d147dd
Parents: 4a221fe
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:55 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/e38b4c63/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);

Reply via email to