http://git-wip-us.apache.org/repos/asf/cxf/blob/f0797a55/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueOnbehalfofUnitTest.java ---------------------------------------------------------------------- diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueOnbehalfofUnitTest.java b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueOnbehalfofUnitTest.java index 256dbb3..4811c7c 100644 --- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueOnbehalfofUnitTest.java +++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueOnbehalfofUnitTest.java @@ -78,6 +78,7 @@ import org.apache.cxf.ws.security.sts.provider.model.RequestedSecurityTokenType; import org.apache.cxf.ws.security.sts.provider.model.secext.AttributedString; import org.apache.cxf.ws.security.sts.provider.model.secext.PasswordString; import org.apache.cxf.ws.security.sts.provider.model.secext.UsernameTokenType; +import org.apache.wss4j.common.WSS4JConstants; import org.apache.wss4j.common.crypto.Crypto; import org.apache.wss4j.common.crypto.CryptoFactory; import org.apache.wss4j.common.crypto.CryptoType; @@ -86,7 +87,6 @@ import org.apache.wss4j.common.principal.CustomTokenPrincipal; import org.apache.wss4j.common.saml.SamlAssertionWrapper; import org.apache.wss4j.common.saml.builder.SAML2Constants; import org.apache.wss4j.common.util.DOM2Writer; -import org.apache.wss4j.dom.WSConstants; /** * Some unit tests for the issue operation. @@ -136,14 +136,14 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); // Get a SAML Token via the SAMLTokenProvider CallbackHandler callbackHandler = new PasswordCallbackHandler(); Element samlToken = - createSAMLAssertion(WSConstants.WSS_SAML2_TOKEN_TYPE, crypto, "mystskey", callbackHandler); + createSAMLAssertion(WSS4JConstants.WSS_SAML2_TOKEN_TYPE, crypto, "mystskey", callbackHandler); Document doc = samlToken.getOwnerDocument(); samlToken = (Element)doc.appendChild(samlToken); OnBehalfOfType onbehalfof = new OnBehalfOfType(); @@ -207,14 +207,14 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); // Get a SAML Token via the SAMLTokenProvider CallbackHandler callbackHandler = new PasswordCallbackHandler(); Element samlToken = - createSAMLAssertion(WSConstants.WSS_SAML_TOKEN_TYPE, crypto, "mystskey", callbackHandler); + createSAMLAssertion(WSS4JConstants.WSS_SAML_TOKEN_TYPE, crypto, "mystskey", callbackHandler); Document doc = samlToken.getOwnerDocument(); samlToken = (Element)doc.appendChild(samlToken); OnBehalfOfType onbehalfof = new OnBehalfOfType(); @@ -275,14 +275,14 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); // Get a SAML Token via the SAMLTokenProvider CallbackHandler callbackHandler = new PasswordCallbackHandler(); Element samlToken = - createSAMLAssertion(WSConstants.WSS_SAML2_TOKEN_TYPE, crypto, "mystskey", + createSAMLAssertion(WSS4JConstants.WSS_SAML2_TOKEN_TYPE, crypto, "mystskey", callbackHandler, null, STSConstants.SYMMETRIC_KEY_TYPE); Document doc = samlToken.getOwnerDocument(); samlToken = (Element)doc.appendChild(samlToken); @@ -356,14 +356,14 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); // Get a SAML Token via the SAMLTokenProvider CallbackHandler callbackHandler = new PasswordCallbackHandler(); Element samlToken = - createSAMLAssertion(WSConstants.WSS_SAML_TOKEN_TYPE, crypto, "mystskey", + createSAMLAssertion(WSS4JConstants.WSS_SAML_TOKEN_TYPE, crypto, "mystskey", callbackHandler, null, STSConstants.SYMMETRIC_KEY_TYPE); Document doc = samlToken.getOwnerDocument(); samlToken = (Element)doc.appendChild(samlToken); @@ -437,14 +437,14 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); // Get a SAML Token via the SAMLTokenProvider CallbackHandler callbackHandler = new PasswordCallbackHandler(); Element samlToken = - createSAMLAssertion(WSConstants.WSS_SAML2_TOKEN_TYPE, crypto, "mystskey", + createSAMLAssertion(WSS4JConstants.WSS_SAML2_TOKEN_TYPE, crypto, "mystskey", callbackHandler, null, STSConstants.PUBLIC_KEY_KEYTYPE); Document doc = samlToken.getOwnerDocument(); samlToken = (Element)doc.appendChild(samlToken); @@ -518,14 +518,14 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); // Get a SAML Token via the SAMLTokenProvider CallbackHandler callbackHandler = new PasswordCallbackHandler(); Element samlToken = - createSAMLAssertion(WSConstants.WSS_SAML_TOKEN_TYPE, crypto, "mystskey", + createSAMLAssertion(WSS4JConstants.WSS_SAML_TOKEN_TYPE, crypto, "mystskey", callbackHandler, null, STSConstants.PUBLIC_KEY_KEYTYPE); Document doc = samlToken.getOwnerDocument(); samlToken = (Element)doc.appendChild(samlToken); @@ -604,14 +604,14 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); // Get a SAML Token via the SAMLTokenProvider CallbackHandler callbackHandler = new PasswordCallbackHandler(); Element samlToken = - createSAMLAssertion(WSConstants.WSS_SAML2_TOKEN_TYPE, crypto, "mystskey", callbackHandler); + createSAMLAssertion(WSS4JConstants.WSS_SAML2_TOKEN_TYPE, crypto, "mystskey", callbackHandler); Document doc = samlToken.getOwnerDocument(); samlToken = (Element)doc.appendChild(samlToken); OnBehalfOfType onbehalfof = new OnBehalfOfType(); @@ -682,14 +682,14 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); // Get a SAML Token via the SAMLTokenProvider CallbackHandler callbackHandler = new PasswordCallbackHandler(); Element samlToken = - createSAMLAssertion(WSConstants.WSS_SAML_TOKEN_TYPE, crypto, "mystskey", callbackHandler); + createSAMLAssertion(WSS4JConstants.WSS_SAML_TOKEN_TYPE, crypto, "mystskey", callbackHandler); Document doc = samlToken.getOwnerDocument(); samlToken = (Element)doc.appendChild(samlToken); OnBehalfOfType onbehalfof = new OnBehalfOfType(); @@ -755,7 +755,7 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); @@ -833,7 +833,7 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); @@ -915,14 +915,14 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); // Get a SAML Token via the SAMLTokenProvider CallbackHandler callbackHandler = new PasswordCallbackHandler(); Element samlToken = - createSAMLAssertion(WSConstants.WSS_SAML2_TOKEN_TYPE, crypto, "mystskey", + createSAMLAssertion(WSS4JConstants.WSS_SAML2_TOKEN_TYPE, crypto, "mystskey", callbackHandler, realms, STSConstants.BEARER_KEY_KEYTYPE); Document doc = samlToken.getOwnerDocument(); samlToken = (Element)doc.appendChild(samlToken); @@ -1018,14 +1018,14 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); // Get a SAML Token via the SAMLTokenProvider CallbackHandler callbackHandler = new PasswordCallbackHandler(); Element samlToken = - createSAMLAssertion(WSConstants.WSS_SAML2_TOKEN_TYPE, crypto, "mystskey", callbackHandler); + createSAMLAssertion(WSS4JConstants.WSS_SAML2_TOKEN_TYPE, crypto, "mystskey", callbackHandler); Document doc = samlToken.getOwnerDocument(); samlToken = (Element)doc.appendChild(samlToken); OnBehalfOfType onbehalfof = new OnBehalfOfType(); @@ -1126,7 +1126,7 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); @@ -1147,7 +1147,7 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert { // Get a SAML Token via the SAMLTokenProvider CallbackHandler callbackHandler = new PasswordCallbackHandler(); Element samlToken = - createSAMLAssertion(WSConstants.WSS_SAML2_TOKEN_TYPE, crypto, "mystskey", callbackHandler); + createSAMLAssertion(WSS4JConstants.WSS_SAML2_TOKEN_TYPE, crypto, "mystskey", callbackHandler); Document doc = samlToken.getOwnerDocument(); samlToken = (Element)doc.appendChild(samlToken); OnBehalfOfType onbehalfof = new OnBehalfOfType(); @@ -1286,7 +1286,7 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert { if (password != null) { PasswordString passwordString = new PasswordString(); passwordString.setValue(password); - passwordString.setType(WSConstants.PASSWORD_TEXT); + passwordString.setType(WSS4JConstants.PASSWORD_TEXT); JAXBElement<PasswordString> passwordType = new JAXBElement<PasswordString>( QNameConstants.PASSWORD, PasswordString.class, passwordString @@ -1341,7 +1341,7 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert { claimType.setAttributeNS( null, "Uri", ClaimTypes.FIRSTNAME.toString() ); - claimType.setAttributeNS(WSConstants.XMLNS_NS, "xmlns", STSConstants.IDT_NS_05_05); + claimType.setAttributeNS(WSS4JConstants.XMLNS_NS, "xmlns", STSConstants.IDT_NS_05_05); return claimType; } @@ -1352,11 +1352,11 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert { private Element createAppliesToElement(String addressUrl) { Document doc = DOMUtils.createDocument(); Element appliesTo = doc.createElementNS(STSConstants.WSP_NS, "wsp:AppliesTo"); - appliesTo.setAttributeNS(WSConstants.XMLNS_NS, "xmlns:wsp", STSConstants.WSP_NS); + appliesTo.setAttributeNS(WSS4JConstants.XMLNS_NS, "xmlns:wsp", STSConstants.WSP_NS); Element endpointRef = doc.createElementNS(STSConstants.WSA_NS_05, "wsa:EndpointReference"); - endpointRef.setAttributeNS(WSConstants.XMLNS_NS, "xmlns:wsa", STSConstants.WSA_NS_05); + endpointRef.setAttributeNS(WSS4JConstants.XMLNS_NS, "xmlns:wsa", STSConstants.WSA_NS_05); Element address = doc.createElementNS(STSConstants.WSA_NS_05, "wsa:Address"); - address.setAttributeNS(WSConstants.XMLNS_NS, "xmlns:wsa", STSConstants.WSA_NS_05); + address.setAttributeNS(WSS4JConstants.XMLNS_NS, "xmlns:wsa", STSConstants.WSA_NS_05); address.setTextContent(addressUrl); endpointRef.appendChild(address); appliesTo.appendChild(endpointRef);
http://git-wip-us.apache.org/repos/asf/cxf/blob/f0797a55/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSCTUnitTest.java ---------------------------------------------------------------------- diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSCTUnitTest.java b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSCTUnitTest.java index 431ef20..342956b 100644 --- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSCTUnitTest.java +++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSCTUnitTest.java @@ -52,11 +52,11 @@ import org.apache.cxf.ws.security.sts.provider.model.RequestSecurityTokenType; import org.apache.cxf.ws.security.sts.provider.model.RequestedSecurityTokenType; import org.apache.cxf.ws.security.tokenstore.TokenStore; import org.apache.cxf.ws.security.trust.STSUtils; +import org.apache.wss4j.common.WSS4JConstants; import org.apache.wss4j.common.crypto.Crypto; import org.apache.wss4j.common.crypto.CryptoFactory; import org.apache.wss4j.common.principal.CustomTokenPrincipal; import org.apache.wss4j.common.util.DOM2Writer; -import org.apache.wss4j.dom.WSConstants; /** * Some unit tests for the issue operation to issue SecurityContextTokens. @@ -169,7 +169,7 @@ public class IssueSCTUnitTest extends org.junit.Assert { service.setEndpoints(Collections.singletonList("http://dummy-service.com/dummy")); EncryptionProperties encryptionProperties = new EncryptionProperties(); if (!unrestrictedPoliciesInstalled) { - encryptionProperties.setEncryptionAlgorithm(WSConstants.AES_128); + encryptionProperties.setEncryptionAlgorithm(WSS4JConstants.AES_128); } service.setEncryptionProperties(encryptionProperties); issueOperation.setServices(Collections.singletonList(service)); @@ -318,11 +318,11 @@ public class IssueSCTUnitTest extends org.junit.Assert { private Element createAppliesToElement(String addressUrl) { Document doc = DOMUtils.createDocument(); Element appliesTo = doc.createElementNS(STSConstants.WSP_NS, "wsp:AppliesTo"); - appliesTo.setAttributeNS(WSConstants.XMLNS_NS, "xmlns:wsp", STSConstants.WSP_NS); + appliesTo.setAttributeNS(WSS4JConstants.XMLNS_NS, "xmlns:wsp", STSConstants.WSP_NS); Element endpointRef = doc.createElementNS(STSConstants.WSA_NS_05, "wsa:EndpointReference"); - endpointRef.setAttributeNS(WSConstants.XMLNS_NS, "xmlns:wsa", STSConstants.WSA_NS_05); + endpointRef.setAttributeNS(WSS4JConstants.XMLNS_NS, "xmlns:wsa", STSConstants.WSA_NS_05); Element address = doc.createElementNS(STSConstants.WSA_NS_05, "wsa:Address"); - address.setAttributeNS(WSConstants.XMLNS_NS, "xmlns:wsa", STSConstants.WSA_NS_05); + address.setAttributeNS(WSS4JConstants.XMLNS_NS, "xmlns:wsa", STSConstants.WSA_NS_05); address.setTextContent(addressUrl); endpointRef.appendChild(address); appliesTo.appendChild(endpointRef); http://git-wip-us.apache.org/repos/asf/cxf/blob/f0797a55/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlClaimsUnitTest.java ---------------------------------------------------------------------- diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlClaimsUnitTest.java b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlClaimsUnitTest.java index a800e2a..045ad1e 100644 --- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlClaimsUnitTest.java +++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlClaimsUnitTest.java @@ -77,6 +77,7 @@ import org.apache.cxf.ws.security.sts.provider.model.RequestSecurityTokenRespons import org.apache.cxf.ws.security.sts.provider.model.RequestSecurityTokenResponseType; import org.apache.cxf.ws.security.sts.provider.model.RequestSecurityTokenType; import org.apache.cxf.ws.security.sts.provider.model.RequestedSecurityTokenType; +import org.apache.wss4j.common.WSS4JConstants; import org.apache.wss4j.common.crypto.Crypto; import org.apache.wss4j.common.crypto.CryptoFactory; import org.apache.wss4j.common.ext.WSSecurityException; @@ -84,7 +85,6 @@ import org.apache.wss4j.common.principal.CustomTokenPrincipal; import org.apache.wss4j.common.saml.builder.SAML1Constants; import org.apache.wss4j.common.saml.builder.SAML2Constants; import org.apache.wss4j.common.util.DOM2Writer; -import org.apache.wss4j.dom.WSConstants; /** * Some unit tests for the issue operation to issue SAML tokens with Claims information. @@ -120,7 +120,7 @@ public class IssueSamlClaimsUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML_TOKEN_TYPE ); request.getAny().add(tokenType); Element secondaryParameters = createSecondaryParameters(); @@ -181,7 +181,7 @@ public class IssueSamlClaimsUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); Element secondaryParameters = createSecondaryParameters(); @@ -244,7 +244,7 @@ public class IssueSamlClaimsUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); Element secondaryParameters = createCustomSecondaryParameters(); @@ -299,7 +299,7 @@ public class IssueSamlClaimsUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); @@ -311,7 +311,7 @@ public class IssueSamlClaimsUnitTest extends org.junit.Assert { claimType.setAttributeNS( null, "Uri", ClaimTypes.COUNTRY.toString() ); - claimType.setAttributeNS(WSConstants.XMLNS_NS, "xmlns", STSConstants.IDT_NS_05_05); + claimType.setAttributeNS(WSS4JConstants.XMLNS_NS, "xmlns", STSConstants.IDT_NS_05_05); claims.appendChild(claimType); request.getAny().add(secondaryParameters); @@ -420,7 +420,7 @@ public class IssueSamlClaimsUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML_TOKEN_TYPE ); request.getAny().add(tokenType); @@ -523,7 +523,7 @@ public class IssueSamlClaimsUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); @@ -546,7 +546,7 @@ public class IssueSamlClaimsUnitTest extends org.junit.Assert { // create a SAML Token via the SAMLTokenProvider which contains claims CallbackHandler callbackHandler = new PasswordCallbackHandler(); Element samlToken = - createSAMLAssertion(WSConstants.WSS_SAML2_TOKEN_TYPE, crypto, "mystskey", + createSAMLAssertion(WSS4JConstants.WSS_SAML2_TOKEN_TYPE, crypto, "mystskey", callbackHandler, realms); Document docToken = samlToken.getOwnerDocument(); samlToken = (Element)docToken.appendChild(samlToken); @@ -676,7 +676,7 @@ public class IssueSamlClaimsUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); @@ -699,7 +699,7 @@ public class IssueSamlClaimsUnitTest extends org.junit.Assert { // create a SAML Token via the SAMLTokenProvider which contains claims CallbackHandler callbackHandler = new PasswordCallbackHandler(); Element samlToken = - createSAMLAssertion(WSConstants.WSS_SAML2_TOKEN_TYPE, crypto, "mystskey", + createSAMLAssertion(WSS4JConstants.WSS_SAML2_TOKEN_TYPE, crypto, "mystskey", callbackHandler, realms); Document docToken = samlToken.getOwnerDocument(); samlToken = (Element)docToken.appendChild(samlToken); @@ -794,11 +794,11 @@ public class IssueSamlClaimsUnitTest extends org.junit.Assert { private Element createAppliesToElement(String addressUrl) { Document doc = DOMUtils.createDocument(); Element appliesTo = doc.createElementNS(STSConstants.WSP_NS, "wsp:AppliesTo"); - appliesTo.setAttributeNS(WSConstants.XMLNS_NS, "xmlns:wsp", STSConstants.WSP_NS); + appliesTo.setAttributeNS(WSS4JConstants.XMLNS_NS, "xmlns:wsp", STSConstants.WSP_NS); Element endpointRef = doc.createElementNS(STSConstants.WSA_NS_05, "wsa:EndpointReference"); - endpointRef.setAttributeNS(WSConstants.XMLNS_NS, "xmlns:wsa", STSConstants.WSA_NS_05); + endpointRef.setAttributeNS(WSS4JConstants.XMLNS_NS, "xmlns:wsa", STSConstants.WSA_NS_05); Element address = doc.createElementNS(STSConstants.WSA_NS_05, "wsa:Address"); - address.setAttributeNS(WSConstants.XMLNS_NS, "xmlns:wsa", STSConstants.WSA_NS_05); + address.setAttributeNS(WSS4JConstants.XMLNS_NS, "xmlns:wsa", STSConstants.WSA_NS_05); address.setTextContent(addressUrl); endpointRef.appendChild(address); appliesTo.appendChild(endpointRef); @@ -822,7 +822,7 @@ public class IssueSamlClaimsUnitTest extends org.junit.Assert { private Element createSecondaryParameters() { Document doc = DOMUtils.createDocument(); Element secondary = doc.createElementNS(STSConstants.WST_NS_05_12, "SecondaryParameters"); - secondary.setAttributeNS(WSConstants.XMLNS_NS, "xmlns", STSConstants.WST_NS_05_12); + secondary.setAttributeNS(WSS4JConstants.XMLNS_NS, "xmlns", STSConstants.WST_NS_05_12); Element claims = doc.createElementNS(STSConstants.WST_NS_05_12, "Claims"); claims.setAttributeNS(null, "Dialect", STSConstants.IDT_NS_05_05); @@ -842,7 +842,7 @@ public class IssueSamlClaimsUnitTest extends org.junit.Assert { private Element createCustomSecondaryParameters() { Document doc = DOMUtils.createDocument(); Element secondary = doc.createElementNS(STSConstants.WST_NS_05_12, "SecondaryParameters"); - secondary.setAttributeNS(WSConstants.XMLNS_NS, "xmlns", STSConstants.WST_NS_05_12); + secondary.setAttributeNS(WSS4JConstants.XMLNS_NS, "xmlns", STSConstants.WST_NS_05_12); Element claims = doc.createElementNS(STSConstants.WST_NS_05_12, "Claims"); claims.setAttributeNS(null, "Dialect", CustomClaimParser.CLAIMS_DIALECT); @@ -863,7 +863,7 @@ public class IssueSamlClaimsUnitTest extends org.junit.Assert { claimType.setAttributeNS( null, "Uri", ClaimTypes.LASTNAME.toString() ); - claimType.setAttributeNS(WSConstants.XMLNS_NS, "xmlns", STSConstants.IDT_NS_05_05); + claimType.setAttributeNS(WSS4JConstants.XMLNS_NS, "xmlns", STSConstants.IDT_NS_05_05); return claimType; } @@ -871,7 +871,7 @@ public class IssueSamlClaimsUnitTest extends org.junit.Assert { private Element createClaimValue(Document doc) { Element claimValue = doc.createElementNS(STSConstants.IDT_NS_05_05, "ClaimValue"); claimValue.setAttributeNS(null, "Uri", ROLE_CLAIM.toString()); - claimValue.setAttributeNS(WSConstants.XMLNS_NS, "xmlns", STSConstants.IDT_NS_05_05); + claimValue.setAttributeNS(WSS4JConstants.XMLNS_NS, "xmlns", STSConstants.IDT_NS_05_05); Element value = doc.createElementNS(STSConstants.IDT_NS_05_05, "Value"); value.setTextContent("administrator"); claimValue.appendChild(value); http://git-wip-us.apache.org/repos/asf/cxf/blob/f0797a55/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlRealmUnitTest.java ---------------------------------------------------------------------- diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlRealmUnitTest.java b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlRealmUnitTest.java index 69368eb..30be179 100644 --- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlRealmUnitTest.java +++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlRealmUnitTest.java @@ -51,11 +51,11 @@ import org.apache.cxf.ws.security.sts.provider.model.RequestSecurityTokenRespons import org.apache.cxf.ws.security.sts.provider.model.RequestSecurityTokenResponseType; import org.apache.cxf.ws.security.sts.provider.model.RequestSecurityTokenType; import org.apache.cxf.ws.security.sts.provider.model.RequestedSecurityTokenType; +import org.apache.wss4j.common.WSS4JConstants; import org.apache.wss4j.common.crypto.Crypto; import org.apache.wss4j.common.crypto.CryptoFactory; import org.apache.wss4j.common.principal.CustomTokenPrincipal; import org.apache.wss4j.common.util.DOM2Writer; -import org.apache.wss4j.dom.WSConstants; /** * Some unit tests for the issue operation to issue SAML tokens in a specific realm. @@ -104,7 +104,7 @@ public class IssueSamlRealmUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML_TOKEN_TYPE ); request.getAny().add(tokenType); request.getAny().add(createAppliesToElement("http://dummy-service.com/dummy")); @@ -180,7 +180,7 @@ public class IssueSamlRealmUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML_TOKEN_TYPE ); request.getAny().add(tokenType); request.getAny().add(createAppliesToElement("http://dummy-service.com/dummy")); @@ -256,7 +256,7 @@ public class IssueSamlRealmUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML_TOKEN_TYPE ); request.getAny().add(tokenType); request.getAny().add(createAppliesToElement("http://dummy-service.com/dummy")); @@ -341,7 +341,7 @@ public class IssueSamlRealmUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML_TOKEN_TYPE ); request.getAny().add(tokenType); request.getAny().add(createAppliesToElement("http://dummy-service.com/dummy")); @@ -439,7 +439,7 @@ public class IssueSamlRealmUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML_TOKEN_TYPE ); request.getAny().add(tokenType); request.getAny().add(createAppliesToElement("http://dummy-service.com/dummy")); @@ -516,11 +516,11 @@ public class IssueSamlRealmUnitTest extends org.junit.Assert { private Element createAppliesToElement(String addressUrl) { Document doc = DOMUtils.createDocument(); Element appliesTo = doc.createElementNS(STSConstants.WSP_NS, "wsp:AppliesTo"); - appliesTo.setAttributeNS(WSConstants.XMLNS_NS, "xmlns:wsp", STSConstants.WSP_NS); + appliesTo.setAttributeNS(WSS4JConstants.XMLNS_NS, "xmlns:wsp", STSConstants.WSP_NS); Element endpointRef = doc.createElementNS(STSConstants.WSA_NS_05, "wsa:EndpointReference"); - endpointRef.setAttributeNS(WSConstants.XMLNS_NS, "xmlns:wsa", STSConstants.WSA_NS_05); + endpointRef.setAttributeNS(WSS4JConstants.XMLNS_NS, "xmlns:wsa", STSConstants.WSA_NS_05); Element address = doc.createElementNS(STSConstants.WSA_NS_05, "wsa:Address"); - address.setAttributeNS(WSConstants.XMLNS_NS, "xmlns:wsa", STSConstants.WSA_NS_05); + address.setAttributeNS(WSS4JConstants.XMLNS_NS, "xmlns:wsa", STSConstants.WSA_NS_05); address.setTextContent(addressUrl); endpointRef.appendChild(address); appliesTo.appendChild(endpointRef); http://git-wip-us.apache.org/repos/asf/cxf/blob/f0797a55/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlUnitTest.java ---------------------------------------------------------------------- diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlUnitTest.java b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlUnitTest.java index b988cc6..1921924 100644 --- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlUnitTest.java +++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlUnitTest.java @@ -60,6 +60,7 @@ import org.apache.cxf.ws.security.sts.provider.model.RequestSecurityTokenRespons import org.apache.cxf.ws.security.sts.provider.model.RequestSecurityTokenType; import org.apache.cxf.ws.security.sts.provider.model.RequestedSecurityTokenType; import org.apache.cxf.ws.security.sts.provider.model.UseKeyType; +import org.apache.wss4j.common.WSS4JConstants; import org.apache.wss4j.common.crypto.Crypto; import org.apache.wss4j.common.crypto.CryptoFactory; import org.apache.wss4j.common.crypto.CryptoType; @@ -127,7 +128,7 @@ public class IssueSamlUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML_TOKEN_TYPE ); request.getAny().add(tokenType); request.getAny().add(createAppliesToElement("http://dummy-service.com/dummy")); @@ -199,7 +200,7 @@ public class IssueSamlUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); request.getAny().add(createAppliesToElement("http://dummy-service.com/dummy")); @@ -272,7 +273,7 @@ public class IssueSamlUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); request.getAny().add(createAppliesToURIElement("http://dummy-service.com/dummy")); @@ -347,7 +348,7 @@ public class IssueSamlUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML_TOKEN_TYPE ); request.getAny().add(tokenType); request.getAny().add(createAppliesToElement("http://dummy-service.com/dummy")); @@ -357,7 +358,7 @@ public class IssueSamlUnitTest extends org.junit.Assert { request = new RequestSecurityTokenType(); JAXBElement<String> tokenType2 = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType2); request.getAny().add(createAppliesToElement("http://dummy-service.com/dummy")); @@ -432,7 +433,7 @@ public class IssueSamlUnitTest extends org.junit.Assert { service.setEndpoints(Collections.singletonList("http://dummy-service.com/dummy")); EncryptionProperties encryptionProperties = new EncryptionProperties(); if (!unrestrictedPoliciesInstalled) { - encryptionProperties.setEncryptionAlgorithm(WSConstants.AES_128); + encryptionProperties.setEncryptionAlgorithm(WSS4JConstants.AES_128); } service.setEncryptionProperties(encryptionProperties); issueOperation.setServices(Collections.singletonList(service)); @@ -452,7 +453,7 @@ public class IssueSamlUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); request.getAny().add(createAppliesToElement("http://dummy-service.com/dummy")); @@ -524,7 +525,7 @@ public class IssueSamlUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML_TOKEN_TYPE ); request.getAny().add(tokenType); JAXBElement<String> keyType = @@ -615,7 +616,7 @@ public class IssueSamlUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); JAXBElement<String> keyType = @@ -713,7 +714,7 @@ public class IssueSamlUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); JAXBElement<String> keyType = @@ -805,7 +806,7 @@ public class IssueSamlUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); JAXBElement<String> keyType = @@ -829,7 +830,7 @@ public class IssueSamlUnitTest extends org.junit.Assert { WSSecEncryptedKey builder = new WSSecEncryptedKey(doc); builder.setUserInfo("mystskey"); builder.setKeyIdentifierType(WSConstants.ISSUER_SERIAL); - builder.setKeyEncAlgo(WSConstants.KEYTRANSPORT_RSAOAEP); + builder.setKeyEncAlgo(WSS4JConstants.KEYTRANSPORT_RSAOAEP); builder.prepare(stsProperties.getSignatureCrypto()); Element encryptedKeyElement = builder.getEncryptedKeyElement(); @@ -923,7 +924,7 @@ public class IssueSamlUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML_TOKEN_TYPE ); request.getAny().add(tokenType); request.getAny().add(createAppliesToElement("http://dummy-service.com/dummy")); @@ -987,8 +988,8 @@ public class IssueSamlUnitTest extends org.junit.Assert { SignatureProperties sigProperties = new SignatureProperties(); List<String> acceptedC14nAlgorithms = new ArrayList<>(); - acceptedC14nAlgorithms.add(WSConstants.C14N_EXCL_OMIT_COMMENTS); - acceptedC14nAlgorithms.add(WSConstants.C14N_EXCL_WITH_COMMENTS); + acceptedC14nAlgorithms.add(WSS4JConstants.C14N_EXCL_OMIT_COMMENTS); + acceptedC14nAlgorithms.add(WSS4JConstants.C14N_EXCL_WITH_COMMENTS); sigProperties.setAcceptedC14nAlgorithms(acceptedC14nAlgorithms); stsProperties.setSignatureProperties(sigProperties); @@ -998,13 +999,13 @@ public class IssueSamlUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); request.getAny().add(createAppliesToElement("http://dummy-service.com/dummy")); JAXBElement<String> c14nAlg = new JAXBElement<String>( - QNameConstants.C14N_ALGORITHM, String.class, WSConstants.C14N_EXCL_WITH_COMMENTS + QNameConstants.C14N_ALGORITHM, String.class, WSS4JConstants.C14N_EXCL_WITH_COMMENTS ); request.getAny().add(c14nAlg); @@ -1041,7 +1042,7 @@ public class IssueSamlUnitTest extends org.junit.Assert { assertTrue(tokenString.contains("AttributeStatement")); assertTrue(tokenString.contains("alice")); assertTrue(tokenString.contains(SAML2Constants.CONF_BEARER)); - assertTrue(tokenString.contains(WSConstants.C14N_EXCL_WITH_COMMENTS)); + assertTrue(tokenString.contains(WSS4JConstants.C14N_EXCL_WITH_COMMENTS)); } /** @@ -1079,7 +1080,7 @@ public class IssueSamlUnitTest extends org.junit.Assert { List<String> acceptedSignatureAlgorithms = new ArrayList<>(); String signatureAlgorithm = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"; acceptedSignatureAlgorithms.add(signatureAlgorithm); - acceptedSignatureAlgorithms.add(WSConstants.RSA_SHA1); + acceptedSignatureAlgorithms.add(WSS4JConstants.RSA_SHA1); sigProperties.setAcceptedSignatureAlgorithms(acceptedSignatureAlgorithms); stsProperties.setSignatureProperties(sigProperties); @@ -1089,7 +1090,7 @@ public class IssueSamlUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); request.getAny().add(createAppliesToElement("http://dummy-service.com/dummy")); @@ -1167,7 +1168,7 @@ public class IssueSamlUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); JAXBElement<String> keyType = @@ -1273,7 +1274,7 @@ public class IssueSamlUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML_TOKEN_TYPE ); request.getAny().add(tokenType); request.getAny().add(createAppliesToElement("http://dummy-service.com/dummy")); @@ -1365,7 +1366,7 @@ public class IssueSamlUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); request.getAny().add(createAppliesToElement("http://dummy-service.com/dummy")); @@ -1448,7 +1449,7 @@ public class IssueSamlUnitTest extends org.junit.Assert { private Element createAppliesToElement(String addressUrl) { Document doc = DOMUtils.createDocument(); Element appliesTo = doc.createElementNS(STSConstants.WSP_NS, "wsp:AppliesTo"); - appliesTo.setAttributeNS(WSConstants.XMLNS_NS, "xmlns:wsp", STSConstants.WSP_NS); + appliesTo.setAttributeNS(WSS4JConstants.XMLNS_NS, "xmlns:wsp", STSConstants.WSP_NS); appliesTo.appendChild(createEndpointReference(doc, addressUrl)); return appliesTo; } @@ -1456,7 +1457,7 @@ public class IssueSamlUnitTest extends org.junit.Assert { private Element createAppliesToURIElement(String addressUrl) { Document doc = DOMUtils.createDocument(); Element appliesTo = doc.createElementNS(STSConstants.WSP_NS, "wsp:AppliesTo"); - appliesTo.setAttributeNS(WSConstants.XMLNS_NS, "xmlns:wsp", STSConstants.WSP_NS); + appliesTo.setAttributeNS(WSS4JConstants.XMLNS_NS, "xmlns:wsp", STSConstants.WSP_NS); Element uri = doc.createElementNS(STSConstants.WSP_NS, "wsp:URI"); uri.setTextContent(addressUrl); @@ -1467,9 +1468,9 @@ public class IssueSamlUnitTest extends org.junit.Assert { private Element createEndpointReference(Document doc, String addressUrl) { Element endpointRef = doc.createElementNS(STSConstants.WSA_NS_05, "wsa:EndpointReference"); - endpointRef.setAttributeNS(WSConstants.XMLNS_NS, "xmlns:wsa", STSConstants.WSA_NS_05); + endpointRef.setAttributeNS(WSS4JConstants.XMLNS_NS, "xmlns:wsa", STSConstants.WSA_NS_05); Element address = doc.createElementNS(STSConstants.WSA_NS_05, "wsa:Address"); - address.setAttributeNS(WSConstants.XMLNS_NS, "xmlns:wsa", STSConstants.WSA_NS_05); + address.setAttributeNS(WSS4JConstants.XMLNS_NS, "xmlns:wsa", STSConstants.WSA_NS_05); address.setTextContent(addressUrl); endpointRef.appendChild(address); @@ -1484,9 +1485,9 @@ public class IssueSamlUnitTest extends org.junit.Assert { cryptoType.setAlias(alias); X509Certificate[] certs = crypto.getX509Certificates(cryptoType); Document doc = DOMUtils.createDocument(); - Element x509Data = doc.createElementNS(WSConstants.SIG_NS, "ds:X509Data"); - x509Data.setAttributeNS(WSConstants.XMLNS_NS, "xmlns:ds", WSConstants.SIG_NS); - Element x509Cert = doc.createElementNS(WSConstants.SIG_NS, "ds:X509Certificate"); + Element x509Data = doc.createElementNS(WSS4JConstants.SIG_NS, "ds:X509Data"); + x509Data.setAttributeNS(WSS4JConstants.XMLNS_NS, "xmlns:ds", WSS4JConstants.SIG_NS); + Element x509Cert = doc.createElementNS(WSS4JConstants.SIG_NS, "ds:X509Certificate"); Text certText = doc.createTextNode(Base64.getMimeEncoder().encodeToString(certs[0].getEncoded())); x509Cert.appendChild(certText); x509Data.appendChild(x509Cert); http://git-wip-us.apache.org/repos/asf/cxf/blob/f0797a55/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueUnitTest.java ---------------------------------------------------------------------- diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueUnitTest.java b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueUnitTest.java index 555ddfe..3ac6058 100644 --- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueUnitTest.java +++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueUnitTest.java @@ -46,8 +46,8 @@ import org.apache.cxf.ws.security.sts.provider.model.RequestSecurityTokenRespons import org.apache.cxf.ws.security.sts.provider.model.RequestSecurityTokenResponseType; import org.apache.cxf.ws.security.sts.provider.model.RequestSecurityTokenType; import org.apache.cxf.ws.security.sts.provider.model.utility.AttributedDateTime; +import org.apache.wss4j.common.WSS4JConstants; import org.apache.wss4j.common.util.DateUtil; -import org.apache.wss4j.dom.WSConstants; /** * Some unit tests for the issue operation. @@ -444,11 +444,11 @@ public class IssueUnitTest extends org.junit.Assert { private Element createAppliesToElement(String addressUrl) { Document doc = DOMUtils.createDocument(); Element appliesTo = doc.createElementNS(STSConstants.WSP_NS, "wsp:AppliesTo"); - appliesTo.setAttributeNS(WSConstants.XMLNS_NS, "xmlns:wsp", STSConstants.WSP_NS); + appliesTo.setAttributeNS(WSS4JConstants.XMLNS_NS, "xmlns:wsp", STSConstants.WSP_NS); Element endpointRef = doc.createElementNS(STSConstants.WSA_NS_05, "wsa:EndpointReference"); - endpointRef.setAttributeNS(WSConstants.XMLNS_NS, "xmlns:wsa", STSConstants.WSA_NS_05); + endpointRef.setAttributeNS(WSS4JConstants.XMLNS_NS, "xmlns:wsa", STSConstants.WSA_NS_05); Element address = doc.createElementNS(STSConstants.WSA_NS_05, "wsa:Address"); - address.setAttributeNS(WSConstants.XMLNS_NS, "xmlns:wsa", STSConstants.WSA_NS_05); + address.setAttributeNS(WSS4JConstants.XMLNS_NS, "xmlns:wsa", STSConstants.WSA_NS_05); address.setTextContent(addressUrl); endpointRef.appendChild(address); appliesTo.appendChild(endpointRef); http://git-wip-us.apache.org/repos/asf/cxf/blob/f0797a55/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/RenewSamlUnitTest.java ---------------------------------------------------------------------- diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/RenewSamlUnitTest.java b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/RenewSamlUnitTest.java index e9ca631..43d02d3 100644 --- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/RenewSamlUnitTest.java +++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/RenewSamlUnitTest.java @@ -59,6 +59,7 @@ import org.apache.cxf.ws.security.sts.provider.model.RequestSecurityTokenRespons import org.apache.cxf.ws.security.sts.provider.model.RequestSecurityTokenType; import org.apache.cxf.ws.security.sts.provider.model.RequestedSecurityTokenType; import org.apache.cxf.ws.security.tokenstore.TokenStore; +import org.apache.wss4j.common.WSS4JConstants; import org.apache.wss4j.common.crypto.Crypto; import org.apache.wss4j.common.crypto.CryptoFactory; import org.apache.wss4j.common.ext.WSSecurityException; @@ -67,7 +68,6 @@ import org.apache.wss4j.common.saml.builder.SAML1Constants; import org.apache.wss4j.common.saml.builder.SAML2Constants; import org.apache.wss4j.common.util.DOM2Writer; import org.apache.wss4j.common.util.DateUtil; -import org.apache.wss4j.dom.WSConstants; import org.junit.BeforeClass; /** @@ -128,7 +128,7 @@ public class RenewSamlUnitTest extends org.junit.Assert { CallbackHandler callbackHandler = new PasswordCallbackHandler(); Element samlToken = createSAMLAssertion( - WSConstants.WSS_SAML_TOKEN_TYPE, crypto, "mystskey", callbackHandler, 50000, true, false + WSS4JConstants.WSS_SAML_TOKEN_TYPE, crypto, "mystskey", callbackHandler, 50000, true, false ); Document doc = samlToken.getOwnerDocument(); @@ -220,7 +220,7 @@ public class RenewSamlUnitTest extends org.junit.Assert { CallbackHandler callbackHandler = new PasswordCallbackHandler(); Element samlToken = createSAMLAssertion( - WSConstants.WSS_SAML_TOKEN_TYPE, crypto, "mystskey", callbackHandler, 50, true, true + WSS4JConstants.WSS_SAML_TOKEN_TYPE, crypto, "mystskey", callbackHandler, 50, true, true ); // Sleep to expire the token Thread.sleep(100); @@ -314,7 +314,7 @@ public class RenewSamlUnitTest extends org.junit.Assert { CallbackHandler callbackHandler = new PasswordCallbackHandler(); Element samlToken = createSAMLAssertion( - WSConstants.WSS_SAML2_TOKEN_TYPE, crypto, "mystskey", callbackHandler, 50, true, true + WSS4JConstants.WSS_SAML2_TOKEN_TYPE, crypto, "mystskey", callbackHandler, 50, true, true ); // Sleep to expire the token Thread.sleep(100); @@ -403,7 +403,7 @@ public class RenewSamlUnitTest extends org.junit.Assert { CallbackHandler callbackHandler = new PasswordCallbackHandler(); Element samlToken = createSAMLAssertion( - WSConstants.WSS_SAML2_TOKEN_TYPE, crypto, "mystskey", callbackHandler, 50, true, true + WSS4JConstants.WSS_SAML2_TOKEN_TYPE, crypto, "mystskey", callbackHandler, 50, true, true ); // Sleep to expire the token Thread.sleep(100); http://git-wip-us.apache.org/repos/asf/cxf/blob/f0797a55/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateJWTTransformationTest.java ---------------------------------------------------------------------- diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateJWTTransformationTest.java b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateJWTTransformationTest.java index c63b06c..235ea5b 100644 --- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateJWTTransformationTest.java +++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateJWTTransformationTest.java @@ -72,13 +72,13 @@ import org.apache.cxf.ws.security.sts.provider.model.RequestSecurityTokenType; import org.apache.cxf.ws.security.sts.provider.model.RequestedSecurityTokenType; import org.apache.cxf.ws.security.sts.provider.model.StatusType; import org.apache.cxf.ws.security.sts.provider.model.ValidateTargetType; +import org.apache.wss4j.common.WSS4JConstants; import org.apache.wss4j.common.crypto.Crypto; import org.apache.wss4j.common.crypto.CryptoFactory; import org.apache.wss4j.common.ext.WSSecurityException; import org.apache.wss4j.common.principal.CustomTokenPrincipal; import org.apache.wss4j.common.saml.builder.SAML2Constants; import org.apache.wss4j.common.util.DOM2Writer; -import org.apache.wss4j.dom.WSConstants; import org.junit.Assert; /** @@ -120,7 +120,7 @@ public class ValidateJWTTransformationTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); @@ -206,7 +206,7 @@ public class ValidateJWTTransformationTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); @@ -301,7 +301,7 @@ public class ValidateJWTTransformationTest extends org.junit.Assert { // Create a SAML Token Element samlToken = - createSAMLAssertion(WSConstants.WSS_SAML2_TOKEN_TYPE, crypto, "mystskey", + createSAMLAssertion(WSS4JConstants.WSS_SAML2_TOKEN_TYPE, crypto, "mystskey", new PasswordCallbackHandler()); Document doc = samlToken.getOwnerDocument(); samlToken = (Element)doc.appendChild(samlToken); http://git-wip-us.apache.org/repos/asf/cxf/blob/f0797a55/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateSamlUnitTest.java ---------------------------------------------------------------------- diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateSamlUnitTest.java b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateSamlUnitTest.java index 43ee512..4a0ff2f 100644 --- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateSamlUnitTest.java +++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateSamlUnitTest.java @@ -51,11 +51,11 @@ import org.apache.cxf.ws.security.sts.provider.model.RequestSecurityTokenRespons import org.apache.cxf.ws.security.sts.provider.model.RequestSecurityTokenType; import org.apache.cxf.ws.security.sts.provider.model.StatusType; import org.apache.cxf.ws.security.sts.provider.model.ValidateTargetType; +import org.apache.wss4j.common.WSS4JConstants; import org.apache.wss4j.common.crypto.Crypto; import org.apache.wss4j.common.crypto.CryptoFactory; import org.apache.wss4j.common.ext.WSSecurityException; import org.apache.wss4j.common.principal.CustomTokenPrincipal; -import org.apache.wss4j.dom.WSConstants; /** * Some unit tests for the validate operation to validate SAML tokens. @@ -101,7 +101,7 @@ public class ValidateSamlUnitTest extends org.junit.Assert { // Get a SAML Token via the SAMLTokenProvider CallbackHandler callbackHandler = new PasswordCallbackHandler(); Element samlToken = - createSAMLAssertion(WSConstants.WSS_SAML_TOKEN_TYPE, crypto, "mystskey", callbackHandler); + createSAMLAssertion(WSS4JConstants.WSS_SAML_TOKEN_TYPE, crypto, "mystskey", callbackHandler); Document doc = samlToken.getOwnerDocument(); samlToken = (Element)doc.appendChild(samlToken); ValidateTargetType validateTarget = new ValidateTargetType(); @@ -162,7 +162,7 @@ public class ValidateSamlUnitTest extends org.junit.Assert { // Get a SAML Token via the SAMLTokenProvider CallbackHandler callbackHandler = new PasswordCallbackHandler(); Element samlToken = - createSAMLAssertion(WSConstants.WSS_SAML2_TOKEN_TYPE, crypto, "mystskey", callbackHandler); + createSAMLAssertion(WSS4JConstants.WSS_SAML2_TOKEN_TYPE, crypto, "mystskey", callbackHandler); Document doc = samlToken.getOwnerDocument(); samlToken = (Element)doc.appendChild(samlToken); ValidateTargetType validateTarget = new ValidateTargetType(); http://git-wip-us.apache.org/repos/asf/cxf/blob/f0797a55/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateTokenTransformationUnitTest.java ---------------------------------------------------------------------- diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateTokenTransformationUnitTest.java b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateTokenTransformationUnitTest.java index 0c145f8..2bdf02c 100644 --- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateTokenTransformationUnitTest.java +++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateTokenTransformationUnitTest.java @@ -76,13 +76,13 @@ import org.apache.cxf.ws.security.sts.provider.model.ValidateTargetType; import org.apache.cxf.ws.security.sts.provider.model.secext.AttributedString; import org.apache.cxf.ws.security.sts.provider.model.secext.PasswordString; import org.apache.cxf.ws.security.sts.provider.model.secext.UsernameTokenType; +import org.apache.wss4j.common.WSS4JConstants; import org.apache.wss4j.common.crypto.Crypto; import org.apache.wss4j.common.crypto.CryptoFactory; import org.apache.wss4j.common.ext.WSSecurityException; import org.apache.wss4j.common.principal.CustomTokenPrincipal; import org.apache.wss4j.common.saml.builder.SAML2Constants; import org.apache.wss4j.common.util.DOM2Writer; -import org.apache.wss4j.dom.WSConstants; /** * In this test, a token (UsernameToken or SAMLToken) is validated and transformed into a SAML Assertion. @@ -126,7 +126,7 @@ public class ValidateTokenTransformationUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); @@ -212,7 +212,7 @@ public class ValidateTokenTransformationUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); @@ -371,7 +371,7 @@ public class ValidateTokenTransformationUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); @@ -394,7 +394,7 @@ public class ValidateTokenTransformationUnitTest extends org.junit.Assert { // create a SAML Token via the SAMLTokenProvider which contains claims CallbackHandler callbackHandler = new PasswordCallbackHandler(); Element samlToken = - createSAMLAssertion(WSConstants.WSS_SAML2_TOKEN_TYPE, crypto, "mystskey", + createSAMLAssertion(WSS4JConstants.WSS_SAML2_TOKEN_TYPE, crypto, "mystskey", callbackHandler, realms); Document docToken = samlToken.getOwnerDocument(); samlToken = (Element)docToken.appendChild(samlToken); @@ -489,7 +489,7 @@ public class ValidateTokenTransformationUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); Object claims = @@ -599,7 +599,7 @@ public class ValidateTokenTransformationUnitTest extends org.junit.Assert { RequestSecurityTokenType request = new RequestSecurityTokenType(); JAXBElement<String> tokenType = new JAXBElement<String>( - QNameConstants.TOKEN_TYPE, String.class, WSConstants.WSS_SAML2_TOKEN_TYPE + QNameConstants.TOKEN_TYPE, String.class, WSS4JConstants.WSS_SAML2_TOKEN_TYPE ); request.getAny().add(tokenType); @@ -622,7 +622,7 @@ public class ValidateTokenTransformationUnitTest extends org.junit.Assert { // create a SAML Token via the SAMLTokenProvider which contains claims CallbackHandler callbackHandler = new PasswordCallbackHandler(); Element samlToken = - createSAMLAssertion(WSConstants.WSS_SAML2_TOKEN_TYPE, crypto, "mystskey", + createSAMLAssertion(WSS4JConstants.WSS_SAML2_TOKEN_TYPE, crypto, "mystskey", callbackHandler, realms); Document docToken = samlToken.getOwnerDocument(); samlToken = (Element)docToken.appendChild(samlToken); @@ -764,7 +764,7 @@ public class ValidateTokenTransformationUnitTest extends org.junit.Assert { // Add a password PasswordString passwordString = new PasswordString(); passwordString.setValue(password); - passwordString.setType(WSConstants.PASSWORD_TEXT); + passwordString.setType(WSS4JConstants.PASSWORD_TEXT); JAXBElement<PasswordString> passwordType = new JAXBElement<PasswordString>( QNameConstants.PASSWORD, PasswordString.class, passwordString @@ -799,7 +799,7 @@ public class ValidateTokenTransformationUnitTest extends org.junit.Assert { private Element createClaimsElementInSecondaryParameters() { Document doc = DOMUtils.createDocument(); Element secondary = doc.createElementNS(STSConstants.WST_NS_05_12, "SecondaryParameters"); - secondary.setAttributeNS(WSConstants.XMLNS_NS, "xmlns", STSConstants.WST_NS_05_12); + secondary.setAttributeNS(WSS4JConstants.XMLNS_NS, "xmlns", STSConstants.WST_NS_05_12); Element claims = doc.createElementNS(STSConstants.WST_NS_05_12, "Claims"); claims.setAttributeNS(null, "Dialect", STSConstants.IDT_NS_05_05); @@ -817,7 +817,7 @@ public class ValidateTokenTransformationUnitTest extends org.junit.Assert { claimType.setAttributeNS( null, "Uri", ClaimTypes.LASTNAME.toString() ); - claimType.setAttributeNS(WSConstants.XMLNS_NS, "xmlns", STSConstants.IDT_NS_05_05); + claimType.setAttributeNS(WSS4JConstants.XMLNS_NS, "xmlns", STSConstants.IDT_NS_05_05); return claimType; } http://git-wip-us.apache.org/repos/asf/cxf/blob/f0797a55/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateUsernameTokenUnitTest.java ---------------------------------------------------------------------- diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateUsernameTokenUnitTest.java b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateUsernameTokenUnitTest.java index 918b369..0e8dee1 100644 --- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateUsernameTokenUnitTest.java +++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateUsernameTokenUnitTest.java @@ -43,10 +43,10 @@ import org.apache.cxf.ws.security.sts.provider.model.ValidateTargetType; import org.apache.cxf.ws.security.sts.provider.model.secext.AttributedString; import org.apache.cxf.ws.security.sts.provider.model.secext.PasswordString; import org.apache.cxf.ws.security.sts.provider.model.secext.UsernameTokenType; +import org.apache.wss4j.common.WSS4JConstants; import org.apache.wss4j.common.crypto.Crypto; import org.apache.wss4j.common.crypto.CryptoFactory; import org.apache.wss4j.common.principal.CustomTokenPrincipal; -import org.apache.wss4j.dom.WSConstants; /** * Some unit tests for the validate operation to validate UsernameTokens. @@ -227,7 +227,7 @@ public class ValidateUsernameTokenUnitTest extends org.junit.Assert { // Add a password PasswordString passwordString = new PasswordString(); passwordString.setValue(password); - passwordString.setType(WSConstants.PASSWORD_TEXT); + passwordString.setType(WSS4JConstants.PASSWORD_TEXT); JAXBElement<PasswordString> passwordType = new JAXBElement<PasswordString>( QNameConstants.PASSWORD, PasswordString.class, passwordString http://git-wip-us.apache.org/repos/asf/cxf/blob/f0797a55/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateX509TokenUnitTest.java ---------------------------------------------------------------------- diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateX509TokenUnitTest.java b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateX509TokenUnitTest.java index 44c49cb..efe2b8e 100644 --- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateX509TokenUnitTest.java +++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateX509TokenUnitTest.java @@ -43,11 +43,11 @@ import org.apache.cxf.ws.security.sts.provider.model.RequestSecurityTokenType; import org.apache.cxf.ws.security.sts.provider.model.StatusType; import org.apache.cxf.ws.security.sts.provider.model.ValidateTargetType; import org.apache.cxf.ws.security.sts.provider.model.secext.BinarySecurityTokenType; +import org.apache.wss4j.common.WSS4JConstants; import org.apache.wss4j.common.crypto.Crypto; import org.apache.wss4j.common.crypto.CryptoFactory; import org.apache.wss4j.common.crypto.CryptoType; import org.apache.wss4j.common.principal.CustomTokenPrincipal; -import org.apache.wss4j.dom.WSConstants; /** * Some unit tests for the validate operation to validate X.509 tokens. @@ -249,7 +249,7 @@ public class ValidateX509TokenUnitTest extends org.junit.Assert { BinarySecurityTokenType binarySecurityToken = new BinarySecurityTokenType(); binarySecurityToken.setValue(Base64.getMimeEncoder().encodeToString(cert.getEncoded())); binarySecurityToken.setValueType(X509TokenValidator.X509_V3_TYPE); - binarySecurityToken.setEncodingType(WSConstants.SOAPMESSAGE_NS + "#Base64Binary"); + binarySecurityToken.setEncodingType(WSS4JConstants.SOAPMESSAGE_NS + "#Base64Binary"); return new JAXBElement<BinarySecurityTokenType>( QNameConstants.BINARY_SECURITY_TOKEN, BinarySecurityTokenType.class, binarySecurityToken ); http://git-wip-us.apache.org/repos/asf/cxf/blob/f0797a55/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/CustomAuthenticationProvider.java ---------------------------------------------------------------------- diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/CustomAuthenticationProvider.java b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/CustomAuthenticationProvider.java index 3838620..dfc5746 100644 --- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/CustomAuthenticationProvider.java +++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/CustomAuthenticationProvider.java @@ -18,11 +18,11 @@ */ package org.apache.cxf.sts.token.provider; +import org.apache.wss4j.common.WSS4JConstants; import org.apache.wss4j.common.saml.bean.AuthenticationStatementBean; import org.apache.wss4j.common.saml.bean.SubjectLocalityBean; import org.apache.wss4j.common.saml.builder.SAML1Constants; import org.apache.wss4j.common.saml.builder.SAML2Constants; -import org.apache.wss4j.dom.WSConstants; /** * A custom AuthenticationStatementProvider implementation for use in the tests. @@ -39,7 +39,7 @@ public class CustomAuthenticationProvider implements AuthenticationStatementProv subjectLocality.setIpAddress("127.0.0.1"); authBean.setSubjectLocality(subjectLocality); - if (WSConstants.WSS_SAML_TOKEN_TYPE.equals( + if (WSS4JConstants.WSS_SAML_TOKEN_TYPE.equals( providerParameters.getTokenRequirements().getTokenType())) { authBean.setAuthenticationMethod(SAML1Constants.AUTH_METHOD_X509); } else { http://git-wip-us.apache.org/repos/asf/cxf/blob/f0797a55/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/CustomSubjectProvider.java ---------------------------------------------------------------------- diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/CustomSubjectProvider.java b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/CustomSubjectProvider.java index 1855ccb..ec521d8 100644 --- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/CustomSubjectProvider.java +++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/CustomSubjectProvider.java @@ -23,10 +23,10 @@ import java.security.Principal; import org.apache.cxf.sts.STSConstants; import org.apache.cxf.sts.request.KeyRequirements; import org.apache.cxf.sts.request.TokenRequirements; +import org.apache.wss4j.common.WSS4JConstants; import org.apache.wss4j.common.saml.bean.SubjectBean; import org.apache.wss4j.common.saml.builder.SAML1Constants; import org.apache.wss4j.common.saml.builder.SAML2Constants; -import org.apache.wss4j.dom.WSConstants; /** * A test implementation of SubjectProvider. @@ -55,8 +55,8 @@ public class CustomSubjectProvider implements SubjectProvider { * Get the SubjectConfirmation method given a tokenType and keyType */ private String getSubjectConfirmationMethod(String tokenType, String keyType) { - if (WSConstants.WSS_SAML2_TOKEN_TYPE.equals(tokenType) - || WSConstants.SAML2_NS.equals(tokenType)) { + if (WSS4JConstants.WSS_SAML2_TOKEN_TYPE.equals(tokenType) + || WSS4JConstants.SAML2_NS.equals(tokenType)) { if (STSConstants.SYMMETRIC_KEY_KEYTYPE.equals(keyType) || STSConstants.PUBLIC_KEY_KEYTYPE.equals(keyType)) { return SAML2Constants.CONF_HOLDER_KEY; http://git-wip-us.apache.org/repos/asf/cxf/blob/f0797a55/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/JWTProviderActAsTest.java ---------------------------------------------------------------------- diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/JWTProviderActAsTest.java b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/JWTProviderActAsTest.java index 342dfec..3bc7620 100644 --- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/JWTProviderActAsTest.java +++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/JWTProviderActAsTest.java @@ -41,11 +41,11 @@ import org.apache.cxf.sts.service.EncryptionProperties; import org.apache.cxf.sts.token.provider.jwt.JWTTokenProvider; import org.apache.cxf.ws.security.sts.provider.model.secext.AttributedString; import org.apache.cxf.ws.security.sts.provider.model.secext.UsernameTokenType; +import org.apache.wss4j.common.WSS4JConstants; import org.apache.wss4j.common.crypto.Crypto; import org.apache.wss4j.common.crypto.CryptoFactory; import org.apache.wss4j.common.ext.WSSecurityException; import org.apache.wss4j.common.principal.CustomTokenPrincipal; -import org.apache.wss4j.dom.WSConstants; import org.junit.Assert; /** @@ -128,10 +128,10 @@ public class JWTProviderActAsTest extends org.junit.Assert { private Element getSAMLAssertion(String user) throws Exception { TokenProvider samlTokenProvider = new SAMLTokenProvider(); TokenProviderParameters providerParameters = - createProviderParameters(WSConstants.WSS_SAML_TOKEN_TYPE, null); + createProviderParameters(WSS4JConstants.WSS_SAML_TOKEN_TYPE, null); providerParameters.getKeyRequirements().setKeyType(STSConstants.BEARER_KEY_KEYTYPE); providerParameters.setPrincipal(new CustomTokenPrincipal(user)); - assertTrue(samlTokenProvider.canHandleToken(WSConstants.WSS_SAML_TOKEN_TYPE)); + assertTrue(samlTokenProvider.canHandleToken(WSS4JConstants.WSS_SAML_TOKEN_TYPE)); TokenProviderResponse providerResponse = samlTokenProvider.createToken(providerParameters); assertTrue(providerResponse != null); assertTrue(providerResponse.getToken() != null && providerResponse.getTokenId() != null); http://git-wip-us.apache.org/repos/asf/cxf/blob/f0797a55/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/JWTProviderOnBehalfOfTest.java ---------------------------------------------------------------------- diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/JWTProviderOnBehalfOfTest.java b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/JWTProviderOnBehalfOfTest.java index 1565486..056a39a 100644 --- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/JWTProviderOnBehalfOfTest.java +++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/provider/JWTProviderOnBehalfOfTest.java @@ -41,11 +41,11 @@ import org.apache.cxf.sts.service.EncryptionProperties; import org.apache.cxf.sts.token.provider.jwt.JWTTokenProvider; import org.apache.cxf.ws.security.sts.provider.model.secext.AttributedString; import org.apache.cxf.ws.security.sts.provider.model.secext.UsernameTokenType; +import org.apache.wss4j.common.WSS4JConstants; import org.apache.wss4j.common.crypto.Crypto; import org.apache.wss4j.common.crypto.CryptoFactory; import org.apache.wss4j.common.ext.WSSecurityException; import org.apache.wss4j.common.principal.CustomTokenPrincipal; -import org.apache.wss4j.dom.WSConstants; import org.junit.Assert; /** @@ -126,10 +126,10 @@ public class JWTProviderOnBehalfOfTest extends org.junit.Assert { private Element getSAMLAssertion(String user) throws Exception { TokenProvider samlTokenProvider = new SAMLTokenProvider(); TokenProviderParameters providerParameters = - createProviderParameters(WSConstants.WSS_SAML_TOKEN_TYPE, null); + createProviderParameters(WSS4JConstants.WSS_SAML_TOKEN_TYPE, null); providerParameters.getKeyRequirements().setKeyType(STSConstants.BEARER_KEY_KEYTYPE); providerParameters.setPrincipal(new CustomTokenPrincipal(user)); - assertTrue(samlTokenProvider.canHandleToken(WSConstants.WSS_SAML_TOKEN_TYPE)); + assertTrue(samlTokenProvider.canHandleToken(WSS4JConstants.WSS_SAML_TOKEN_TYPE)); TokenProviderResponse providerResponse = samlTokenProvider.createToken(providerParameters); assertTrue(providerResponse != null); assertTrue(providerResponse.getToken() != null && providerResponse.getTokenId() != null);