Fixing build
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/0fbebbbc Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/0fbebbbc Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/0fbebbbc Branch: refs/heads/2.7.x-fixes Commit: 0fbebbbcece8560b2e62216499d99c3f8509f964 Parents: 473ce57 Author: Colm O hEigeartaigh <[email protected]> Authored: Tue Jan 13 13:41:59 2015 +0000 Committer: Colm O hEigeartaigh <[email protected]> Committed: Tue Jan 13 13:41:59 2015 +0000 ---------------------------------------------------------------------- .../saml/sso/AbstractSAMLCallbackHandler.java | 18 +----- .../saml/sso/SAMLResponseValidatorTest.java | 61 +++++++------------- .../saml/sso/SAMLSSOResponseValidatorTest.java | 50 +++++----------- 3 files changed, 37 insertions(+), 92 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/0fbebbbc/rt/rs/security/sso/saml/src/test/java/org/apache/cxf/rs/security/saml/sso/AbstractSAMLCallbackHandler.java ---------------------------------------------------------------------- diff --git a/rt/rs/security/sso/saml/src/test/java/org/apache/cxf/rs/security/saml/sso/AbstractSAMLCallbackHandler.java b/rt/rs/security/sso/saml/src/test/java/org/apache/cxf/rs/security/saml/sso/AbstractSAMLCallbackHandler.java index 55e64b2..528b7bd 100644 --- a/rt/rs/security/sso/saml/src/test/java/org/apache/cxf/rs/security/saml/sso/AbstractSAMLCallbackHandler.java +++ b/rt/rs/security/sso/saml/src/test/java/org/apache/cxf/rs/security/saml/sso/AbstractSAMLCallbackHandler.java @@ -29,7 +29,6 @@ import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; -<<<<<<< HEAD import org.apache.ws.security.WSConstants; import org.apache.ws.security.message.WSSecEncryptedKey; @@ -45,23 +44,8 @@ import org.apache.ws.security.saml.ext.bean.KeyInfoBean.CERT_IDENTIFIER; import org.apache.ws.security.saml.ext.bean.SubjectBean; import org.apache.ws.security.saml.ext.bean.SubjectConfirmationDataBean; import org.apache.ws.security.saml.ext.bean.SubjectLocalityBean; -======= -import org.apache.wss4j.common.saml.SAMLCallback; -import org.apache.wss4j.common.saml.bean.ActionBean; -import org.apache.wss4j.common.saml.bean.AttributeBean; -import org.apache.wss4j.common.saml.bean.AttributeStatementBean; -import org.apache.wss4j.common.saml.bean.AuthDecisionStatementBean; -import org.apache.wss4j.common.saml.bean.AuthenticationStatementBean; -import org.apache.wss4j.common.saml.bean.ConditionsBean; -import org.apache.wss4j.common.saml.bean.KeyInfoBean; -import org.apache.wss4j.common.saml.bean.KeyInfoBean.CERT_IDENTIFIER; -import org.apache.wss4j.common.saml.bean.SubjectBean; -import org.apache.wss4j.common.saml.bean.SubjectConfirmationDataBean; -import org.apache.wss4j.common.saml.bean.SubjectLocalityBean; -import org.apache.wss4j.dom.WSConstants; -import org.apache.wss4j.dom.message.WSSecEncryptedKey; + import org.joda.time.DateTime; ->>>>>>> f825cb0... Adding lots of SAML SSO Negative tests /** * A base implementation of a Callback Handler for a SAML assertion. By default it creates an http://git-wip-us.apache.org/repos/asf/cxf/blob/0fbebbbc/rt/rs/security/sso/saml/src/test/java/org/apache/cxf/rs/security/saml/sso/SAMLResponseValidatorTest.java ---------------------------------------------------------------------- diff --git a/rt/rs/security/sso/saml/src/test/java/org/apache/cxf/rs/security/saml/sso/SAMLResponseValidatorTest.java b/rt/rs/security/sso/saml/src/test/java/org/apache/cxf/rs/security/saml/sso/SAMLResponseValidatorTest.java index 5bb59ae..3933276 100644 --- a/rt/rs/security/sso/saml/src/test/java/org/apache/cxf/rs/security/saml/sso/SAMLResponseValidatorTest.java +++ b/rt/rs/security/sso/saml/src/test/java/org/apache/cxf/rs/security/saml/sso/SAMLResponseValidatorTest.java @@ -31,8 +31,7 @@ import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; -<<<<<<< HEAD - +import org.apache.cxf.helpers.DOMUtils; import org.apache.ws.security.WSSecurityException; import org.apache.ws.security.components.crypto.Crypto; import org.apache.ws.security.components.crypto.CryptoType; @@ -40,27 +39,13 @@ import org.apache.ws.security.components.crypto.Merlin; import org.apache.ws.security.saml.ext.AssertionWrapper; import org.apache.ws.security.saml.ext.OpenSAMLUtil; import org.apache.ws.security.saml.ext.SAMLParms; +import org.apache.ws.security.saml.ext.bean.AudienceRestrictionBean; +import org.apache.ws.security.saml.ext.bean.ConditionsBean; +import org.apache.ws.security.saml.ext.bean.SubjectConfirmationDataBean; import org.apache.ws.security.saml.ext.builder.SAML2Constants; import org.apache.ws.security.util.Loader; -======= -import org.apache.cxf.helpers.DOMUtils; -import org.apache.wss4j.common.crypto.Crypto; -import org.apache.wss4j.common.crypto.CryptoType; -import org.apache.wss4j.common.crypto.Merlin; -import org.apache.wss4j.common.ext.WSSecurityException; -import org.apache.wss4j.common.saml.OpenSAMLUtil; -import org.apache.wss4j.common.saml.SAMLCallback; -import org.apache.wss4j.common.saml.SAMLUtil; -import org.apache.wss4j.common.saml.SamlAssertionWrapper; -import org.apache.wss4j.common.saml.bean.AudienceRestrictionBean; -import org.apache.wss4j.common.saml.bean.ConditionsBean; -import org.apache.wss4j.common.saml.bean.SubjectConfirmationDataBean; -import org.apache.wss4j.common.saml.builder.SAML2Constants; -import org.apache.wss4j.common.util.Loader; -import org.apache.wss4j.dom.WSSConfig; import org.joda.time.DateTime; import org.opensaml.common.SAMLVersion; ->>>>>>> f825cb0... Adding lots of SAML SSO Negative tests import org.opensaml.common.SignableSAMLObject; import org.opensaml.common.xml.SAMLConstants; import org.opensaml.saml2.core.Response; @@ -185,9 +170,9 @@ public class SAMLResponseValidatorTest extends org.junit.Assert { callbackHandler.setIssuer("http://cxf.apache.org/issuer"); callbackHandler.setConfirmationMethod(SAML2Constants.CONF_SENDER_VOUCHES); - SAMLCallback samlCallback = new SAMLCallback(); - SAMLUtil.doSAMLCallback(callbackHandler, samlCallback); - SamlAssertionWrapper assertion = new SamlAssertionWrapper(samlCallback); + SAMLParms samlParms = new SAMLParms(); + samlParms.setCallbackHandler(callbackHandler); + AssertionWrapper assertion = new AssertionWrapper(samlParms); response.getAssertions().add(assertion.getSaml2()); @@ -287,9 +272,9 @@ public class SAMLResponseValidatorTest extends org.junit.Assert { callbackHandler.setIssuer("http://cxf.apache.org/issuer"); callbackHandler.setConfirmationMethod(SAML2Constants.CONF_SENDER_VOUCHES); - SAMLCallback samlCallback = new SAMLCallback(); - SAMLUtil.doSAMLCallback(callbackHandler, samlCallback); - SamlAssertionWrapper assertion = new SamlAssertionWrapper(samlCallback); + SAMLParms samlParms = new SAMLParms(); + samlParms.setCallbackHandler(callbackHandler); + AssertionWrapper assertion = new AssertionWrapper(samlParms); Crypto issuerCrypto = new Merlin(); KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); @@ -385,8 +370,6 @@ public class SAMLResponseValidatorTest extends org.junit.Assert { ); } -<<<<<<< HEAD -======= @org.junit.Test public void testModifiedSignedResponse() throws Exception { DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); @@ -409,9 +392,9 @@ public class SAMLResponseValidatorTest extends org.junit.Assert { callbackHandler.setIssuer("http://cxf.apache.org/issuer"); callbackHandler.setConfirmationMethod(SAML2Constants.CONF_SENDER_VOUCHES); - SAMLCallback samlCallback = new SAMLCallback(); - SAMLUtil.doSAMLCallback(callbackHandler, samlCallback); - SamlAssertionWrapper assertion = new SamlAssertionWrapper(samlCallback); + SAMLParms samlParms = new SAMLParms(); + samlParms.setCallbackHandler(callbackHandler); + AssertionWrapper assertion = new AssertionWrapper(samlParms); Crypto issuerCrypto = new Merlin(); KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); @@ -421,7 +404,7 @@ public class SAMLResponseValidatorTest extends org.junit.Assert { ((Merlin)issuerCrypto).setKeyStore(keyStore); response.getAssertions().add(assertion.getSaml2()); - signResponse(response, "alice", "password", issuerCrypto, true); + signResponse(response, "alice", "password", issuerCrypto); Element policyElement = OpenSAMLUtil.toDom(response, doc); doc.appendChild(policyElement); @@ -466,9 +449,9 @@ public class SAMLResponseValidatorTest extends org.junit.Assert { callbackHandler.setIssuer("http://cxf.apache.org/issuer"); callbackHandler.setConfirmationMethod(SAML2Constants.CONF_SENDER_VOUCHES); - SAMLCallback samlCallback = new SAMLCallback(); - SAMLUtil.doSAMLCallback(callbackHandler, samlCallback); - SamlAssertionWrapper assertion = new SamlAssertionWrapper(samlCallback); + SAMLParms samlParms = new SAMLParms(); + samlParms.setCallbackHandler(callbackHandler); + AssertionWrapper assertion = new AssertionWrapper(samlParms); Crypto issuerCrypto = new Merlin(); KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); @@ -478,7 +461,7 @@ public class SAMLResponseValidatorTest extends org.junit.Assert { ((Merlin)issuerCrypto).setKeyStore(keyStore); response.getAssertions().add(assertion.getSaml2()); - signResponse(response, "alice", "password", issuerCrypto, false); + signResponse(response, "alice", "password", issuerCrypto); Element policyElement = OpenSAMLUtil.toDom(response, doc); doc.appendChild(policyElement); @@ -488,7 +471,6 @@ public class SAMLResponseValidatorTest extends org.junit.Assert { // Validate the Response SAMLProtocolResponseValidator validator = new SAMLProtocolResponseValidator(); - validator.setKeyInfoMustBeAvailable(false); try { validator.validateSamlResponse(marshalledResponse, null, new KeystorePasswordCallback()); fail("Expected failure on no Signature Crypto"); @@ -580,7 +562,6 @@ public class SAMLResponseValidatorTest extends org.junit.Assert { } ->>>>>>> f825cb0... Adding lots of SAML SSO Negative tests /** * Sign a SAML Response */ @@ -665,9 +646,9 @@ public class SAMLResponseValidatorTest extends org.junit.Assert { ); // Create an AuthenticationAssertion - SAMLCallback samlCallback = new SAMLCallback(); - SAMLUtil.doSAMLCallback(callbackHandler, samlCallback); - SamlAssertionWrapper assertion = new SamlAssertionWrapper(samlCallback); + SAMLParms samlParms = new SAMLParms(); + samlParms.setCallbackHandler(callbackHandler); + AssertionWrapper assertion = new AssertionWrapper(samlParms); response.getAssertions().add(assertion.getSaml2()); http://git-wip-us.apache.org/repos/asf/cxf/blob/0fbebbbc/rt/rs/security/sso/saml/src/test/java/org/apache/cxf/rs/security/saml/sso/SAMLSSOResponseValidatorTest.java ---------------------------------------------------------------------- diff --git a/rt/rs/security/sso/saml/src/test/java/org/apache/cxf/rs/security/saml/sso/SAMLSSOResponseValidatorTest.java b/rt/rs/security/sso/saml/src/test/java/org/apache/cxf/rs/security/saml/sso/SAMLSSOResponseValidatorTest.java index cc57c49..11d8471 100644 --- a/rt/rs/security/sso/saml/src/test/java/org/apache/cxf/rs/security/saml/sso/SAMLSSOResponseValidatorTest.java +++ b/rt/rs/security/sso/saml/src/test/java/org/apache/cxf/rs/security/saml/sso/SAMLSSOResponseValidatorTest.java @@ -19,8 +19,6 @@ package org.apache.cxf.rs.security.saml.sso; -<<<<<<< HEAD -======= import java.io.InputStream; import java.security.KeyStore; import java.security.PrivateKey; @@ -29,36 +27,23 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; ->>>>>>> f825cb0... Adding lots of SAML SSO Negative tests import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; -<<<<<<< HEAD - import org.apache.ws.security.WSSecurityException; +import org.apache.ws.security.components.crypto.Crypto; +import org.apache.ws.security.components.crypto.CryptoType; +import org.apache.ws.security.components.crypto.Merlin; import org.apache.ws.security.saml.ext.AssertionWrapper; import org.apache.ws.security.saml.ext.OpenSAMLUtil; import org.apache.ws.security.saml.ext.SAMLParms; +import org.apache.ws.security.saml.ext.bean.AudienceRestrictionBean; import org.apache.ws.security.saml.ext.bean.ConditionsBean; import org.apache.ws.security.saml.ext.bean.SubjectConfirmationDataBean; import org.apache.ws.security.saml.ext.builder.SAML2Constants; -======= -import org.apache.wss4j.common.crypto.Crypto; -import org.apache.wss4j.common.crypto.CryptoType; -import org.apache.wss4j.common.crypto.Merlin; -import org.apache.wss4j.common.ext.WSSecurityException; -import org.apache.wss4j.common.saml.OpenSAMLUtil; -import org.apache.wss4j.common.saml.SAMLCallback; -import org.apache.wss4j.common.saml.SAMLUtil; -import org.apache.wss4j.common.saml.SamlAssertionWrapper; -import org.apache.wss4j.common.saml.bean.AudienceRestrictionBean; -import org.apache.wss4j.common.saml.bean.ConditionsBean; -import org.apache.wss4j.common.saml.bean.SubjectConfirmationDataBean; -import org.apache.wss4j.common.saml.builder.SAML2Constants; -import org.apache.wss4j.common.util.Loader; ->>>>>>> f825cb0... Adding lots of SAML SSO Negative tests +import org.apache.ws.security.util.Loader; import org.joda.time.DateTime; import org.opensaml.common.SignableSAMLObject; import org.opensaml.saml2.core.AuthnStatement; @@ -262,9 +247,9 @@ public class SAMLSSOResponseValidatorTest extends org.junit.Assert { subjectConfirmationData.setRecipient("http://recipient.apache.org"); callbackHandler.setSubjectConfirmationData(subjectConfirmationData); - SAMLCallback samlCallback = new SAMLCallback(); - SAMLUtil.doSAMLCallback(callbackHandler, samlCallback); - SamlAssertionWrapper assertion = new SamlAssertionWrapper(samlCallback); + SAMLParms samlParms = new SAMLParms(); + samlParms.setCallbackHandler(callbackHandler); + AssertionWrapper assertion = new AssertionWrapper(samlParms); response.getAssertions().add(assertion.getSaml2()); response.setDestination("xyz"); @@ -495,6 +480,7 @@ public class SAMLSSOResponseValidatorTest extends org.junit.Assert { validator.validateSamlResponse(response, false); } + @SuppressWarnings("deprecation") @org.junit.Test public void testAssertionBadIssuer() throws Exception { SubjectConfirmationDataBean subjectConfirmationData = new SubjectConfirmationDataBean(); @@ -517,11 +503,6 @@ public class SAMLSSOResponseValidatorTest extends org.junit.Assert { conditions.setAudienceURI("http://service.apache.org"); callbackHandler.setConditions(conditions); -<<<<<<< HEAD - SAMLParms samlParms = new SAMLParms(); - samlParms.setCallbackHandler(callbackHandler); - AssertionWrapper assertion = new AssertionWrapper(samlParms); -======= Response response = createResponse(subjectConfirmationData, callbackHandler); // Validate the Response @@ -586,10 +567,9 @@ public class SAMLSSOResponseValidatorTest extends org.junit.Assert { } callbackHandler.setConditions(conditions); - SAMLCallback samlCallback = new SAMLCallback(); - SAMLUtil.doSAMLCallback(callbackHandler, samlCallback); - SamlAssertionWrapper assertion = new SamlAssertionWrapper(samlCallback); ->>>>>>> f825cb0... Adding lots of SAML SSO Negative tests + SAMLParms samlParms = new SAMLParms(); + samlParms.setCallbackHandler(callbackHandler); + AssertionWrapper assertion = new AssertionWrapper(samlParms); response.getAssertions().add(assertion.getSaml2()); @@ -626,9 +606,9 @@ public class SAMLSSOResponseValidatorTest extends org.junit.Assert { ); // Create an AuthenticationAssertion - SAMLCallback samlCallback = new SAMLCallback(); - SAMLUtil.doSAMLCallback(callbackHandler, samlCallback); - SamlAssertionWrapper assertion = new SamlAssertionWrapper(samlCallback); + SAMLParms samlParms = new SAMLParms(); + samlParms.setCallbackHandler(callbackHandler); + AssertionWrapper assertion = new AssertionWrapper(samlParms); response.getAssertions().add(assertion.getSaml2());
