From 04bdec0ad0622faed6dd00b2092c1395a51050c4 Mon Sep 17 00:00:00 2001 From: ayyoob Date: Thu, 10 Sep 2015 16:02:35 +0530 Subject: [PATCH 1/2] Removed slf4j --- .../org.wso2.carbon.identity.sso.saml/pom.xml | 1 - .../SAML2HTTPRedirectDeflateSignatureValidator.java | 11 ++++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/components/sso-saml/org.wso2.carbon.identity.sso.saml/pom.xml b/components/sso-saml/org.wso2.carbon.identity.sso.saml/pom.xml index ed801ef4f1..9963a62299 100644 --- a/components/sso-saml/org.wso2.carbon.identity.sso.saml/pom.xml +++ b/components/sso-saml/org.wso2.carbon.identity.sso.saml/pom.xml @@ -113,7 +113,6 @@ org.eclipse.equinox.http.helper, org.joda.time; version="${opensaml2.wso2.osgi.version.range}", org.opensaml.*; version="${opensaml2.wso2.osgi.version.range}", - org.slf4j; version="${org.slf4j.imp.pkg.version.range}", org.apache.xerces.util; resolution:=optional, org.apache.xml.security.*; version="${wss4j.xml.security.imp.pkg.version.range}", diff --git a/components/sso-saml/org.wso2.carbon.identity.sso.saml/src/main/java/org/wso2/carbon/identity/sso/saml/validators/SAML2HTTPRedirectDeflateSignatureValidator.java b/components/sso-saml/org.wso2.carbon.identity.sso.saml/src/main/java/org/wso2/carbon/identity/sso/saml/validators/SAML2HTTPRedirectDeflateSignatureValidator.java index a7f16b89b8..e20f9dd023 100644 --- a/components/sso-saml/org.wso2.carbon.identity.sso.saml/src/main/java/org/wso2/carbon/identity/sso/saml/validators/SAML2HTTPRedirectDeflateSignatureValidator.java +++ b/components/sso-saml/org.wso2.carbon.identity.sso.saml/src/main/java/org/wso2/carbon/identity/sso/saml/validators/SAML2HTTPRedirectDeflateSignatureValidator.java @@ -32,8 +32,8 @@ import org.opensaml.xml.signature.impl.ExplicitKeySignatureTrustEngine; import org.opensaml.xml.util.Base64; import org.opensaml.xml.util.DatatypeHelper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.wso2.carbon.identity.base.IdentityException; import org.wso2.carbon.identity.sso.saml.builders.X509CredentialImpl; import org.wso2.carbon.identity.sso.saml.exception.IdentitySAML2SSOException; @@ -46,7 +46,8 @@ public class SAML2HTTPRedirectDeflateSignatureValidator implements SAML2HTTPRedirectSignatureValidator { - private final static Logger log = LoggerFactory.getLogger(SAML2HTTPRedirectDeflateSignatureValidator.class); + private final static Log log = LogFactory.getLog( + SAML2HTTPRedirectDeflateSignatureValidator.class); /** * Build a criteria set suitable for input to the trust engine. @@ -139,14 +140,14 @@ protected static byte[] getSignedContent(String queryString) throws SecurityPoli // request directly. We can't use the decoded parameters because we need // the raw // data and URL-encoding isn't canonical. - log.debug("Constructing signed content string from URL query string {}", queryString); + log.debug("Constructing signed content string from URL query string "+queryString ); String constructed = buildSignedContentString(queryString); if (DatatypeHelper.isEmpty(constructed)) { throw new SecurityPolicyException( "Could not extract signed content string from query string"); } - log.debug("Constructed signed content string for HTTP-Redirect DEFLATE {}", constructed); + log.debug("Constructed signed content string for HTTP-Redirect DEFLATE "+ constructed); try { return constructed.getBytes("UTF-8"); From 3ded9b59f59c628acf67cdcb974b53ff5b2716e9 Mon Sep 17 00:00:00 2001 From: ayyoob Date: Sun, 13 Sep 2015 00:15:27 +0530 Subject: [PATCH 2/2] added debug check before logging --- .../SAML2HTTPRedirectDeflateSignatureValidator.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/components/sso-saml/org.wso2.carbon.identity.sso.saml/src/main/java/org/wso2/carbon/identity/sso/saml/validators/SAML2HTTPRedirectDeflateSignatureValidator.java b/components/sso-saml/org.wso2.carbon.identity.sso.saml/src/main/java/org/wso2/carbon/identity/sso/saml/validators/SAML2HTTPRedirectDeflateSignatureValidator.java index e20f9dd023..3fe1e83dfa 100644 --- a/components/sso-saml/org.wso2.carbon.identity.sso.saml/src/main/java/org/wso2/carbon/identity/sso/saml/validators/SAML2HTTPRedirectDeflateSignatureValidator.java +++ b/components/sso-saml/org.wso2.carbon.identity.sso.saml/src/main/java/org/wso2/carbon/identity/sso/saml/validators/SAML2HTTPRedirectDeflateSignatureValidator.java @@ -46,8 +46,7 @@ public class SAML2HTTPRedirectDeflateSignatureValidator implements SAML2HTTPRedirectSignatureValidator { - private final static Log log = LogFactory.getLog( - SAML2HTTPRedirectDeflateSignatureValidator.class); + private final static Log log = LogFactory.getLog(SAML2HTTPRedirectDeflateSignatureValidator.class); /** * Build a criteria set suitable for input to the trust engine. @@ -140,15 +139,17 @@ protected static byte[] getSignedContent(String queryString) throws SecurityPoli // request directly. We can't use the decoded parameters because we need // the raw // data and URL-encoding isn't canonical. - log.debug("Constructing signed content string from URL query string "+queryString ); - + if (log.isDebugEnabled()) { + log.debug("Constructing signed content string from URL query string " + queryString); + } String constructed = buildSignedContentString(queryString); if (DatatypeHelper.isEmpty(constructed)) { throw new SecurityPolicyException( "Could not extract signed content string from query string"); } - log.debug("Constructed signed content string for HTTP-Redirect DEFLATE "+ constructed); - + if (log.isDebugEnabled()) { + log.debug("Constructed signed content string for HTTP-Redirect DEFLATE " + constructed); + } try { return constructed.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) {