ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gi...@apache.org
Subject svn commit: r1463136 [2/11] - in /webservices/wss4j/trunk: cxf-integration/src/main/java/org/apache/wss4j/cxfIntegration/interceptor/ integration/src/test/java/org/apache/wss4j/integration/test/stax/ ws-security-common/src/main/java/org/apache/wss4j/co...
Date Mon, 01 Apr 2013 13:57:35 GMT
Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/ProtectionOrderAssertionState.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/ProtectionOrderAssertionState.java?rev=1463136&r1=1463135&r2=1463136&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/ProtectionOrderAssertionState.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/ProtectionOrderAssertionState.java Mon Apr  1 13:57:32 2013
@@ -60,35 +60,35 @@ public class ProtectionOrderAssertionSta
     public boolean assertEvent(SecurityEvent securityEvent) throws WSSPolicyException {
         AbstractSymmetricAsymmetricBinding.ProtectionOrder protectionOrder = ((AbstractSymmetricAsymmetricBinding) getAssertion()).getProtectionOrder();
         SecurityEventConstants.Event event = securityEvent.getSecurityEventType();
-        if (event == WSSecurityEventConstants.SignedElement) {
+        if (WSSecurityEventConstants.SignedElement.equals(event)) {
             SignedElementSecurityEvent signedElementSecurityEvent = (SignedElementSecurityEvent) securityEvent;
             if (!signedElementSecurityEvent.isSigned()) {
                 return true;
             }
             List<XMLSecurityConstants.ContentType> contentTypes = signedElementSecurityEvent.getProtectionOrder();
             testProtectionOrder(protectionOrder, contentTypes, signedElementSecurityEvent.getElementPath());
-        } else if (event == WSSecurityEventConstants.SignedPart) {
+        } else if (WSSecurityEventConstants.SignedPart.equals(event)) {
             SignedPartSecurityEvent signedPartSecurityEvent = (SignedPartSecurityEvent) securityEvent;
             if (!signedPartSecurityEvent.isSigned()) {
                 return true;
             }
             List<XMLSecurityConstants.ContentType> contentTypes = signedPartSecurityEvent.getProtectionOrder();
             testProtectionOrder(protectionOrder, contentTypes, signedPartSecurityEvent.getElementPath());
-        } else if (event == WSSecurityEventConstants.EncryptedElement) {
+        } else if (WSSecurityEventConstants.EncryptedElement.equals(event)) {
             EncryptedElementSecurityEvent encryptedElementSecurityEvent = (EncryptedElementSecurityEvent) securityEvent;
             if (!encryptedElementSecurityEvent.isEncrypted()) {
                 return true;
             }
             List<XMLSecurityConstants.ContentType> contentTypes = encryptedElementSecurityEvent.getProtectionOrder();
             testProtectionOrder(protectionOrder, contentTypes, encryptedElementSecurityEvent.getElementPath());
-        } else if (event == WSSecurityEventConstants.EncryptedPart) {
+        } else if (WSSecurityEventConstants.EncryptedPart.equals(event)) {
             EncryptedPartSecurityEvent encryptedPartSecurityEvent = (EncryptedPartSecurityEvent) securityEvent;
             if (!encryptedPartSecurityEvent.isEncrypted()) {
                 return true;
             }
             List<XMLSecurityConstants.ContentType> contentTypes = encryptedPartSecurityEvent.getProtectionOrder();
             testProtectionOrder(protectionOrder, contentTypes, encryptedPartSecurityEvent.getElementPath());
-        } else if (event == WSSecurityEventConstants.ContentEncrypted) {
+        } else if (WSSecurityEventConstants.ContentEncrypted.equals(event)) {
             ContentEncryptedElementSecurityEvent contentEncryptedElementSecurityEvent = (ContentEncryptedElementSecurityEvent) securityEvent;
             if (!contentEncryptedElementSecurityEvent.isEncrypted()) {
                 return true;

Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/SamlTokenAssertionState.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/SamlTokenAssertionState.java?rev=1463136&r1=1463135&r2=1463136&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/SamlTokenAssertionState.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/SamlTokenAssertionState.java Mon Apr  1 13:57:32 2013
@@ -18,14 +18,14 @@
  */
 package org.apache.wss4j.policy.stax.assertionStates;
 
+import org.apache.wss4j.common.saml.SamlAssertionWrapper;
 import org.apache.wss4j.policy.WSSPolicyException;
 import org.apache.wss4j.policy.model.AbstractSecurityAssertion;
 import org.apache.wss4j.policy.model.AbstractToken;
 import org.apache.wss4j.policy.model.SamlToken;
-import org.apache.wss4j.stax.ext.InboundSecurityToken;
+import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
 import org.apache.xml.security.exceptions.XMLSecurityException;
 import org.opensaml.common.SAMLVersion;
-import org.apache.wss4j.stax.ext.WSSConstants;
 import org.apache.wss4j.stax.securityEvent.SamlTokenSecurityEvent;
 import org.apache.wss4j.stax.securityEvent.WSSecurityEventConstants;
 import org.apache.xml.security.stax.securityEvent.SecurityEventConstants;
@@ -60,27 +60,29 @@ public class SamlTokenAssertionState ext
             setErrorMessage("IssuerName in Policy (" + samlToken.getIssuerName() + ") didn't match with the one in the SamlToken (" + samlTokenSecurityEvent.getIssuerName() + ")");
             return false;
         }
-        if (samlToken.isRequireKeyIdentifierReference() && ((InboundSecurityToken) samlTokenSecurityEvent.getSecurityToken()).getKeyIdentifierType() != WSSConstants.WSSKeyIdentifierType.X509_KEY_IDENTIFIER) {
+        if (samlToken.isRequireKeyIdentifierReference() &&
+                !WSSecurityTokenConstants.KeyIdentifier_X509KeyIdentifier.equals(samlTokenSecurityEvent.getSecurityToken().getKeyIdentifier())) {
             setErrorMessage("Policy enforces KeyIdentifierReference but we got " + samlTokenSecurityEvent.getSecurityToken().getTokenType());
             return false;
         }
         if (samlToken.getSamlTokenType() != null) {
+            final SamlAssertionWrapper samlAssertionWrapper = samlTokenSecurityEvent.getSamlAssertionWrapper();
             switch (samlToken.getSamlTokenType()) {
                 case WssSamlV11Token10:
-                    if (samlTokenSecurityEvent.getSamlVersion() != SAMLVersion.VERSION_10) {
-                        setErrorMessage("Policy enforces SamlVersion11Profile10 but we got " + samlTokenSecurityEvent.getSamlVersion());
+                    if (samlAssertionWrapper.getSamlVersion() != SAMLVersion.VERSION_10) {
+                        setErrorMessage("Policy enforces SamlVersion11Profile10 but we got " + samlAssertionWrapper.getSamlVersion());
                         return false;
                     }
                     break;
                 case WssSamlV11Token11:
-                    if (samlTokenSecurityEvent.getSamlVersion() != SAMLVersion.VERSION_11) {
-                        setErrorMessage("Policy enforces SamlVersion11Profile11 but we got " + samlTokenSecurityEvent.getSamlVersion());
+                    if (samlAssertionWrapper.getSamlVersion() != SAMLVersion.VERSION_11) {
+                        setErrorMessage("Policy enforces SamlVersion11Profile11 but we got " + samlAssertionWrapper.getSamlVersion());
                         return false;
                     }
                     break;
                 case WssSamlV20Token11:
-                    if (samlTokenSecurityEvent.getSamlVersion() != SAMLVersion.VERSION_20) {
-                        setErrorMessage("Policy enforces SamlVersion20Profile11 but we got " + samlTokenSecurityEvent.getSamlVersion());
+                    if (samlAssertionWrapper.getSamlVersion() != SAMLVersion.VERSION_20) {
+                        setErrorMessage("Policy enforces SamlVersion20Profile11 but we got " + samlAssertionWrapper.getSamlVersion());
                         return false;
                     }
                     break;

Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/TokenAssertionState.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/TokenAssertionState.java?rev=1463136&r1=1463135&r2=1463136&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/TokenAssertionState.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/TokenAssertionState.java Mon Apr  1 13:57:32 2013
@@ -23,11 +23,11 @@ import org.apache.wss4j.policy.SPConstan
 import org.apache.wss4j.policy.WSSPolicyException;
 import org.apache.wss4j.policy.model.*;
 import org.apache.wss4j.policy.stax.Assertable;
-import org.apache.wss4j.stax.ext.WSSConstants;
+import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
 import org.apache.xml.security.exceptions.XMLSecurityException;
-import org.apache.xml.security.stax.ext.SecurityToken;
 import org.apache.xml.security.stax.securityEvent.SecurityEvent;
 import org.apache.xml.security.stax.securityEvent.TokenSecurityEvent;
+import org.apache.xml.security.stax.securityToken.SecurityToken;
 
 import java.util.Iterator;
 import java.util.List;
@@ -58,55 +58,52 @@ public abstract class TokenAssertionStat
         final AbstractSecurityAssertion parentAssertion = abstractToken.getParentAssertion();
 
         int ignoreToken = 0;
-        final List<SecurityToken.TokenUsage> tokenUsages = tokenSecurityEvent.getSecurityToken().getTokenUsages();
-        Iterator<SecurityToken.TokenUsage> tokenUsageIterator = tokenUsages.iterator();
+        final List<WSSecurityTokenConstants.TokenUsage> tokenUsages = tokenSecurityEvent.getSecurityToken().getTokenUsages();
+        Iterator<WSSecurityTokenConstants.TokenUsage> tokenUsageIterator = tokenUsages.iterator();
+        loop:
         while (tokenUsageIterator.hasNext()) {
-            SecurityToken.TokenUsage tokenUsage = tokenUsageIterator.next();
-            switch (tokenUsage) {
-                case MainSignature:
-                    if (!(parentAssertion instanceof InitiatorToken)
-                            && !(parentAssertion instanceof InitiatorSignatureToken)
-                            && !(parentAssertion instanceof SignatureToken)
-                            && !(parentAssertion instanceof ProtectionToken)
-                            && !(parentAssertion instanceof TransportToken)) {
-                        ignoreToken++;
-                        break;
-                    }
-                    break;
-                case Signature:
+            WSSecurityTokenConstants.TokenUsage tokenUsage = tokenUsageIterator.next();
+            if (WSSecurityTokenConstants.TokenUsage_MainSignature.equals(tokenUsage)) {
+                if (!(parentAssertion instanceof InitiatorToken)
+                        && !(parentAssertion instanceof InitiatorSignatureToken)
+                        && !(parentAssertion instanceof SignatureToken)
+                        && !(parentAssertion instanceof ProtectionToken)
+                        && !(parentAssertion instanceof TransportToken)) {
+                    ignoreToken++;
+                    continue loop;
+                }
+            } else if (WSSecurityTokenConstants.TokenUsage_Signature.equals(tokenUsage)) {
                     throw new WSSPolicyException("Illegal token usage!");
-                case MainEncryption:
-                    if (!(parentAssertion instanceof RecipientToken)
-                            && !(parentAssertion instanceof RecipientEncryptionToken)
-                            && !(parentAssertion instanceof EncryptionToken)
-                            && !(parentAssertion instanceof ProtectionToken)
-                            && !(parentAssertion instanceof TransportToken)) {
-                        ignoreToken++;
-                        break;
-                    }
-                    break;
-                case Encryption:
+            } else if (WSSecurityTokenConstants.TokenUsage_MainEncryption.equals(tokenUsage)) {
+                if (!(parentAssertion instanceof RecipientToken)
+                        && !(parentAssertion instanceof RecipientEncryptionToken)
+                        && !(parentAssertion instanceof EncryptionToken)
+                        && !(parentAssertion instanceof ProtectionToken)
+                        && !(parentAssertion instanceof TransportToken)) {
+                    ignoreToken++;
+                    continue loop;
+                }
+            } else if (WSSecurityTokenConstants.TokenUsage_Encryption.equals(tokenUsage)) {
                     throw new WSSPolicyException("Illegal token usage!");
-                case SupportingTokens:
-                case SignedSupportingTokens:
-                case EndorsingSupportingTokens:
-                case SignedEndorsingSupportingTokens:
-                case SignedEncryptedSupportingTokens:
-                case EncryptedSupportingTokens:
-                case EndorsingEncryptedSupportingTokens:
-                case SignedEndorsingEncryptedSupportingTokens:
-                    if (!(parentAssertion instanceof SupportingTokens)) {
-                        ignoreToken++;
-                        break;
-                    }
-
-                    SupportingTokens supportingTokens = (SupportingTokens) parentAssertion;
-                    SecurityToken.TokenUsage expectedTokenUsage = SecurityToken.TokenUsage.valueOf(supportingTokens.getName().getLocalPart());
-                    if (expectedTokenUsage != tokenUsage) {
-                        ignoreToken++;
-                        break;
-                    }
-                    break;
+            } else if (WSSecurityTokenConstants.TokenUsage_SupportingTokens.equals(tokenUsage) ||
+                    WSSecurityTokenConstants.TokenUsage_SignedSupportingTokens.equals(tokenUsage) ||
+                    WSSecurityTokenConstants.TokenUsage_EndorsingSupportingTokens.equals(tokenUsage) ||
+                    WSSecurityTokenConstants.TokenUsage_SignedEndorsingSupportingTokens.equals(tokenUsage) ||
+                    WSSecurityTokenConstants.TokenUsage_SignedEncryptedSupportingTokens.equals(tokenUsage) ||
+                    WSSecurityTokenConstants.TokenUsage_EncryptedSupportingTokens.equals(tokenUsage) ||
+                    WSSecurityTokenConstants.TokenUsage_EndorsingEncryptedSupportingTokens.equals(tokenUsage) ||
+                    WSSecurityTokenConstants.TokenUsage_SignedEndorsingEncryptedSupportingTokens.equals(tokenUsage)
+                    ) {
+                if (!(parentAssertion instanceof SupportingTokens)) {
+                    ignoreToken++;
+                    continue loop;
+                }
+
+                SupportingTokens supportingTokens = (SupportingTokens) parentAssertion;
+                if (!tokenUsage.getName().equals(supportingTokens.getName().getLocalPart())) {
+                    ignoreToken++;
+                    continue loop;
+                }
             }
         }
         if (ignoreToken >= tokenUsages.size()) {
@@ -149,8 +146,8 @@ public abstract class TokenAssertionStat
         if (asserted) {
             setAsserted(true);
         }
-        if (!asserted && (tokenUsages.contains(SecurityToken.TokenUsage.MainSignature)
-                || tokenUsages.contains(SecurityToken.TokenUsage.MainEncryption))) {
+        if (!asserted && (tokenUsages.contains(WSSecurityTokenConstants.TokenUsage_MainSignature)
+                || tokenUsages.contains(WSSecurityTokenConstants.TokenUsage_MainEncryption))) {
             //return false if not asserted for the main signature and encryption tokens
             return false;
         } else {
@@ -164,7 +161,7 @@ public abstract class TokenAssertionStat
     protected boolean hasDerivedKeys(SecurityToken securityToken) throws XMLSecurityException {
         if (securityToken == null) {
             return false;
-        } else if (securityToken.getTokenType() == WSSConstants.DerivedKeyToken) {
+        } else if (WSSecurityTokenConstants.DerivedKeyToken.equals(securityToken.getTokenType())) {
             return true;
         }
 

Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/TokenProtectionAssertionState.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/TokenProtectionAssertionState.java?rev=1463136&r1=1463135&r2=1463136&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/TokenProtectionAssertionState.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/TokenProtectionAssertionState.java Mon Apr  1 13:57:32 2013
@@ -25,13 +25,14 @@ import org.apache.wss4j.policy.model.Abs
 import org.apache.wss4j.policy.stax.Assertable;
 import org.apache.wss4j.stax.ext.WSSConstants;
 import org.apache.wss4j.stax.ext.WSSUtils;
+import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
 import org.apache.wss4j.stax.securityEvent.WSSecurityEventConstants;
 import org.apache.xml.security.exceptions.XMLSecurityException;
-import org.apache.xml.security.stax.ext.SecurityToken;
 import org.apache.xml.security.stax.securityEvent.SecurityEvent;
 import org.apache.xml.security.stax.securityEvent.SecurityEventConstants;
 import org.apache.xml.security.stax.securityEvent.SignedElementSecurityEvent;
 import org.apache.xml.security.stax.securityEvent.TokenSecurityEvent;
+import org.apache.xml.security.stax.securityToken.SecurityToken;
 
 import javax.xml.namespace.QName;
 import java.util.Iterator;
@@ -114,7 +115,7 @@ public class TokenProtectionAssertionSta
                     return false;
                 }
 
-                if (isMainSignatureToken(securityToken) 
+                if (isMainSignatureToken(securityToken)
                         && !signsSignedSupportingTokens(securityToken)) {
                     setAsserted(false);
                     setErrorMessage("Main signature must sign the Signed*Supporting-Tokens.");
@@ -126,12 +127,12 @@ public class TokenProtectionAssertionSta
     }
 
     private boolean isSignatureToken(SecurityToken securityToken) {
-        List<SecurityToken.TokenUsage> tokenUsages = securityToken.getTokenUsages();
+        List<WSSecurityTokenConstants.TokenUsage> tokenUsages = securityToken.getTokenUsages();
         for (int i = 0; i < tokenUsages.size(); i++) {
-            SecurityToken.TokenUsage tokenUsage = tokenUsages.get(i);
-            if (tokenUsage == SecurityToken.TokenUsage.Signature
-                    || tokenUsage == SecurityToken.TokenUsage.MainSignature
-                    || tokenUsage.name().contains("Endorsing")) {
+            WSSecurityTokenConstants.TokenUsage tokenUsage = tokenUsages.get(i);
+            if (WSSecurityTokenConstants.TokenUsage_Signature.equals(tokenUsage)
+                    || WSSecurityTokenConstants.TokenUsage_MainSignature.equals(tokenUsage)
+                    || tokenUsage.getName().contains("Endorsing")) {
                 return true;
             }
         }
@@ -139,10 +140,10 @@ public class TokenProtectionAssertionSta
     }
 
     private boolean isEndorsingToken(SecurityToken securityToken) {
-        List<SecurityToken.TokenUsage> tokenUsages = securityToken.getTokenUsages();
+        List<WSSecurityTokenConstants.TokenUsage> tokenUsages = securityToken.getTokenUsages();
         for (int i = 0; i < tokenUsages.size(); i++) {
-            SecurityToken.TokenUsage tokenUsage = tokenUsages.get(i);
-            if (tokenUsage.name().contains("Endorsing")) {
+            WSSecurityTokenConstants.TokenUsage tokenUsage = tokenUsages.get(i);
+            if (tokenUsage.getName().contains("Endorsing")) {
                 return true;
             }
         }
@@ -150,10 +151,10 @@ public class TokenProtectionAssertionSta
     }
 
     private boolean isSignedSupportingToken(SecurityToken securityToken) {
-        List<SecurityToken.TokenUsage> tokenUsages = securityToken.getTokenUsages();
+        List<WSSecurityTokenConstants.TokenUsage> tokenUsages = securityToken.getTokenUsages();
         for (int i = 0; i < tokenUsages.size(); i++) {
-            SecurityToken.TokenUsage tokenUsage = tokenUsages.get(i);
-            if (tokenUsage.name().contains("Signed")) {
+            WSSecurityTokenConstants.TokenUsage tokenUsage = tokenUsages.get(i);
+            if (tokenUsage.getName().contains("Signed")) {
                 return true;
             }
         }
@@ -161,8 +162,8 @@ public class TokenProtectionAssertionSta
     }
 
     private boolean isMainSignatureToken(SecurityToken securityToken) {
-        List<SecurityToken.TokenUsage> tokenUsages = securityToken.getTokenUsages();
-        return tokenUsages.contains(SecurityToken.TokenUsage.MainSignature);
+        List<WSSecurityTokenConstants.TokenUsage> tokenUsages = securityToken.getTokenUsages();
+        return tokenUsages.contains(WSSecurityTokenConstants.TokenUsage_MainSignature);
     }
 
     private boolean signsMainSignature(SecurityToken securityToken) throws XMLSecurityException {

Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/UsernameTokenAssertionState.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/UsernameTokenAssertionState.java?rev=1463136&r1=1463135&r2=1463136&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/UsernameTokenAssertionState.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/UsernameTokenAssertionState.java Mon Apr  1 13:57:32 2013
@@ -23,7 +23,7 @@ import org.apache.wss4j.policy.model.Abs
 import org.apache.wss4j.policy.model.AbstractToken;
 import org.apache.wss4j.policy.model.UsernameToken;
 import org.apache.wss4j.stax.ext.WSSConstants;
-import org.apache.wss4j.stax.impl.securityToken.UsernameSecurityToken;
+import org.apache.wss4j.stax.securityToken.UsernameSecurityToken;
 import org.apache.wss4j.stax.securityEvent.UsernameTokenSecurityEvent;
 import org.apache.wss4j.stax.securityEvent.WSSecurityEventConstants;
 import org.apache.xml.security.exceptions.XMLSecurityException;
@@ -76,7 +76,7 @@ public class UsernameTokenAssertionState
             setErrorMessage("UsernameToken must contain a password");
             return false;
         }
-        if (usernameToken.isCreated() && (usernameSecurityToken.getCreated() == null || usernameTokenSecurityEvent.getUsernameTokenPasswordType() != WSSConstants.UsernameTokenPasswordType.PASSWORD_TEXT)) {
+        if (usernameToken.isCreated() && (usernameSecurityToken.getCreatedTime() == null || usernameTokenSecurityEvent.getUsernameTokenPasswordType() != WSSConstants.UsernameTokenPasswordType.PASSWORD_TEXT)) {
             setErrorMessage("UsernameToken does not contain a created timestamp or password is not plain text");
             return false;
         }

Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/X509TokenAssertionState.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/X509TokenAssertionState.java?rev=1463136&r1=1463135&r2=1463136&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/X509TokenAssertionState.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/X509TokenAssertionState.java Mon Apr  1 13:57:32 2013
@@ -22,13 +22,12 @@ import org.apache.wss4j.policy.WSSPolicy
 import org.apache.wss4j.policy.model.AbstractSecurityAssertion;
 import org.apache.wss4j.policy.model.AbstractToken;
 import org.apache.wss4j.policy.model.X509Token;
-import org.apache.wss4j.stax.ext.InboundSecurityToken;
-import org.apache.wss4j.stax.ext.WSSConstants;
+import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
+import org.apache.wss4j.stax.securityEvent.X509TokenSecurityEvent;
 import org.apache.xml.security.exceptions.XMLSecurityException;
-import org.apache.xml.security.stax.ext.XMLSecurityConstants;
 import org.apache.xml.security.stax.securityEvent.SecurityEventConstants;
 import org.apache.xml.security.stax.securityEvent.TokenSecurityEvent;
-import org.apache.xml.security.stax.securityEvent.X509TokenSecurityEvent;
+import org.apache.xml.security.stax.securityToken.SecurityToken;
 
 import java.security.cert.X509Certificate;
 
@@ -57,12 +56,12 @@ public class X509TokenAssertionState ext
 
         X509Token x509Token = (X509Token) abstractToken;
 
-        InboundSecurityToken securityToken = (InboundSecurityToken) tokenSecurityEvent.getSecurityToken();
-        XMLSecurityConstants.TokenType tokenType = securityToken.getTokenType();
-        if (!(WSSConstants.X509V3Token.equals(tokenType)
-                || WSSConstants.X509V1Token.equals(tokenType)
-                || WSSConstants.X509Pkcs7Token.equals(tokenType)
-                || WSSConstants.X509PkiPathV1Token.equals(tokenType))) {
+        SecurityToken securityToken = tokenSecurityEvent.getSecurityToken();
+        WSSecurityTokenConstants.TokenType tokenType = securityToken.getTokenType();
+        if (!(WSSecurityTokenConstants.X509V3Token.equals(tokenType)
+                || WSSecurityTokenConstants.X509V1Token.equals(tokenType)
+                || WSSecurityTokenConstants.X509Pkcs7Token.equals(tokenType)
+                || WSSecurityTokenConstants.X509PkiPathV1Token.equals(tokenType))) {
             throw new WSSPolicyException("Invalid Token for this assertion");
         }
 
@@ -71,21 +70,26 @@ public class X509TokenAssertionState ext
             if (x509Token.getIssuerName() != null) {
                 final String certificateIssuerName = x509Certificate.getIssuerX500Principal().getName();
                 if (!x509Token.getIssuerName().equals(certificateIssuerName)) {
-                    setErrorMessage("IssuerName in Policy (" + x509Token.getIssuerName() + ") didn't match with the one in the certificate (" + certificateIssuerName + ")");
+                    setErrorMessage("IssuerName in Policy (" + x509Token.getIssuerName() +
+                            ") didn't match with the one in the certificate (" + certificateIssuerName + ")");
                     return false;
                 }
             }
-            if (x509Token.isRequireKeyIdentifierReference() && securityToken.getKeyIdentifierType() != WSSConstants.WSSKeyIdentifierType.X509_KEY_IDENTIFIER) {
-                setErrorMessage("Policy enforces KeyIdentifierReference but we got " + securityToken.getKeyIdentifierType());
+            if (x509Token.isRequireKeyIdentifierReference() &&
+                    !WSSecurityTokenConstants.KeyIdentifier_X509KeyIdentifier.equals(securityToken.getKeyIdentifier())) {
+                setErrorMessage("Policy enforces KeyIdentifierReference but we got " + securityToken.getKeyIdentifier());
                 return false;
-            } else if (x509Token.isRequireIssuerSerialReference() && securityToken.getKeyIdentifierType() != WSSConstants.WSSKeyIdentifierType.ISSUER_SERIAL) {
-                setErrorMessage("Policy enforces IssuerSerialReference but we got " + securityToken.getKeyIdentifierType());
+            } else if (x509Token.isRequireIssuerSerialReference() &&
+                    !WSSecurityTokenConstants.KeyIdentifier_IssuerSerial.equals(securityToken.getKeyIdentifier())) {
+                setErrorMessage("Policy enforces IssuerSerialReference but we got " + securityToken.getKeyIdentifier());
                 return false;
-            } else if (x509Token.isRequireEmbeddedTokenReference() && securityToken.getKeyIdentifierType() != WSSConstants.WSSKeyIdentifierType.SECURITY_TOKEN_DIRECT_REFERENCE) {
-                setErrorMessage("Policy enforces EmbeddedTokenReference but we got " + securityToken.getKeyIdentifierType());
+            } else if (x509Token.isRequireEmbeddedTokenReference() &&
+                    !WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference.equals(securityToken.getKeyIdentifier())) {
+                setErrorMessage("Policy enforces EmbeddedTokenReference but we got " + securityToken.getKeyIdentifier());
                 return false;
-            } else if (x509Token.isRequireThumbprintReference() && securityToken.getKeyIdentifierType() != WSSConstants.WSSKeyIdentifierType.THUMBPRINT_IDENTIFIER) {
-                setErrorMessage("Policy enforces ThumbprintReference but we got " + securityToken.getKeyIdentifierType());
+            } else if (x509Token.isRequireThumbprintReference() &&
+                    !WSSecurityTokenConstants.KeyIdentifier_ThumbprintIdentifier.equals(securityToken.getKeyIdentifier())) {
+                setErrorMessage("Policy enforces ThumbprintReference but we got " + securityToken.getKeyIdentifier());
                 return false;
             }
             if (x509Certificate.getVersion() == 2) {
@@ -96,21 +100,26 @@ public class X509TokenAssertionState ext
                 switch (x509Token.getTokenType()) {
                     case WssX509V3Token10:
                     case WssX509V3Token11:
-                        if (WSSConstants.X509V3Token != securityToken.getTokenType() || x509Certificate.getVersion() != 3) {
-                            setErrorMessage("X509Certificate Version " + x509Certificate.getVersion() + " mismatch; Policy enforces " + x509Token.getTokenType());
+                        if (!WSSecurityTokenConstants.X509V3Token.equals(securityToken.getTokenType()) ||
+                                x509Certificate.getVersion() != 3) {
+                            setErrorMessage("X509Certificate Version " + x509Certificate.getVersion() +
+                                    " mismatch; Policy enforces " + x509Token.getTokenType());
                             return false;
                         }
                         break;
                     case WssX509V1Token11:
-                        if (WSSConstants.X509V1Token != securityToken.getTokenType() || x509Certificate.getVersion() != 1) {
-                            setErrorMessage("X509Certificate Version " + x509Certificate.getVersion() + " mismatch; Policy enforces " + x509Token.getTokenType());
+                        if (!WSSecurityTokenConstants.X509V1Token.equals(securityToken.getTokenType()) ||
+                                x509Certificate.getVersion() != 1) {
+                            setErrorMessage("X509Certificate Version " + x509Certificate.getVersion() +
+                                    " mismatch; Policy enforces " + x509Token.getTokenType());
                             return false;
                         }
                         break;
                     case WssX509PkiPathV1Token10:
                     case WssX509PkiPathV1Token11:
-                        if (securityToken.getTokenType() != WSSConstants.X509PkiPathV1Token) {
-                            setErrorMessage("Policy enforces " + x509Token.getTokenType() + " but we got " + securityToken.getTokenType());
+                        if (!WSSecurityTokenConstants.X509PkiPathV1Token.equals(securityToken.getTokenType())) {
+                            setErrorMessage("Policy enforces " + x509Token.getTokenType() +
+                                    " but we got " + securityToken.getTokenType());
                             return false;
                         }
                         break;

Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/AbstractPolicyTestBase.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/AbstractPolicyTestBase.java?rev=1463136&r1=1463135&r2=1463136&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/AbstractPolicyTestBase.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/AbstractPolicyTestBase.java Mon Apr  1 13:57:32 2013
@@ -28,9 +28,11 @@ import org.apache.wss4j.policy.WSSPolicy
 import org.apache.wss4j.policy.stax.PolicyEnforcer;
 import org.apache.wss4j.policy.stax.PolicyEnforcerFactory;
 import org.apache.wss4j.stax.WSSec;
-import org.apache.wss4j.stax.ext.WSSConstants;
-import org.apache.wss4j.stax.impl.securityToken.X509SecurityToken;
+import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
+import org.apache.wss4j.stax.impl.securityToken.*;
 import org.apache.wss4j.stax.test.AbstractTestBase;
+import org.apache.xml.security.binding.xmldsig11.ECKeyValueType;
+import org.apache.xml.security.binding.xmldsig11.NamedCurveType;
 import org.apache.xml.security.exceptions.XMLSecurityException;
 import org.apache.xml.security.stax.config.Init;
 import org.testng.annotations.BeforeClass;
@@ -94,16 +96,16 @@ public class AbstractPolicyTestBase exte
         return policyEnforcer;
     }
 
-    public X509SecurityToken getX509Token(WSSConstants.TokenType tokenType) throws Exception {
+    public X509SecurityTokenImpl getX509Token(WSSecurityTokenConstants.TokenType tokenType) throws Exception {
         return getX509Token(tokenType, "transmitter");
     }
 
-    public X509SecurityToken getX509Token(WSSConstants.TokenType tokenType, final String keyAlias) throws Exception {
+    public X509SecurityTokenImpl getX509Token(WSSecurityTokenConstants.TokenType tokenType, final String keyAlias) throws Exception {
 
         final KeyStore keyStore = KeyStore.getInstance("jks");
         keyStore.load(this.getClass().getClassLoader().getResourceAsStream("transmitter.jks"), "default".toCharArray());
 
-        X509SecurityToken x509SecurityToken = new X509SecurityToken(tokenType, null, null, null, "", WSSConstants.WSSKeyIdentifierType.THUMBPRINT_IDENTIFIER, null) {
+        X509SecurityTokenImpl x509SecurityToken = new X509SecurityTokenImpl(tokenType, null, null, null, "", WSSecurityTokenConstants.KeyIdentifier_ThumbprintIdentifier, null) {
             @Override
             protected String getAlias() throws XMLSecurityException {
                 return keyAlias;
@@ -128,6 +130,28 @@ public class AbstractPolicyTestBase exte
         return x509SecurityToken;
     }
 
+    public KerberosServiceSecurityTokenImpl getKerberosServiceSecurityToken(WSSecurityTokenConstants.TokenType tokenType) throws Exception {
+        return new KerberosServiceSecurityTokenImpl(null, null, null, null, "", WSSecurityTokenConstants.KeyIdentifier_SecurityTokenReference);
+    }
+
+    public HttpsSecurityTokenImpl getHttpsSecurityToken(WSSecurityTokenConstants.TokenType tokenType) throws Exception {
+        return new HttpsSecurityTokenImpl(getX509Token(tokenType).getX509Certificates()[0]);
+    }
+
+    public RsaKeyValueSecurityTokenImpl getRsaKeyValueSecurityToken() throws Exception {
+        return new RsaKeyValueSecurityTokenImpl(null, null, WSSecurityTokenConstants.KeyIdentifier_EmbeddedKeyIdentifierRef);
+    }
+
+    public DsaKeyValueSecurityTokenImpl getDsaKeyValueSecurityToken() throws Exception {
+        return new DsaKeyValueSecurityTokenImpl(null, null, WSSecurityTokenConstants.KeyIdentifier_EmbeddedKeyIdentifierRef);
+    }
+
+    public ECKeyValueSecurityTokenImpl getECKeyValueSecurityToken() throws Exception {
+        ECKeyValueType ecKeyValueType = new ECKeyValueType();
+        ecKeyValueType.setNamedCurve(new NamedCurveType());
+        return new ECKeyValueSecurityTokenImpl(ecKeyValueType, null, WSSecurityTokenConstants.KeyIdentifier_EmbeddedKeyIdentifierRef);
+    }
+
     protected String loadResourceAsString(String resource, String encoding) throws IOException {
         InputStreamReader inputStreamReader = new InputStreamReader(this.getClass().getClassLoader().getResourceAsStream(resource), encoding);
         StringBuilder stringBuilder = new StringBuilder();

Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/AlgorithmSuiteTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/AlgorithmSuiteTest.java?rev=1463136&r1=1463135&r2=1463136&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/AlgorithmSuiteTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/AlgorithmSuiteTest.java Mon Apr  1 13:57:32 2013
@@ -60,7 +60,7 @@ public class AlgorithmSuiteTest extends 
         AlgorithmSuiteSecurityEvent algorithmSuiteSecurityEvent = new AlgorithmSuiteSecurityEvent();
         algorithmSuiteSecurityEvent.setAlgorithmURI("http://www.w3.org/2001/04/xmlenc#tripledes-cbc");
         algorithmSuiteSecurityEvent.setKeyLength(192);
-        algorithmSuiteSecurityEvent.setKeyUsage(WSSConstants.Enc);
+        algorithmSuiteSecurityEvent.setAlgorithmUsage(WSSConstants.Enc);
         policyEnforcer.registerSecurityEvent(algorithmSuiteSecurityEvent);
         policyEnforcer.doFinal();
     }
@@ -82,10 +82,10 @@ public class AlgorithmSuiteTest extends 
         AlgorithmSuiteSecurityEvent algorithmSuiteSecurityEvent = new AlgorithmSuiteSecurityEvent();
         algorithmSuiteSecurityEvent.setAlgorithmURI("http://www.w3.org/2001/04/xmlenc#tripledes-cbc");
         algorithmSuiteSecurityEvent.setKeyLength(192);
-        algorithmSuiteSecurityEvent.setKeyUsage(WSSConstants.Enc);
+        algorithmSuiteSecurityEvent.setAlgorithmUsage(WSSConstants.Enc);
         policyEnforcer.registerSecurityEvent(algorithmSuiteSecurityEvent);
         algorithmSuiteSecurityEvent.setAlgorithmURI("http://www.w3.org/2001/04/xmlenc#sha256");
-        algorithmSuiteSecurityEvent.setKeyUsage(WSSConstants.Dig);
+        algorithmSuiteSecurityEvent.setAlgorithmUsage(WSSConstants.Dig);
         try {
             policyEnforcer.registerSecurityEvent(algorithmSuiteSecurityEvent);
             Assert.fail("Exception expected");
@@ -114,7 +114,7 @@ public class AlgorithmSuiteTest extends 
         AlgorithmSuiteSecurityEvent algorithmSuiteSecurityEvent = new AlgorithmSuiteSecurityEvent();
         algorithmSuiteSecurityEvent.setAlgorithmURI("http://www.w3.org/2001/04/xmlenc#aes128-cbc");
         algorithmSuiteSecurityEvent.setKeyLength(128);
-        algorithmSuiteSecurityEvent.setKeyUsage(WSSConstants.Enc);
+        algorithmSuiteSecurityEvent.setAlgorithmUsage(WSSConstants.Enc);
         try {
             policyEnforcer.registerSecurityEvent(algorithmSuiteSecurityEvent);
             Assert.fail("Exception expected");
@@ -147,7 +147,7 @@ public class AlgorithmSuiteTest extends 
         AlgorithmSuiteSecurityEvent algorithmSuiteSecurityEvent = new AlgorithmSuiteSecurityEvent();
         algorithmSuiteSecurityEvent.setAlgorithmURI("http://www.w3.org/2001/04/xmlenc#tripledes-cbc");
         algorithmSuiteSecurityEvent.setKeyLength(192);
-        algorithmSuiteSecurityEvent.setKeyUsage(WSSConstants.Enc);
+        algorithmSuiteSecurityEvent.setAlgorithmUsage(WSSConstants.Enc);
         policyEnforcer.registerSecurityEvent(algorithmSuiteSecurityEvent);
         policyEnforcer.doFinal();
     }
@@ -172,7 +172,7 @@ public class AlgorithmSuiteTest extends 
         AlgorithmSuiteSecurityEvent algorithmSuiteSecurityEvent = new AlgorithmSuiteSecurityEvent();
         algorithmSuiteSecurityEvent.setAlgorithmURI("http://www.w3.org/2001/04/xmlenc#aes128-cbc");
         algorithmSuiteSecurityEvent.setKeyLength(128);
-        algorithmSuiteSecurityEvent.setKeyUsage(WSSConstants.Enc);
+        algorithmSuiteSecurityEvent.setAlgorithmUsage(WSSConstants.Enc);
         try {
             policyEnforcer.registerSecurityEvent(algorithmSuiteSecurityEvent);
             Assert.fail("Exception expected");
@@ -266,13 +266,13 @@ public class AlgorithmSuiteTest extends 
         AlgorithmSuiteSecurityEvent algorithmSuiteSecurityEvent = new AlgorithmSuiteSecurityEvent();
         algorithmSuiteSecurityEvent.setAlgorithmURI(WSSConstants.NS_XENC11_AES256_GCM);
         algorithmSuiteSecurityEvent.setKeyLength(256);
-        algorithmSuiteSecurityEvent.setKeyUsage(WSSConstants.Enc);
+        algorithmSuiteSecurityEvent.setAlgorithmUsage(WSSConstants.Enc);
         policyEnforcer.registerSecurityEvent(algorithmSuiteSecurityEvent);
 
         algorithmSuiteSecurityEvent = new AlgorithmSuiteSecurityEvent();
         algorithmSuiteSecurityEvent.setAlgorithmURI(WSSConstants.NS_XENC_AES256);
         algorithmSuiteSecurityEvent.setKeyLength(256);
-        algorithmSuiteSecurityEvent.setKeyUsage(WSSConstants.Enc);
+        algorithmSuiteSecurityEvent.setAlgorithmUsage(WSSConstants.Enc);
 
         try {
             policyEnforcer.registerSecurityEvent(algorithmSuiteSecurityEvent);

Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/AsymmetricBindingIntegrationTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/AsymmetricBindingIntegrationTest.java?rev=1463136&r1=1463135&r2=1463136&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/AsymmetricBindingIntegrationTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/AsymmetricBindingIntegrationTest.java Mon Apr  1 13:57:32 2013
@@ -19,6 +19,7 @@
 package org.apache.wss4j.policy.stax.test;
 
 import org.apache.wss4j.stax.WSSec;
+import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
 import org.apache.xml.security.stax.config.Init;
 import org.opensaml.common.SAMLVersion;
 import org.apache.wss4j.common.ext.WSSecurityException;
@@ -2226,7 +2227,7 @@ public class AsymmetricBindingIntegratio
         callbackHandler.setCerts(crypto.getX509Certificates(cryptoType));
         outSecurityProperties.setCallbackHandler(callbackHandler);
         outSecurityProperties.setTokenUser("tester");
-        outSecurityProperties.setSignatureKeyIdentifierType(WSSConstants.WSSKeyIdentifierType.EMBEDDED_KEYIDENTIFIER_REF);
+        outSecurityProperties.setSignatureKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_EmbeddedKeyIdentifierRef);
         outSecurityProperties.loadSignatureKeyStore(this.getClass().getClassLoader().getResource("transmitter.jks"), "default".toCharArray());
         outSecurityProperties.setSignatureUser("transmitter");
         outSecurityProperties.addSignaturePart(new SecurePart(WSSConstants.TAG_soap11_Body, SecurePart.Modifier.Element));
@@ -2350,7 +2351,7 @@ public class AsymmetricBindingIntegratio
         callbackHandler.setCerts(crypto.getX509Certificates(cryptoType));
         outSecurityProperties.setCallbackHandler(callbackHandler);
         outSecurityProperties.setTokenUser("tester");
-        outSecurityProperties.setSignatureKeyIdentifierType(WSSConstants.WSSKeyIdentifierType.EMBEDDED_KEYIDENTIFIER_REF);
+        outSecurityProperties.setSignatureKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_EmbeddedKeyIdentifierRef);
         outSecurityProperties.loadSignatureKeyStore(this.getClass().getClassLoader().getResource("transmitter.jks"), "default".toCharArray());
         outSecurityProperties.setSignatureUser("transmitter");
         outSecurityProperties.addSignaturePart(new SecurePart(WSSConstants.TAG_soap11_Body, SecurePart.Modifier.Element));

Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/AsymmetricBindingTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/AsymmetricBindingTest.java?rev=1463136&r1=1463135&r2=1463136&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/AsymmetricBindingTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/AsymmetricBindingTest.java Mon Apr  1 13:57:32 2013
@@ -22,8 +22,9 @@ import org.apache.wss4j.common.ext.WSSec
 import org.apache.wss4j.policy.stax.PolicyEnforcer;
 import org.apache.wss4j.policy.stax.PolicyViolationException;
 import org.apache.wss4j.stax.ext.WSSConstants;
+import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
+import org.apache.wss4j.stax.impl.securityToken.X509SecurityTokenImpl;
 import org.apache.wss4j.stax.securityEvent.*;
-import org.apache.xml.security.stax.ext.SecurityToken;
 import org.apache.xml.security.stax.ext.XMLSecurityConstants;
 import org.apache.xml.security.stax.securityEvent.EncryptedElementSecurityEvent;
 import org.apache.xml.security.stax.securityEvent.X509TokenSecurityEvent;
@@ -64,14 +65,14 @@ public class AsymmetricBindingTest exten
         policyEnforcer.registerSecurityEvent(requiredElementSecurityEvent);
 
         X509TokenSecurityEvent x509TokenSecurityEvent = new X509TokenSecurityEvent();
-        SecurityToken securityToken = getX509Token(WSSConstants.X509V3Token);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.MainSignature);
+        X509SecurityTokenImpl securityToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
         x509TokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(x509TokenSecurityEvent);
 
         x509TokenSecurityEvent = new X509TokenSecurityEvent();
-        securityToken = getX509Token(WSSConstants.X509V3Token);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.MainEncryption);
+        securityToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainEncryption);
         x509TokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(x509TokenSecurityEvent);
 
@@ -119,14 +120,14 @@ public class AsymmetricBindingTest exten
         PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
 
         X509TokenSecurityEvent x509TokenSecurityEvent = new X509TokenSecurityEvent();
-        SecurityToken securityToken = getX509Token(WSSConstants.X509V3Token);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.MainSignature);
+        X509SecurityTokenImpl securityToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
         x509TokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(x509TokenSecurityEvent);
 
         x509TokenSecurityEvent = new X509TokenSecurityEvent();
-        securityToken = getX509Token(WSSConstants.X509V3Token);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.MainEncryption);
+        securityToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainEncryption);
         x509TokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(x509TokenSecurityEvent);
         TimestampSecurityEvent timestampSecurityEvent = new TimestampSecurityEvent();
@@ -165,8 +166,8 @@ public class AsymmetricBindingTest exten
                         "</sp:AsymmetricBinding>";
         PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
         X509TokenSecurityEvent x509TokenSecurityEvent = new X509TokenSecurityEvent();
-        SecurityToken securityToken = getX509Token(WSSConstants.X509V3Token);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.MainEncryption);
+        X509SecurityTokenImpl securityToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainEncryption);
         x509TokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(x509TokenSecurityEvent);
 
@@ -211,14 +212,14 @@ public class AsymmetricBindingTest exten
         policyEnforcer.registerSecurityEvent(timestampSecurityEvent);
 
         X509TokenSecurityEvent x509TokenSecurityEvent = new X509TokenSecurityEvent();
-        SecurityToken securityToken = getX509Token(WSSConstants.X509V3Token);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.MainSignature);
+        X509SecurityTokenImpl securityToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
         x509TokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(x509TokenSecurityEvent);
 
         x509TokenSecurityEvent = new X509TokenSecurityEvent();
-        securityToken = getX509Token(WSSConstants.X509V3Token);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.MainEncryption);
+        securityToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainEncryption);
         x509TokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(x509TokenSecurityEvent);
 
@@ -266,14 +267,14 @@ public class AsymmetricBindingTest exten
         policyEnforcer.registerSecurityEvent(timestampSecurityEvent);
 
         X509TokenSecurityEvent x509TokenSecurityEvent = new X509TokenSecurityEvent();
-        SecurityToken securityToken = getX509Token(WSSConstants.X509V3Token);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.MainSignature);
+        X509SecurityTokenImpl securityToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
         x509TokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(x509TokenSecurityEvent);
 
         x509TokenSecurityEvent = new X509TokenSecurityEvent();
-        securityToken = getX509Token(WSSConstants.X509V3Token);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.MainEncryption);
+        securityToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainEncryption);
         x509TokenSecurityEvent.setSecurityToken(securityToken);
 
         policyEnforcer.registerSecurityEvent(x509TokenSecurityEvent);

Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/DerivedKeyTests.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/DerivedKeyTests.java?rev=1463136&r1=1463135&r2=1463136&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/DerivedKeyTests.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/DerivedKeyTests.java Mon Apr  1 13:57:32 2013
@@ -22,12 +22,12 @@ import org.apache.wss4j.common.ext.WSSec
 import org.apache.wss4j.policy.WSSPolicyException;
 import org.apache.wss4j.policy.stax.PolicyEnforcer;
 import org.apache.wss4j.stax.ext.WSSConstants;
-import org.apache.wss4j.stax.impl.securityToken.X509SecurityToken;
+import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
+import org.apache.wss4j.stax.impl.securityToken.X509SecurityTokenImpl;
 import org.apache.wss4j.stax.securityEvent.*;
-import org.apache.xml.security.stax.ext.SecurityToken;
 import org.apache.xml.security.stax.ext.XMLSecurityConstants;
 import org.apache.xml.security.stax.securityEvent.ContentEncryptedElementSecurityEvent;
-import org.apache.xml.security.stax.securityEvent.X509TokenSecurityEvent;
+import org.apache.xml.security.stax.securityToken.InboundSecurityToken;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
@@ -72,35 +72,39 @@ public class DerivedKeyTests extends Abs
 
         PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
         X509TokenSecurityEvent initiatorX509TokenSecurityEvent = new X509TokenSecurityEvent();
-        SecurityToken securityToken = getX509Token(WSSConstants.X509V3Token);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.MainSignature);
+        X509SecurityTokenImpl securityToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
         initiatorX509TokenSecurityEvent.setSecurityToken(securityToken);
 
         DerivedKeyTokenSecurityEvent derivedKeyTokenSecurityEvent = new DerivedKeyTokenSecurityEvent();
-        derivedKeyTokenSecurityEvent.setSecurityToken(getX509Token(WSSConstants.DerivedKeyToken));
-        securityToken.addWrappedToken(derivedKeyTokenSecurityEvent.getSecurityToken());
+        derivedKeyTokenSecurityEvent.setSecurityToken(getX509Token(WSSecurityTokenConstants.DerivedKeyToken));
+        securityToken.addWrappedToken((InboundSecurityToken)derivedKeyTokenSecurityEvent.getSecurityToken());
 
         policyEnforcer.registerSecurityEvent(initiatorX509TokenSecurityEvent);
 
         X509TokenSecurityEvent recipientX509TokenSecurityEvent = new X509TokenSecurityEvent();
-        securityToken = getX509Token(WSSConstants.X509V3Token);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.MainEncryption);
+        securityToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainEncryption);
         recipientX509TokenSecurityEvent.setSecurityToken(securityToken);
 
         derivedKeyTokenSecurityEvent = new DerivedKeyTokenSecurityEvent();
-        derivedKeyTokenSecurityEvent.setSecurityToken(getX509Token(WSSConstants.DerivedKeyToken));
-        securityToken.addWrappedToken(derivedKeyTokenSecurityEvent.getSecurityToken());
+        derivedKeyTokenSecurityEvent.setSecurityToken(getX509Token(WSSecurityTokenConstants.DerivedKeyToken));
+        securityToken.addWrappedToken((InboundSecurityToken)derivedKeyTokenSecurityEvent.getSecurityToken());
 
         policyEnforcer.registerSecurityEvent(recipientX509TokenSecurityEvent);
 
         List<XMLSecurityConstants.ContentType> protectionOrder = new LinkedList<XMLSecurityConstants.ContentType>();
         protectionOrder.add(XMLSecurityConstants.ContentType.SIGNATURE);
         protectionOrder.add(XMLSecurityConstants.ContentType.ENCRYPTION);
-        SignedPartSecurityEvent signedPartSecurityEvent = new SignedPartSecurityEvent(recipientX509TokenSecurityEvent.getSecurityToken(), true, protectionOrder);
+        SignedPartSecurityEvent signedPartSecurityEvent =
+                new SignedPartSecurityEvent(
+                        (InboundSecurityToken)recipientX509TokenSecurityEvent.getSecurityToken(), true, protectionOrder);
         signedPartSecurityEvent.setElementPath(WSSConstants.SOAP_11_BODY_PATH);
         policyEnforcer.registerSecurityEvent(signedPartSecurityEvent);
 
-        ContentEncryptedElementSecurityEvent contentEncryptedElementSecurityEvent = new ContentEncryptedElementSecurityEvent(recipientX509TokenSecurityEvent.getSecurityToken(), true, protectionOrder);
+        ContentEncryptedElementSecurityEvent contentEncryptedElementSecurityEvent =
+                new ContentEncryptedElementSecurityEvent(
+                        (InboundSecurityToken)recipientX509TokenSecurityEvent.getSecurityToken(), true, protectionOrder);
         contentEncryptedElementSecurityEvent.setElementPath(WSSConstants.SOAP_11_BODY_PATH);
         policyEnforcer.registerSecurityEvent(contentEncryptedElementSecurityEvent);
 
@@ -146,30 +150,34 @@ public class DerivedKeyTests extends Abs
 
         PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
         X509TokenSecurityEvent initiatorX509TokenSecurityEvent = new X509TokenSecurityEvent();
-        SecurityToken securityToken = getX509Token(WSSConstants.X509V3Token);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.MainSignature);
+        X509SecurityTokenImpl securityToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
         initiatorX509TokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(initiatorX509TokenSecurityEvent);
 
         X509TokenSecurityEvent recipientX509TokenSecurityEvent = new X509TokenSecurityEvent();
-        securityToken = getX509Token(WSSConstants.X509V3Token);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.MainEncryption);
+        securityToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainEncryption);
         recipientX509TokenSecurityEvent.setSecurityToken(securityToken);
 
         DerivedKeyTokenSecurityEvent derivedKeyTokenSecurityEvent = new DerivedKeyTokenSecurityEvent();
-        derivedKeyTokenSecurityEvent.setSecurityToken(getX509Token(WSSConstants.DerivedKeyToken));
-        securityToken.addWrappedToken(derivedKeyTokenSecurityEvent.getSecurityToken());
+        derivedKeyTokenSecurityEvent.setSecurityToken(getX509Token(WSSecurityTokenConstants.DerivedKeyToken));
+        securityToken.addWrappedToken((InboundSecurityToken)derivedKeyTokenSecurityEvent.getSecurityToken());
 
         policyEnforcer.registerSecurityEvent(recipientX509TokenSecurityEvent);
 
         List<XMLSecurityConstants.ContentType> protectionOrder = new LinkedList<XMLSecurityConstants.ContentType>();
         protectionOrder.add(XMLSecurityConstants.ContentType.SIGNATURE);
         protectionOrder.add(XMLSecurityConstants.ContentType.ENCRYPTION);
-        SignedPartSecurityEvent signedPartSecurityEvent = new SignedPartSecurityEvent(recipientX509TokenSecurityEvent.getSecurityToken(), true, protectionOrder);
+        SignedPartSecurityEvent signedPartSecurityEvent =
+                new SignedPartSecurityEvent(
+                        (InboundSecurityToken)recipientX509TokenSecurityEvent.getSecurityToken(), true, protectionOrder);
         signedPartSecurityEvent.setElementPath(WSSConstants.SOAP_11_BODY_PATH);
         policyEnforcer.registerSecurityEvent(signedPartSecurityEvent);
 
-        ContentEncryptedElementSecurityEvent contentEncryptedElementSecurityEvent = new ContentEncryptedElementSecurityEvent(recipientX509TokenSecurityEvent.getSecurityToken(), true, protectionOrder);
+        ContentEncryptedElementSecurityEvent contentEncryptedElementSecurityEvent =
+                new ContentEncryptedElementSecurityEvent(
+                        (InboundSecurityToken)recipientX509TokenSecurityEvent.getSecurityToken(), true, protectionOrder);
         contentEncryptedElementSecurityEvent.setElementPath(WSSConstants.SOAP_11_BODY_PATH);
         policyEnforcer.registerSecurityEvent(contentEncryptedElementSecurityEvent);
 
@@ -220,30 +228,34 @@ public class DerivedKeyTests extends Abs
 
         PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
         X509TokenSecurityEvent initiatorX509TokenSecurityEvent = new X509TokenSecurityEvent();
-        SecurityToken securityToken = getX509Token(WSSConstants.X509V3Token);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.MainSignature);
+        X509SecurityTokenImpl securityToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
         initiatorX509TokenSecurityEvent.setSecurityToken(securityToken);
 
         DerivedKeyTokenSecurityEvent derivedKeyTokenSecurityEvent = new DerivedKeyTokenSecurityEvent();
-        derivedKeyTokenSecurityEvent.setSecurityToken(getX509Token(WSSConstants.DerivedKeyToken));
-        securityToken.addWrappedToken(derivedKeyTokenSecurityEvent.getSecurityToken());
+        derivedKeyTokenSecurityEvent.setSecurityToken(getX509Token(WSSecurityTokenConstants.DerivedKeyToken));
+        securityToken.addWrappedToken((InboundSecurityToken)derivedKeyTokenSecurityEvent.getSecurityToken());
 
         policyEnforcer.registerSecurityEvent(initiatorX509TokenSecurityEvent);
 
         X509TokenSecurityEvent recipientX509TokenSecurityEvent = new X509TokenSecurityEvent();
-        securityToken = getX509Token(WSSConstants.X509V3Token);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.MainEncryption);
+        securityToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainEncryption);
         recipientX509TokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(recipientX509TokenSecurityEvent);
 
         List<XMLSecurityConstants.ContentType> protectionOrder = new LinkedList<XMLSecurityConstants.ContentType>();
         protectionOrder.add(XMLSecurityConstants.ContentType.SIGNATURE);
         protectionOrder.add(XMLSecurityConstants.ContentType.ENCRYPTION);
-        SignedPartSecurityEvent signedPartSecurityEvent = new SignedPartSecurityEvent(recipientX509TokenSecurityEvent.getSecurityToken(), true, protectionOrder);
+        SignedPartSecurityEvent signedPartSecurityEvent =
+                new SignedPartSecurityEvent(
+                        (InboundSecurityToken)recipientX509TokenSecurityEvent.getSecurityToken(), true, protectionOrder);
         signedPartSecurityEvent.setElementPath(WSSConstants.SOAP_11_BODY_PATH);
         policyEnforcer.registerSecurityEvent(signedPartSecurityEvent);
 
-        ContentEncryptedElementSecurityEvent contentEncryptedElementSecurityEvent = new ContentEncryptedElementSecurityEvent(recipientX509TokenSecurityEvent.getSecurityToken(), true, protectionOrder);
+        ContentEncryptedElementSecurityEvent contentEncryptedElementSecurityEvent =
+                new ContentEncryptedElementSecurityEvent(
+                        (InboundSecurityToken)recipientX509TokenSecurityEvent.getSecurityToken(), true, protectionOrder);
         contentEncryptedElementSecurityEvent.setElementPath(WSSConstants.SOAP_11_BODY_PATH);
         policyEnforcer.registerSecurityEvent(contentEncryptedElementSecurityEvent);
 
@@ -275,13 +287,13 @@ public class DerivedKeyTests extends Abs
 
         PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
         X509TokenSecurityEvent x509TokenSecurityEvent = new X509TokenSecurityEvent();
-        SecurityToken securityToken = getX509Token(WSSConstants.X509V3Token);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.SupportingTokens);
+        X509SecurityTokenImpl securityToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_SupportingTokens);
         x509TokenSecurityEvent.setSecurityToken(securityToken);
 
         DerivedKeyTokenSecurityEvent derivedKeyTokenSecurityEvent = new DerivedKeyTokenSecurityEvent();
-        derivedKeyTokenSecurityEvent.setSecurityToken(getX509Token(WSSConstants.DerivedKeyToken));
-        securityToken.addWrappedToken(derivedKeyTokenSecurityEvent.getSecurityToken());
+        derivedKeyTokenSecurityEvent.setSecurityToken(getX509Token(WSSecurityTokenConstants.DerivedKeyToken));
+        securityToken.addWrappedToken((InboundSecurityToken)derivedKeyTokenSecurityEvent.getSecurityToken());
 
         policyEnforcer.registerSecurityEvent(x509TokenSecurityEvent);
 
@@ -308,8 +320,8 @@ public class DerivedKeyTests extends Abs
 
         PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
         X509TokenSecurityEvent x509TokenSecurityEvent = new X509TokenSecurityEvent();
-        SecurityToken securityToken = getX509Token(WSSConstants.X509V1Token);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.SupportingTokens);
+        X509SecurityTokenImpl securityToken = getX509Token(WSSecurityTokenConstants.X509V1Token);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_SupportingTokens);
         x509TokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(x509TokenSecurityEvent);
 
@@ -342,24 +354,24 @@ public class DerivedKeyTests extends Abs
         PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
 
         X509TokenSecurityEvent x509TokenSecurityEvent = new X509TokenSecurityEvent();
-        SecurityToken securityToken = getX509Token(WSSConstants.X509V3Token);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.SupportingTokens);
+        X509SecurityTokenImpl securityToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_SupportingTokens);
         x509TokenSecurityEvent.setSecurityToken(securityToken);
 
         DerivedKeyTokenSecurityEvent derivedKeyTokenSecurityEvent = new DerivedKeyTokenSecurityEvent();
-        derivedKeyTokenSecurityEvent.setSecurityToken(getX509Token(WSSConstants.DerivedKeyToken));
-        securityToken.addWrappedToken(derivedKeyTokenSecurityEvent.getSecurityToken());
+        derivedKeyTokenSecurityEvent.setSecurityToken(getX509Token(WSSecurityTokenConstants.DerivedKeyToken));
+        securityToken.addWrappedToken((InboundSecurityToken)derivedKeyTokenSecurityEvent.getSecurityToken());
 
         policyEnforcer.registerSecurityEvent(x509TokenSecurityEvent);
 
         x509TokenSecurityEvent = new X509TokenSecurityEvent();
-        securityToken = getX509Token(WSSConstants.X509V3Token);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.SupportingTokens);
+        securityToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_SupportingTokens);
         x509TokenSecurityEvent.setSecurityToken(securityToken);
 
         derivedKeyTokenSecurityEvent = new DerivedKeyTokenSecurityEvent();
