Modified: cxf/branches/wss4j2.0-port/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/AbstractXmlEncInHandler.java URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/AbstractXmlEncInHandler.java?rev=1453430&r1=1453429&r2=1453430&view=diff ============================================================================== --- cxf/branches/wss4j2.0-port/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/AbstractXmlEncInHandler.java (original) +++ cxf/branches/wss4j2.0-port/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/AbstractXmlEncInHandler.java Wed Mar 6 17:04:10 2013 @@ -42,15 +42,14 @@ import org.apache.cxf.rs.security.common import org.apache.cxf.rs.security.common.TrustValidator; import org.apache.cxf.staxutils.W3CDOMStreamReader; import org.apache.cxf.ws.security.SecurityConstants; -import org.apache.ws.security.WSConstants; -import org.apache.ws.security.WSSecurityException; -import org.apache.ws.security.components.crypto.Crypto; -import org.apache.ws.security.util.WSSecurityUtil; +import org.apache.wss4j.common.crypto.Crypto; +import org.apache.wss4j.common.ext.WSSecurityException; +import org.apache.wss4j.dom.WSConstants; +import org.apache.wss4j.dom.util.WSSecurityUtil; import org.apache.xml.security.encryption.XMLCipher; import org.apache.xml.security.encryption.XMLEncryptionException; import org.apache.xml.security.utils.Constants; - public abstract class AbstractXmlEncInHandler extends AbstractXmlSecInHandler { private EncryptionProperties encProps; @@ -265,9 +264,7 @@ public abstract class AbstractXmlEncInHa EncryptionUtils.initXMLCipher(symEncAlgo, XMLCipher.DECRYPT_MODE, key); return xmlCipher.decryptToByteArray(root); } catch (XMLEncryptionException ex) { - throw new WSSecurityException( - WSSecurityException.UNSUPPORTED_ALGORITHM, null, null, ex - ); + throw new WSSecurityException(WSSecurityException.ErrorCode.UNSUPPORTED_ALGORITHM, ex); } }
Modified: cxf/branches/wss4j2.0-port/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/AbstractXmlSecInHandler.java URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/AbstractXmlSecInHandler.java?rev=1453430&r1=1453429&r2=1453430&view=diff ============================================================================== --- cxf/branches/wss4j2.0-port/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/AbstractXmlSecInHandler.java (original) +++ cxf/branches/wss4j2.0-port/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/AbstractXmlSecInHandler.java Wed Mar 6 17:04:10 2013 @@ -35,7 +35,7 @@ import org.apache.cxf.common.logging.Log import org.apache.cxf.helpers.DOMUtils; import org.apache.cxf.message.Message; import org.apache.cxf.staxutils.W3CDOMStreamReader; -import org.apache.ws.security.WSSConfig; +import org.apache.wss4j.dom.WSSConfig; public abstract class AbstractXmlSecInHandler { Modified: cxf/branches/wss4j2.0-port/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/AbstractXmlSecOutInterceptor.java URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/AbstractXmlSecOutInterceptor.java?rev=1453430&r1=1453429&r2=1453430&view=diff ============================================================================== --- cxf/branches/wss4j2.0-port/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/AbstractXmlSecOutInterceptor.java (original) +++ cxf/branches/wss4j2.0-port/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/AbstractXmlSecOutInterceptor.java Wed Mar 6 17:04:10 2013 @@ -40,7 +40,7 @@ import org.apache.cxf.message.MessageCon import org.apache.cxf.phase.AbstractPhaseInterceptor; import org.apache.cxf.phase.Phase; import org.apache.cxf.staxutils.W3CDOMStreamWriter; -import org.apache.ws.security.WSSConfig; +import org.apache.wss4j.dom.WSSConfig; public abstract class AbstractXmlSecOutInterceptor extends AbstractPhaseInterceptor<Message> { Modified: cxf/branches/wss4j2.0-port/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/AbstractXmlSigInHandler.java URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/AbstractXmlSigInHandler.java?rev=1453430&r1=1453429&r2=1453430&view=diff ============================================================================== --- cxf/branches/wss4j2.0-port/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/AbstractXmlSigInHandler.java (original) +++ cxf/branches/wss4j2.0-port/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/AbstractXmlSigInHandler.java Wed Mar 6 17:04:10 2013 @@ -36,8 +36,8 @@ import org.apache.cxf.rs.security.common import org.apache.cxf.rs.security.common.TrustValidator; import org.apache.cxf.staxutils.W3CDOMStreamReader; import org.apache.cxf.ws.security.SecurityConstants; -import org.apache.ws.security.WSConstants; -import org.apache.ws.security.components.crypto.Crypto; +import org.apache.wss4j.common.crypto.Crypto; +import org.apache.wss4j.dom.WSConstants; import org.apache.xml.security.exceptions.XMLSecurityException; import org.apache.xml.security.keys.KeyInfo; import org.apache.xml.security.signature.Reference; Modified: cxf/branches/wss4j2.0-port/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/EncryptionUtils.java URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/EncryptionUtils.java?rev=1453430&r1=1453429&r2=1453430&view=diff ============================================================================== --- cxf/branches/wss4j2.0-port/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/EncryptionUtils.java (original) +++ cxf/branches/wss4j2.0-port/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/EncryptionUtils.java Wed Mar 6 17:04:10 2013 @@ -28,8 +28,8 @@ import javax.crypto.Cipher; import javax.crypto.spec.OAEPParameterSpec; import javax.crypto.spec.PSource; -import org.apache.ws.security.WSSecurityException; -import org.apache.ws.security.util.WSSecurityUtil; +import org.apache.wss4j.common.ext.WSSecurityException; +import org.apache.wss4j.dom.util.WSSecurityUtil; import org.apache.xml.security.algorithms.JCEMapper; import org.apache.xml.security.encryption.XMLCipher; import org.apache.xml.security.encryption.XMLEncryptionException; @@ -64,11 +64,11 @@ public final class EncryptionUtils { } } catch (InvalidKeyException e) { throw new WSSecurityException( - WSSecurityException.FAILED_ENCRYPTION, null, null, e + WSSecurityException.ErrorCode.FAILED_ENCRYPTION, null, null, e ); } catch (InvalidAlgorithmParameterException e) { throw new WSSecurityException( - WSSecurityException.FAILED_ENCRYPTION, null, null, e + WSSecurityException.ErrorCode.FAILED_ENCRYPTION, null, null, e ); } return cipher; @@ -94,11 +94,11 @@ public final class EncryptionUtils { } } catch (InvalidKeyException e) { throw new WSSecurityException( - WSSecurityException.FAILED_ENCRYPTION, null, null, e + WSSecurityException.ErrorCode.FAILED_ENCRYPTION, null, null, e ); } catch (InvalidAlgorithmParameterException e) { throw new WSSecurityException( - WSSecurityException.FAILED_ENCRYPTION, null, null, e + WSSecurityException.ErrorCode.FAILED_ENCRYPTION, null, null, e ); } return cipher; @@ -150,9 +150,7 @@ public final class EncryptionUtils { cipher.init(mode, key); return cipher; } catch (XMLEncryptionException ex) { - throw new WSSecurityException( - WSSecurityException.UNSUPPORTED_ALGORITHM, null, null, ex - ); + throw new WSSecurityException(WSSecurityException.ErrorCode.UNSUPPORTED_ALGORITHM, ex); } } Modified: cxf/branches/wss4j2.0-port/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlEncOutInterceptor.java URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlEncOutInterceptor.java?rev=1453430&r1=1453429&r2=1453430&view=diff ============================================================================== --- cxf/branches/wss4j2.0-port/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlEncOutInterceptor.java (original) +++ cxf/branches/wss4j2.0-port/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlEncOutInterceptor.java Wed Mar 6 17:04:10 2013 @@ -44,17 +44,17 @@ import org.apache.cxf.message.MessageUti import org.apache.cxf.rs.security.common.CryptoLoader; import org.apache.cxf.rs.security.common.SecurityUtils; import org.apache.cxf.ws.security.SecurityConstants; -import org.apache.ws.security.WSConstants; -import org.apache.ws.security.WSSecurityException; -import org.apache.ws.security.components.crypto.Crypto; -import org.apache.ws.security.message.token.DOMX509Data; -import org.apache.ws.security.message.token.DOMX509IssuerSerial; -import org.apache.ws.security.util.Base64; -import org.apache.ws.security.util.UUIDGenerator; -import org.apache.ws.security.util.WSSecurityUtil; +import org.apache.wss4j.common.crypto.Crypto; +import org.apache.wss4j.common.ext.WSSecurityException; +import org.apache.wss4j.dom.WSConstants; +import org.apache.wss4j.dom.message.token.DOMX509Data; +import org.apache.wss4j.dom.message.token.DOMX509IssuerSerial; +import org.apache.wss4j.dom.util.WSSecurityUtil; import org.apache.xml.security.algorithms.JCEMapper; import org.apache.xml.security.encryption.XMLCipher; import org.apache.xml.security.signature.XMLSignature; +import org.apache.xml.security.stax.impl.util.IDGenerator; +import org.apache.xml.security.utils.Base64; import org.apache.xml.security.utils.EncryptionConstants; public class XmlEncOutInterceptor extends AbstractXmlSecOutInterceptor { @@ -131,12 +131,12 @@ public class XmlEncOutInterceptor extend userName = SecurityUtils.getUserName(crypto, userName); if (StringUtils.isEmpty(userName)) { - throw new WSSecurityException("User name is not available"); + throw new Exception("User name is not available"); } receiverCert = getReceiverCertificateFromCrypto(crypto, userName); } if (receiverCert == null) { - throw new WSSecurityException("Receiver certificate is not available"); + throw new Exception("Receiver certificate is not available"); } String keyEncAlgo = encProps.getEncryptionKeyTransportAlgo() == null @@ -156,7 +156,7 @@ public class XmlEncOutInterceptor extend Document result = xmlCipher.doFinal(payloadDoc, payloadDoc.getDocumentElement(), false); NodeList list = result.getElementsByTagNameNS(WSConstants.ENC_NS, "CipherValue"); if (list.getLength() != 1) { - throw new WSSecurityException("Payload CipherData is missing", null); + throw new Exception("Payload CipherData is missing"); } String cipherText = ((Element)list.item(0)).getTextContent().trim(); Element cipherValue = @@ -201,9 +201,7 @@ public class XmlEncOutInterceptor extend } return keyGen; } catch (NoSuchAlgorithmException e) { - throw new WSSecurityException( - WSSecurityException.UNSUPPORTED_ALGORITHM, null, null, e - ); + throw new WSSecurityException(WSSecurityException.ErrorCode.UNSUPPORTED_ALGORITHM, e); } } @@ -222,7 +220,7 @@ public class XmlEncOutInterceptor extend String message = "Public key algorithm too weak to encrypt symmetric key"; LOG.severe(message); throw new WSSecurityException( - WSSecurityException.FAILURE, + WSSecurityException.ErrorCode.FAILURE, "unsupportedKeyTransp", new Object[] {message} ); @@ -232,15 +230,15 @@ public class XmlEncOutInterceptor extend encryptedEphemeralKey = cipher.doFinal(keyBytes); } catch (IllegalStateException ex) { throw new WSSecurityException( - WSSecurityException.FAILED_ENCRYPTION, null, null, ex + WSSecurityException.ErrorCode.FAILED_ENCRYPTION, null, null, ex ); } catch (IllegalBlockSizeException ex) { throw new WSSecurityException( - WSSecurityException.FAILED_ENCRYPTION, null, null, ex + WSSecurityException.ErrorCode.FAILED_ENCRYPTION, null, null, ex ); } catch (BadPaddingException ex) { throw new WSSecurityException( - WSSecurityException.FAILED_ENCRYPTION, null, null, ex + WSSecurityException.ErrorCode.FAILED_ENCRYPTION, null, null, ex ); } @@ -258,7 +256,7 @@ public class XmlEncOutInterceptor extend String encodedKey = Base64Utility.encode(encryptedKey); Element encryptedKeyElement = createEncryptedKeyElement(doc, keyEncAlgo, digestAlgo); - String encKeyId = "EK-" + UUIDGenerator.getUUID(); + String encKeyId = IDGenerator.generateID("EK-"); encryptedKeyElement.setAttributeNS(null, "Id", encKeyId); Element keyInfoElement = createKeyInfoElement(doc, cert); @@ -310,7 +308,7 @@ public class XmlEncOutInterceptor extend data = remoteCert.getEncoded(); } catch (CertificateEncodingException e) { throw new WSSecurityException( - WSSecurityException.SECURITY_TOKEN_UNAVAILABLE, "encodeError", null, e + WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, "encodeError", e ); } Text text = encryptedDataDoc.createTextNode(Base64.encode(data)); @@ -332,7 +330,7 @@ public class XmlEncOutInterceptor extend DOMX509Data domX509Data = new DOMX509Data(encryptedDataDoc, domIssuerSerial); keyIdentifierNode = domX509Data.getElement(); } else { - throw new WSSecurityException("Unsupported key identifier:" + keyIdType); + throw new Exception("Unsupported key identifier:" + keyIdType); } keyInfoElement.appendChild(keyIdentifierNode); Modified: cxf/branches/wss4j2.0-port/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSigOutInterceptor.java URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSigOutInterceptor.java?rev=1453430&r1=1453429&r2=1453430&view=diff ============================================================================== --- cxf/branches/wss4j2.0-port/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSigOutInterceptor.java (original) +++ cxf/branches/wss4j2.0-port/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSigOutInterceptor.java Wed Mar 6 17:04:10 2013 @@ -39,9 +39,9 @@ import org.apache.cxf.message.Message; import org.apache.cxf.rs.security.common.CryptoLoader; import org.apache.cxf.rs.security.common.SecurityUtils; import org.apache.cxf.ws.security.SecurityConstants; -import org.apache.ws.security.WSPasswordCallback; -import org.apache.ws.security.WSSecurityException; -import org.apache.ws.security.components.crypto.Crypto; +import org.apache.wss4j.common.crypto.Crypto; +import org.apache.wss4j.common.ext.WSPasswordCallback; +import org.apache.wss4j.common.ext.WSSecurityException; import org.apache.xml.security.signature.XMLSignature; import org.apache.xml.security.transforms.Transforms; import org.apache.xml.security.utils.Constants; @@ -110,11 +110,11 @@ public class XmlSigOutInterceptor extend String user = SecurityUtils.getUserName(message, crypto, userNameKey); if (StringUtils.isEmpty(user) || SecurityUtils.USE_REQUEST_SIGNATURE_CERT.equals(user)) { - throw new WSSecurityException("User name is not available"); + throw new Exception("User name is not available"); } String password = - SecurityUtils.getPassword(message, user, WSPasswordCallback.SIGNATURE, this.getClass()); + SecurityUtils.getPassword(message, user, WSPasswordCallback.Usage.SIGNATURE, this.getClass()); X509Certificate[] issuerCerts = SecurityUtils.getCertificates(crypto, user); @@ -131,7 +131,7 @@ public class XmlSigOutInterceptor extend } catch (Exception ex) { String errorMessage = "Private key can not be loaded, user:" + user; LOG.severe(errorMessage); - throw new WSSecurityException(errorMessage, ex); + throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex); } String id = UUID.randomUUID().toString(); Modified: cxf/branches/wss4j2.0-port/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SAMLTokenValidator.java URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SAMLTokenValidator.java?rev=1453430&r1=1453429&r2=1453430&view=diff ============================================================================== --- cxf/branches/wss4j2.0-port/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SAMLTokenValidator.java (original) +++ cxf/branches/wss4j2.0-port/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SAMLTokenValidator.java Wed Mar 6 17:04:10 2013 @@ -176,6 +176,13 @@ public class SAMLTokenValidator implemen SAMLUtil.getCredentialDirectlyFromKeyInfo( keyInfo.getDOM(), sigCrypto ); + assertion.verifySignature(samlKeyInfo); + + RequestData requestData = new RequestData(); + requestData.setSigVerCrypto(sigCrypto); + WSSConfig wssConfig = WSSConfig.getNewInstance(); + requestData.setWssConfig(wssConfig); + requestData.setCallbackHandler(callbackHandler); // Validate the assertion against schemas/profiles validateAssertion(assertion); @@ -185,12 +192,6 @@ public class SAMLTokenValidator implemen trustCredential.setPublicKey(samlKeyInfo.getPublicKey()); trustCredential.setCertificates(samlKeyInfo.getCerts()); - RequestData requestData = new RequestData(); - requestData.setSigVerCrypto(sigCrypto); - WSSConfig wssConfig = WSSConfig.getNewInstance(); - requestData.setWssConfig(wssConfig); - requestData.setCallbackHandler(callbackHandler); - validator.validate(trustCredential, requestData); // Finally check that subject DN of the signing certificate matches a known constraint Modified: cxf/branches/wss4j2.0-port/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/JAXRSOAuth2Test.java URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/JAXRSOAuth2Test.java?rev=1453430&r1=1453429&r2=1453430&view=diff ============================================================================== --- cxf/branches/wss4j2.0-port/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/JAXRSOAuth2Test.java (original) +++ cxf/branches/wss4j2.0-port/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/JAXRSOAuth2Test.java Wed Mar 6 17:04:10 2013 @@ -43,7 +43,7 @@ import org.apache.cxf.rs.security.oauth2 import org.apache.cxf.rs.security.saml.SAMLUtils; import org.apache.cxf.rs.security.saml.SAMLUtils.SelfSignInfo; import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase; -import org.apache.ws.security.components.crypto.Crypto; +import org.apache.wss4j.common.crypto.Crypto; import org.junit.BeforeClass; import org.junit.Test; Modified: cxf/branches/wss4j2.0-port/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/SamlCallbackHandler.java URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/SamlCallbackHandler.java?rev=1453430&r1=1453429&r2=1453430&view=diff ============================================================================== --- cxf/branches/wss4j2.0-port/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/SamlCallbackHandler.java (original) +++ cxf/branches/wss4j2.0-port/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/SamlCallbackHandler.java Wed Mar 6 17:04:10 2013 @@ -32,16 +32,16 @@ import org.apache.cxf.helpers.CastUtils; import org.apache.cxf.message.Message; import org.apache.cxf.phase.PhaseInterceptorChain; import org.apache.cxf.rs.security.saml.assertion.Claim; -import org.apache.ws.security.saml.ext.SAMLCallback; -import org.apache.ws.security.saml.ext.bean.ActionBean; -import org.apache.ws.security.saml.ext.bean.AttributeBean; -import org.apache.ws.security.saml.ext.bean.AttributeStatementBean; -import org.apache.ws.security.saml.ext.bean.AuthDecisionStatementBean; -import org.apache.ws.security.saml.ext.bean.AuthDecisionStatementBean.Decision; -import org.apache.ws.security.saml.ext.bean.AuthenticationStatementBean; -import org.apache.ws.security.saml.ext.bean.ConditionsBean; -import org.apache.ws.security.saml.ext.bean.SubjectBean; -import org.apache.ws.security.saml.ext.builder.SAML2Constants; +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.AuthDecisionStatementBean.Decision; +import org.apache.wss4j.common.saml.bean.AuthenticationStatementBean; +import org.apache.wss4j.common.saml.bean.ConditionsBean; +import org.apache.wss4j.common.saml.bean.SubjectBean; +import org.apache.wss4j.common.saml.builder.SAML2Constants; import org.joda.time.DateTime; import org.opensaml.common.SAMLVersion; Modified: cxf/branches/wss4j2.0-port/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/SamlCallbackHandler2.java URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/SamlCallbackHandler2.java?rev=1453430&r1=1453429&r2=1453430&view=diff ============================================================================== --- cxf/branches/wss4j2.0-port/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/SamlCallbackHandler2.java (original) +++ cxf/branches/wss4j2.0-port/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/SamlCallbackHandler2.java Wed Mar 6 17:04:10 2013 @@ -32,16 +32,16 @@ import org.apache.cxf.helpers.CastUtils; import org.apache.cxf.message.Message; import org.apache.cxf.phase.PhaseInterceptorChain; import org.apache.cxf.rs.security.saml.assertion.Claim; -import org.apache.ws.security.saml.ext.SAMLCallback; -import org.apache.ws.security.saml.ext.bean.ActionBean; -import org.apache.ws.security.saml.ext.bean.AttributeBean; -import org.apache.ws.security.saml.ext.bean.AttributeStatementBean; -import org.apache.ws.security.saml.ext.bean.AuthDecisionStatementBean; -import org.apache.ws.security.saml.ext.bean.AuthDecisionStatementBean.Decision; -import org.apache.ws.security.saml.ext.bean.AuthenticationStatementBean; -import org.apache.ws.security.saml.ext.bean.ConditionsBean; -import org.apache.ws.security.saml.ext.bean.SubjectBean; -import org.apache.ws.security.saml.ext.builder.SAML2Constants; +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.AuthDecisionStatementBean.Decision; +import org.apache.wss4j.common.saml.bean.AuthenticationStatementBean; +import org.apache.wss4j.common.saml.bean.ConditionsBean; +import org.apache.wss4j.common.saml.bean.SubjectBean; +import org.apache.wss4j.common.saml.builder.SAML2Constants; import org.joda.time.DateTime; import org.opensaml.common.SAMLVersion; Modified: cxf/branches/wss4j2.0-port/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/saml/KeystorePasswordCallback.java URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/saml/KeystorePasswordCallback.java?rev=1453430&r1=1453429&r2=1453430&view=diff ============================================================================== --- cxf/branches/wss4j2.0-port/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/saml/KeystorePasswordCallback.java (original) +++ cxf/branches/wss4j2.0-port/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/saml/KeystorePasswordCallback.java Wed Mar 6 17:04:10 2013 @@ -25,7 +25,7 @@ import javax.security.auth.callback.Call import javax.security.auth.callback.CallbackHandler; import javax.security.auth.callback.UnsupportedCallbackException; -import org.apache.ws.security.WSPasswordCallback; +import org.apache.wss4j.common.ext.WSPasswordCallback; /** */ Modified: cxf/branches/wss4j2.0-port/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/saml/SamlCallbackHandler.java URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/saml/SamlCallbackHandler.java?rev=1453430&r1=1453429&r2=1453430&view=diff ============================================================================== --- cxf/branches/wss4j2.0-port/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/saml/SamlCallbackHandler.java (original) +++ cxf/branches/wss4j2.0-port/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/saml/SamlCallbackHandler.java Wed Mar 6 17:04:10 2013 @@ -36,19 +36,19 @@ import org.apache.cxf.rs.security.common import org.apache.cxf.rs.security.common.SecurityUtils; import org.apache.cxf.rs.security.saml.assertion.Claim; import org.apache.cxf.ws.security.SecurityConstants; -import org.apache.ws.security.components.crypto.Crypto; -import org.apache.ws.security.saml.ext.SAMLCallback; -import org.apache.ws.security.saml.ext.bean.ActionBean; -import org.apache.ws.security.saml.ext.bean.AttributeBean; -import org.apache.ws.security.saml.ext.bean.AttributeStatementBean; -import org.apache.ws.security.saml.ext.bean.AuthDecisionStatementBean; -import org.apache.ws.security.saml.ext.bean.AuthDecisionStatementBean.Decision; -import org.apache.ws.security.saml.ext.bean.AuthenticationStatementBean; -import org.apache.ws.security.saml.ext.bean.ConditionsBean; -import org.apache.ws.security.saml.ext.bean.KeyInfoBean; -import org.apache.ws.security.saml.ext.bean.SubjectBean; -import org.apache.ws.security.saml.ext.builder.SAML1Constants; -import org.apache.ws.security.saml.ext.builder.SAML2Constants; +import org.apache.wss4j.common.crypto.Crypto; +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.AuthDecisionStatementBean.Decision; +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.SubjectBean; +import org.apache.wss4j.common.saml.builder.SAML1Constants; +import org.apache.wss4j.common.saml.builder.SAML2Constants; import org.joda.time.DateTime; import org.opensaml.common.SAMLVersion; Modified: cxf/branches/wss4j2.0-port/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/saml/SamlRetrievalInterceptor.java URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/saml/SamlRetrievalInterceptor.java?rev=1453430&r1=1453429&r2=1453430&view=diff ============================================================================== --- cxf/branches/wss4j2.0-port/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/saml/SamlRetrievalInterceptor.java (original) +++ cxf/branches/wss4j2.0-port/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/saml/SamlRetrievalInterceptor.java Wed Mar 6 17:04:10 2013 @@ -33,10 +33,11 @@ import org.apache.cxf.rs.security.saml.S import org.apache.cxf.rs.security.saml.SamlFormOutInterceptor; import org.apache.cxf.rs.security.saml.SamlHeaderOutInterceptor; -import org.apache.ws.security.WSSConfig; -import org.apache.ws.security.WSSecurityException; -import org.apache.ws.security.saml.ext.AssertionWrapper; -import org.apache.ws.security.saml.ext.SAMLParms; +import org.apache.wss4j.common.ext.WSSecurityException; +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.dom.WSSConfig; /** * An Interceptor to "retrieve" a SAML Token, i.e. create one and set it on the message @@ -58,10 +59,11 @@ public class SamlRetrievalInterceptor ex public void handleMessage(Message message) throws Fault { // Create a SAML Token - SAMLParms samlParms = new SAMLParms(); - samlParms.setCallbackHandler(new SamlCallbackHandler()); + SAMLCallback samlCallback = new SAMLCallback(); + SAMLUtil.doSAMLCallback(new SamlCallbackHandler(), samlCallback); + try { - AssertionWrapper assertion = new AssertionWrapper(samlParms); + SamlAssertionWrapper assertion = new SamlAssertionWrapper(samlCallback); Document doc = DOMUtils.createDocument(); Element token = assertion.toDOM(doc); message.setContextualProperty(SAMLConstants.SAML_TOKEN_ELEMENT, token);