-        derivedKeyTokenSecurityEvent.setSecurityToken(getX509Token(WSSConstants.DerivedKeyToken));
-        securityToken.addWrappedToken(derivedKeyTokenSecurityEvent.getSecurityToken());
+        derivedKeyTokenSecurityEvent.setSecurityToken(getX509Token(WSSecurityTokenConstants.DerivedKeyToken));
+        securityToken.addWrappedToken((InboundSecurityToken)derivedKeyTokenSecurityEvent.getSecurityToken());
 
         policyEnforcer.registerSecurityEvent(x509TokenSecurityEvent);
 
@@ -387,14 +399,14 @@ public class DerivedKeyTests extends Abs
         PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
 
         X509TokenSecurityEvent x509TokenSecurityEvent = new X509TokenSecurityEvent();
-        SecurityToken securityToken = getX509Token(WSSConstants.X509V1Token);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.SupportingTokens);
+        X509SecurityTokenImpl securityToken = getX509Token(WSSecurityTokenConstants.X509V1Token);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_SupportingTokens);
         x509TokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(x509TokenSecurityEvent);
 
         x509TokenSecurityEvent = new X509TokenSecurityEvent();
-        securityToken = getX509Token(WSSConstants.X509V1Token);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.SupportingTokens);
+        securityToken = getX509Token(WSSecurityTokenConstants.X509V1Token);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_SupportingTokens);
         x509TokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(x509TokenSecurityEvent);
 
@@ -426,19 +438,19 @@ public class DerivedKeyTests extends Abs
         PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
 
         X509TokenSecurityEvent x509TokenSecurityEvent = new X509TokenSecurityEvent();
-        X509SecurityToken securityToken = getX509Token(WSSConstants.X509V3Token);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.SupportingTokens);
+        X509SecurityTokenImpl securityToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_SupportingTokens);
         x509TokenSecurityEvent.setSecurityToken(securityToken);
 
         DerivedKeyTokenSecurityEvent derivedKeyTokenSecurityEvent = new DerivedKeyTokenSecurityEvent();
-        derivedKeyTokenSecurityEvent.setSecurityToken(getX509Token(WSSConstants.DerivedKeyToken));
-        securityToken.addWrappedToken(derivedKeyTokenSecurityEvent.getSecurityToken());
+        derivedKeyTokenSecurityEvent.setSecurityToken(getX509Token(WSSecurityTokenConstants.DerivedKeyToken));
+        securityToken.addWrappedToken((InboundSecurityToken)derivedKeyTokenSecurityEvent.getSecurityToken());
 
         policyEnforcer.registerSecurityEvent(x509TokenSecurityEvent);
 
         x509TokenSecurityEvent = new X509TokenSecurityEvent();
-        securityToken = getX509Token(WSSConstants.X509V1Token);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.SupportingTokens);
+        securityToken = getX509Token(WSSecurityTokenConstants.X509V1Token);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_SupportingTokens);
         x509TokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(x509TokenSecurityEvent);
 
@@ -466,19 +478,19 @@ public class DerivedKeyTests extends Abs
         PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
 
         X509TokenSecurityEvent x509TokenSecurityEvent = new X509TokenSecurityEvent();
-        X509SecurityToken securityToken = getX509Token(WSSConstants.X509V1Token);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.SupportingTokens);
+        X509SecurityTokenImpl securityToken = getX509Token(WSSecurityTokenConstants.X509V1Token);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_SupportingTokens);
         x509TokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(x509TokenSecurityEvent);
 
         x509TokenSecurityEvent = new X509TokenSecurityEvent();
-        securityToken = getX509Token(WSSConstants.X509V3Token);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.SupportingTokens);
+        securityToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_SupportingTokens);
         x509TokenSecurityEvent.setSecurityToken(securityToken);
 
         DerivedKeyTokenSecurityEvent derivedKeyTokenSecurityEvent = new DerivedKeyTokenSecurityEvent();
-        derivedKeyTokenSecurityEvent.setSecurityToken(getX509Token(WSSConstants.DerivedKeyToken));
-        securityToken.addWrappedToken(derivedKeyTokenSecurityEvent.getSecurityToken());
+        derivedKeyTokenSecurityEvent.setSecurityToken(getX509Token(WSSecurityTokenConstants.DerivedKeyToken));
+        securityToken.addWrappedToken((InboundSecurityToken)derivedKeyTokenSecurityEvent.getSecurityToken());
 
         policyEnforcer.registerSecurityEvent(x509TokenSecurityEvent);
 

Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/HttpsTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/HttpsTokenTest.java?rev=1463136&r1=1463135&r2=1463136&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/HttpsTokenTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/HttpsTokenTest.java Mon Apr  1 13:57:32 2013
@@ -21,10 +21,10 @@ package org.apache.wss4j.policy.stax.tes
 import org.apache.wss4j.common.ext.WSSecurityException;
 import org.apache.wss4j.policy.stax.PolicyEnforcer;
 import org.apache.wss4j.policy.stax.PolicyViolationException;
-import org.apache.wss4j.stax.ext.WSSConstants;
+import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
+import org.apache.wss4j.stax.impl.securityToken.HttpsSecurityTokenImpl;
 import org.apache.wss4j.stax.securityEvent.HttpsTokenSecurityEvent;
 import org.apache.wss4j.stax.securityEvent.OperationSecurityEvent;
-import org.apache.xml.security.stax.ext.SecurityToken;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
@@ -57,8 +57,8 @@ public class HttpsTokenTest extends Abst
 
         PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
         HttpsTokenSecurityEvent httpsTokenSecurityEvent = new HttpsTokenSecurityEvent();
-        SecurityToken securityToken = getX509Token(WSSConstants.X509V3Token);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.MainEncryption);
+        HttpsSecurityTokenImpl securityToken = getHttpsSecurityToken(WSSecurityTokenConstants.X509V3Token);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainEncryption);
         httpsTokenSecurityEvent.setSecurityToken(securityToken);
         httpsTokenSecurityEvent.setAuthenticationType(HttpsTokenSecurityEvent.AuthenticationType.HttpsClientCertificateAuthentication);
         httpsTokenSecurityEvent.setIssuerName("xs:anyURI");
@@ -96,8 +96,8 @@ public class HttpsTokenTest extends Abst
 
         PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
         HttpsTokenSecurityEvent httpsTokenSecurityEvent = new HttpsTokenSecurityEvent();
-        SecurityToken securityToken = getX509Token(WSSConstants.X509V3Token);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.MainEncryption);
+        HttpsSecurityTokenImpl securityToken = getHttpsSecurityToken(WSSecurityTokenConstants.X509V3Token);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainEncryption);
         httpsTokenSecurityEvent.setSecurityToken(securityToken);
         httpsTokenSecurityEvent.setAuthenticationType(HttpsTokenSecurityEvent.AuthenticationType.HttpBasicAuthentication);
         httpsTokenSecurityEvent.setIssuerName("xs:anyURI");



Mime
View raw message