ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gi...@apache.org
Subject svn commit: r1463136 [5/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/test/java/org/apache/wss4j/policy/stax/test/TokenProtectionTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/TokenProtectionTest.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/TokenProtectionTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/TokenProtectionTest.java Mon Apr  1 13:57:32 2013
@@ -22,12 +22,14 @@ 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.impl.securityToken.X509SecurityToken;
+import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
+import org.apache.wss4j.stax.impl.securityToken.X509SecurityTokenImpl;
 import org.apache.wss4j.stax.securityEvent.OperationSecurityEvent;
-import org.apache.xml.security.stax.ext.SecurityToken;
 import org.apache.xml.security.stax.ext.XMLSecurityConstants;
 import org.apache.xml.security.stax.securityEvent.SignedElementSecurityEvent;
 import org.apache.xml.security.stax.securityEvent.X509TokenSecurityEvent;
+import org.apache.xml.security.stax.securityToken.InboundSecurityToken;
+import org.apache.xml.security.stax.securityToken.SecurityToken;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
@@ -36,6 +38,23 @@ import java.util.*;
 
 public class TokenProtectionTest extends AbstractPolicyTestBase {
 
+    private static List<WSSecurityTokenConstants.TokenUsage> tokenUsages = new ArrayList<WSSecurityTokenConstants.TokenUsage>();
+
+    static {
+        tokenUsages.add(WSSecurityTokenConstants.TokenUsage_Signature);
+        tokenUsages.add(WSSecurityTokenConstants.TokenUsage_Encryption);
+        tokenUsages.add(WSSecurityTokenConstants.TokenUsage_MainSignature);
+        tokenUsages.add(WSSecurityTokenConstants.TokenUsage_MainEncryption);
+        tokenUsages.add(WSSecurityTokenConstants.TokenUsage_SupportingTokens);
+        tokenUsages.add(WSSecurityTokenConstants.TokenUsage_SignedSupportingTokens);
+        tokenUsages.add(WSSecurityTokenConstants.TokenUsage_SignedEndorsingSupportingTokens);
+        tokenUsages.add(WSSecurityTokenConstants.TokenUsage_SignedEncryptedSupportingTokens);
+        tokenUsages.add(WSSecurityTokenConstants.TokenUsage_SignedEndorsingEncryptedSupportingTokens);
+        tokenUsages.add(WSSecurityTokenConstants.TokenUsage_EndorsingEncryptedSupportingTokens);
+        tokenUsages.add(WSSecurityTokenConstants.TokenUsage_EndorsingSupportingTokens);
+        tokenUsages.add(WSSecurityTokenConstants.TokenUsage_EncryptedSupportingTokens);
+    }
+
     @Test
     public void testPolicy() throws Exception {
         String policyString =
@@ -64,9 +83,10 @@ public class TokenProtectionTest extends
 
         List<SecurityToken> securityTokens = new LinkedList<SecurityToken>();
 
-        for (SecurityToken.TokenUsage tokenUsage : EnumSet.allOf(SecurityToken.TokenUsage.class)) {
+        for (int i = 0; i < tokenUsages.size(); i++) {
+            WSSecurityTokenConstants.TokenUsage tokenUsage = tokenUsages.get(i);
             X509TokenSecurityEvent x509TokenSecurityEvent = new X509TokenSecurityEvent();
-            X509SecurityToken securityToken = getX509Token(WSSConstants.X509V3Token);
+            X509SecurityTokenImpl securityToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
             securityTokens.add(securityToken);
 
             securityToken.setElementPath(bstPath);
@@ -74,13 +94,13 @@ public class TokenProtectionTest extends
             x509TokenSecurityEvent.setSecurityToken(securityToken);
             policyEnforcer.registerSecurityEvent(x509TokenSecurityEvent);
 
-            if (tokenUsage.name().contains("Signature") || tokenUsage.name().contains("Endorsing")) {
+            if (tokenUsage.getName().contains("Signature") || tokenUsage.getName().contains("Endorsing")) {
                 SignedElementSecurityEvent signedElementSecurityEvent = new SignedElementSecurityEvent(securityToken, true, protectionOrder);
                 signedElementSecurityEvent.setElementPath(bstPath);
                 policyEnforcer.registerSecurityEvent(signedElementSecurityEvent);
             }
 
-            if (tokenUsage.name().contains("Endorsing")) {
+            if (tokenUsage.getName().contains("Endorsing")) {
                 SignedElementSecurityEvent signedElementSecurityEvent = new SignedElementSecurityEvent(securityToken, true, protectionOrder);
                 signedElementSecurityEvent.setElementPath(sigPath);
                 policyEnforcer.registerSecurityEvent(signedElementSecurityEvent);
@@ -91,7 +111,7 @@ public class TokenProtectionTest extends
         Iterator<SecurityToken> securityTokenIterator = securityTokens.iterator();
         while (securityTokenIterator.hasNext()) {
             SecurityToken securityToken = securityTokenIterator.next();
-            if (securityToken.getTokenUsages().contains(SecurityToken.TokenUsage.MainSignature)) {
+            if (securityToken.getTokenUsages().contains(WSSecurityTokenConstants.TokenUsage_MainSignature)) {
                 mainSignatureToken = securityToken;
                 break;
             }
@@ -100,8 +120,9 @@ public class TokenProtectionTest extends
         securityTokenIterator = securityTokens.iterator();
         while (securityTokenIterator.hasNext()) {
             SecurityToken securityToken = securityTokenIterator.next();
-            if (securityToken.getTokenUsages().get(0).name().contains("Signed")) {
-                SignedElementSecurityEvent signedElementSecurityEvent = new SignedElementSecurityEvent(mainSignatureToken, true, protectionOrder);
+            if (securityToken.getTokenUsages().get(0).getName().contains("Signed")) {
+                SignedElementSecurityEvent signedElementSecurityEvent =
+                        new SignedElementSecurityEvent((InboundSecurityToken)mainSignatureToken, true, protectionOrder);
                 signedElementSecurityEvent.setElementPath(bstPath);
                 policyEnforcer.registerSecurityEvent(signedElementSecurityEvent);
             }
@@ -141,9 +162,10 @@ public class TokenProtectionTest extends
 
         List<SecurityToken> securityTokens = new LinkedList<SecurityToken>();
 
-        for (SecurityToken.TokenUsage tokenUsage : EnumSet.allOf(SecurityToken.TokenUsage.class)) {
+        for (int i = 0; i < tokenUsages.size(); i++) {
+            WSSecurityTokenConstants.TokenUsage tokenUsage = tokenUsages.get(i);
             X509TokenSecurityEvent x509TokenSecurityEvent = new X509TokenSecurityEvent();
-            X509SecurityToken securityToken = getX509Token(WSSConstants.X509V3Token);
+            X509SecurityTokenImpl securityToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
             securityTokens.add(securityToken);
 
             securityToken.setElementPath(bstPath);
@@ -151,7 +173,7 @@ public class TokenProtectionTest extends
             x509TokenSecurityEvent.setSecurityToken(securityToken);
             policyEnforcer.registerSecurityEvent(x509TokenSecurityEvent);
 
-            if (tokenUsage.name().contains("Endorsing")) {
+            if (tokenUsage.getName().contains("Endorsing")) {
                 SignedElementSecurityEvent signedElementSecurityEvent = new SignedElementSecurityEvent(securityToken, true, protectionOrder);
                 signedElementSecurityEvent.setElementPath(sigPath);
                 policyEnforcer.registerSecurityEvent(signedElementSecurityEvent);
@@ -162,7 +184,7 @@ public class TokenProtectionTest extends
         Iterator<SecurityToken> securityTokenIterator = securityTokens.iterator();
         while (securityTokenIterator.hasNext()) {
             SecurityToken securityToken = securityTokenIterator.next();
-            if (securityToken.getTokenUsages().contains(SecurityToken.TokenUsage.MainSignature)) {
+            if (securityToken.getTokenUsages().contains(WSSecurityTokenConstants.TokenUsage_MainSignature)) {
                 mainSignatureToken = securityToken;
                 break;
             }
@@ -171,8 +193,9 @@ public class TokenProtectionTest extends
         securityTokenIterator = securityTokens.iterator();
         while (securityTokenIterator.hasNext()) {
             SecurityToken securityToken = securityTokenIterator.next();
-            if (securityToken.getTokenUsages().get(0).name().contains("Signed")) {
-                SignedElementSecurityEvent signedElementSecurityEvent = new SignedElementSecurityEvent(mainSignatureToken, true, protectionOrder);
+            if (securityToken.getTokenUsages().get(0).getName().contains("Signed")) {
+                SignedElementSecurityEvent signedElementSecurityEvent =
+                        new SignedElementSecurityEvent((InboundSecurityToken)mainSignatureToken, true, protectionOrder);
                 signedElementSecurityEvent.setElementPath(bstPath);
                 policyEnforcer.registerSecurityEvent(signedElementSecurityEvent);
             }
@@ -206,12 +229,12 @@ public class TokenProtectionTest extends
         PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
 
         X509TokenSecurityEvent x509TokenSecurityEvent = new X509TokenSecurityEvent();
-        X509SecurityToken securityToken = getX509Token(WSSConstants.X509V3Token);
+        X509SecurityTokenImpl securityToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
         List<QName> path = new ArrayList<QName>();
         path.addAll(WSSConstants.WSSE_SECURITY_HEADER_PATH);
         path.add(WSSConstants.TAG_wsse_BinarySecurityToken);
         securityToken.setElementPath(path);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.MainSignature);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
         x509TokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(x509TokenSecurityEvent);
 
@@ -252,19 +275,19 @@ public class TokenProtectionTest extends
         PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
 
         X509TokenSecurityEvent x509TokenSecurityEvent = new X509TokenSecurityEvent();
-        X509SecurityToken securityToken = getX509Token(WSSConstants.X509V3Token);
+        X509SecurityTokenImpl securityToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
         List<QName> path = new ArrayList<QName>();
         path.addAll(WSSConstants.WSSE_SECURITY_HEADER_PATH);
         path.add(WSSConstants.TAG_wsse_BinarySecurityToken);
         securityToken.setElementPath(path);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.MainSignature);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
         x509TokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(x509TokenSecurityEvent);
 
         List<XMLSecurityConstants.ContentType> protectionOrder = new LinkedList<XMLSecurityConstants.ContentType>();
         protectionOrder.add(XMLSecurityConstants.ContentType.SIGNATURE);
 
-        SignedElementSecurityEvent signedElementSecurityEvent = new SignedElementSecurityEvent(getX509Token(WSSConstants.X509V3Token), false, protectionOrder);
+        SignedElementSecurityEvent signedElementSecurityEvent = new SignedElementSecurityEvent(getX509Token(WSSecurityTokenConstants.X509V3Token), false, protectionOrder);
         signedElementSecurityEvent.setElementPath(path);
         policyEnforcer.registerSecurityEvent(signedElementSecurityEvent);
 
@@ -298,18 +321,18 @@ public class TokenProtectionTest extends
         PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
 
         X509TokenSecurityEvent x509TokenSecurityEvent = new X509TokenSecurityEvent();
-        X509SecurityToken securityToken = getX509Token(WSSConstants.X509V3Token);
+        X509SecurityTokenImpl securityToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
         List<QName> path = new ArrayList<QName>();
         path.addAll(WSSConstants.WSSE_SECURITY_HEADER_PATH);
         path.add(WSSConstants.TAG_wsse_BinarySecurityToken);
         securityToken.setElementPath(path);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.MainSignature);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
         x509TokenSecurityEvent.setSecurityToken(securityToken);
 
         List<XMLSecurityConstants.ContentType> protectionOrder = new LinkedList<XMLSecurityConstants.ContentType>();
         protectionOrder.add(XMLSecurityConstants.ContentType.SIGNATURE);
 
-        SignedElementSecurityEvent signedElementSecurityEvent = new SignedElementSecurityEvent(getX509Token(WSSConstants.X509V3Token), false, protectionOrder);
+        SignedElementSecurityEvent signedElementSecurityEvent = new SignedElementSecurityEvent(getX509Token(WSSecurityTokenConstants.X509V3Token), false, protectionOrder);
         signedElementSecurityEvent.setElementPath(path);
         policyEnforcer.registerSecurityEvent(signedElementSecurityEvent);
 
@@ -353,9 +376,10 @@ public class TokenProtectionTest extends
 
         List<SecurityToken> securityTokens = new LinkedList<SecurityToken>();
 
-        for (SecurityToken.TokenUsage tokenUsage : EnumSet.allOf(SecurityToken.TokenUsage.class)) {
+        for (int i = 0; i < tokenUsages.size(); i++) {
+            WSSecurityTokenConstants.TokenUsage tokenUsage = tokenUsages.get(i);
             X509TokenSecurityEvent x509TokenSecurityEvent = new X509TokenSecurityEvent();
-            X509SecurityToken securityToken = getX509Token(WSSConstants.X509V3Token);
+            X509SecurityTokenImpl securityToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
 
             securityTokens.add(securityToken);
 
@@ -364,7 +388,7 @@ public class TokenProtectionTest extends
             x509TokenSecurityEvent.setSecurityToken(securityToken);
             policyEnforcer.registerSecurityEvent(x509TokenSecurityEvent);
 
-            if (tokenUsage.name().contains("Signature") || tokenUsage.name().contains("Endorsing")) {
+            if (tokenUsage.getName().contains("Signature") || tokenUsage.getName().contains("Endorsing")) {
                 SignedElementSecurityEvent signedElementSecurityEvent = new SignedElementSecurityEvent(securityToken, true, protectionOrder);
                 signedElementSecurityEvent.setElementPath(bstPath);
                 policyEnforcer.registerSecurityEvent(signedElementSecurityEvent);
@@ -375,7 +399,7 @@ public class TokenProtectionTest extends
         Iterator<SecurityToken> securityTokenIterator = securityTokens.iterator();
         while (securityTokenIterator.hasNext()) {
             SecurityToken securityToken = securityTokenIterator.next();
-            if (securityToken.getTokenUsages().contains(SecurityToken.TokenUsage.MainSignature)) {
+            if (securityToken.getTokenUsages().contains(WSSecurityTokenConstants.TokenUsage_MainSignature)) {
                 mainSignatureToken = securityToken;
                 break;
             }
@@ -384,8 +408,9 @@ public class TokenProtectionTest extends
         securityTokenIterator = securityTokens.iterator();
         while (securityTokenIterator.hasNext()) {
             SecurityToken securityToken = securityTokenIterator.next();
-            if (securityToken.getTokenUsages().get(0).name().contains("Signed")) {
-                SignedElementSecurityEvent signedElementSecurityEvent = new SignedElementSecurityEvent(mainSignatureToken, true, protectionOrder);
+            if (securityToken.getTokenUsages().get(0).getName().contains("Signed")) {
+                SignedElementSecurityEvent signedElementSecurityEvent =
+                        new SignedElementSecurityEvent((InboundSecurityToken)mainSignatureToken, true, protectionOrder);
                 signedElementSecurityEvent.setElementPath(bstPath);
                 policyEnforcer.registerSecurityEvent(signedElementSecurityEvent);
             }
@@ -429,22 +454,23 @@ public class TokenProtectionTest extends
         sigPath.addAll(WSSConstants.WSSE_SECURITY_HEADER_PATH);
         sigPath.add(WSSConstants.TAG_dsig_Signature);
 
-        for (SecurityToken.TokenUsage tokenUsage : EnumSet.allOf(SecurityToken.TokenUsage.class)) {
+        for (int i = 0; i < tokenUsages.size(); i++) {
+            WSSecurityTokenConstants.TokenUsage tokenUsage = tokenUsages.get(i);
             X509TokenSecurityEvent x509TokenSecurityEvent = new X509TokenSecurityEvent();
-            X509SecurityToken securityToken = getX509Token(WSSConstants.X509V3Token);
+            X509SecurityTokenImpl securityToken = getX509Token(WSSecurityTokenConstants.X509V3Token);
 
             securityToken.setElementPath(bstPath);
             securityToken.addTokenUsage(tokenUsage);
             x509TokenSecurityEvent.setSecurityToken(securityToken);
             policyEnforcer.registerSecurityEvent(x509TokenSecurityEvent);
 
-            if (tokenUsage.name().contains("Signature") || tokenUsage.name().contains("Endorsing")) {
+            if (tokenUsage.getName().contains("Signature") || tokenUsage.getName().contains("Endorsing")) {
                 SignedElementSecurityEvent signedElementSecurityEvent = new SignedElementSecurityEvent(securityToken, true, protectionOrder);
                 signedElementSecurityEvent.setElementPath(bstPath);
                 policyEnforcer.registerSecurityEvent(signedElementSecurityEvent);
             }
 
-            if (tokenUsage.name().contains("Endorsing")) {
+            if (tokenUsage.getName().contains("Endorsing")) {
                 SignedElementSecurityEvent signedElementSecurityEvent = new SignedElementSecurityEvent(securityToken, true, protectionOrder);
                 signedElementSecurityEvent.setElementPath(sigPath);
                 policyEnforcer.registerSecurityEvent(signedElementSecurityEvent);

Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/TransportBindingIntegrationTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/TransportBindingIntegrationTest.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/TransportBindingIntegrationTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/TransportBindingIntegrationTest.java Mon Apr  1 13:57:32 2013
@@ -25,12 +25,12 @@ import org.apache.wss4j.policy.stax.Poli
 import org.apache.wss4j.stax.WSSec;
 import org.apache.wss4j.stax.ext.WSSConstants;
 import org.apache.wss4j.stax.ext.WSSSecurityProperties;
-import org.apache.wss4j.stax.impl.securityToken.HttpsSecurityToken;
+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.test.CallbackHandlerImpl;
 import org.apache.xml.security.stax.config.Init;
 import org.apache.xml.security.stax.ext.SecurePart;
-import org.apache.xml.security.stax.ext.SecurityToken;
 import org.apache.xml.security.stax.securityEvent.SecurityEvent;
 import org.testng.Assert;
 import org.testng.annotations.Test;
@@ -126,8 +126,8 @@ public class TransportBindingIntegration
         HttpsTokenSecurityEvent httpsTokenSecurityEvent = new HttpsTokenSecurityEvent();
         httpsTokenSecurityEvent.setIssuerName("transmitter");
         httpsTokenSecurityEvent.setAuthenticationType(HttpsTokenSecurityEvent.AuthenticationType.HttpBasicAuthentication);
-        HttpsSecurityToken httpsSecurityToken = new HttpsSecurityToken(true, "transmitter", null);
-        httpsSecurityToken.addTokenUsage(SecurityToken.TokenUsage.MainSignature);
+        HttpsSecurityTokenImpl httpsSecurityToken = new HttpsSecurityTokenImpl(true, "transmitter");
+        httpsSecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
         httpsTokenSecurityEvent.setSecurityToken(httpsSecurityToken);
 
         List<SecurityEvent> securityEventList = new ArrayList<SecurityEvent>();
@@ -226,8 +226,8 @@ public class TransportBindingIntegration
         HttpsTokenSecurityEvent httpsTokenSecurityEvent = new HttpsTokenSecurityEvent();
         httpsTokenSecurityEvent.setIssuerName("transmitter");
         httpsTokenSecurityEvent.setAuthenticationType(HttpsTokenSecurityEvent.AuthenticationType.HttpBasicAuthentication);
-        HttpsSecurityToken httpsSecurityToken = new HttpsSecurityToken(true, "transmitter", null);
-        httpsSecurityToken.addTokenUsage(SecurityToken.TokenUsage.MainSignature);
+        HttpsSecurityTokenImpl httpsSecurityToken = new HttpsSecurityTokenImpl(true, "transmitter");
+        httpsSecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
         httpsTokenSecurityEvent.setSecurityToken(httpsSecurityToken);
 
         List<SecurityEvent> securityEventList = new ArrayList<SecurityEvent>();
@@ -345,8 +345,8 @@ public class TransportBindingIntegration
         HttpsTokenSecurityEvent httpsTokenSecurityEvent = new HttpsTokenSecurityEvent();
         httpsTokenSecurityEvent.setIssuerName("transmitter");
         httpsTokenSecurityEvent.setAuthenticationType(HttpsTokenSecurityEvent.AuthenticationType.HttpBasicAuthentication);
-        HttpsSecurityToken httpsSecurityToken = new HttpsSecurityToken(true, "transmitter", null);
-        httpsSecurityToken.addTokenUsage(SecurityToken.TokenUsage.MainSignature);
+        HttpsSecurityTokenImpl httpsSecurityToken = new HttpsSecurityTokenImpl(true, "transmitter");
+        httpsSecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
         httpsTokenSecurityEvent.setSecurityToken(httpsSecurityToken);
 
         List<SecurityEvent> securityEventList = new ArrayList<SecurityEvent>();
@@ -456,8 +456,8 @@ public class TransportBindingIntegration
         HttpsTokenSecurityEvent httpsTokenSecurityEvent = new HttpsTokenSecurityEvent();
         httpsTokenSecurityEvent.setIssuerName("transmitter");
         httpsTokenSecurityEvent.setAuthenticationType(HttpsTokenSecurityEvent.AuthenticationType.HttpBasicAuthentication);
-        HttpsSecurityToken httpsSecurityToken = new HttpsSecurityToken(true, "transmitter", null);
-        httpsSecurityToken.addTokenUsage(SecurityToken.TokenUsage.MainSignature);
+        HttpsSecurityTokenImpl httpsSecurityToken = new HttpsSecurityTokenImpl(true, "transmitter");
+        httpsSecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
         httpsTokenSecurityEvent.setSecurityToken(httpsSecurityToken);
 
         List<SecurityEvent> securityEventList = new ArrayList<SecurityEvent>();
@@ -568,9 +568,9 @@ public class TransportBindingIntegration
         HttpsTokenSecurityEvent httpsTokenSecurityEvent = new HttpsTokenSecurityEvent();
         httpsTokenSecurityEvent.setIssuerName("transmitter");
         httpsTokenSecurityEvent.setAuthenticationType(HttpsTokenSecurityEvent.AuthenticationType.HttpBasicAuthentication);
-        HttpsSecurityToken httpsSecurityToken = new HttpsSecurityToken(true, "transmitter", null);
+        HttpsSecurityTokenImpl httpsSecurityToken = new HttpsSecurityTokenImpl(true, "transmitter");
         //todo token usage hard-coded in httpsSecurityToken?
-        httpsSecurityToken.addTokenUsage(SecurityToken.TokenUsage.MainSignature);
+        httpsSecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
         httpsTokenSecurityEvent.setSecurityToken(httpsSecurityToken);
 
         List<SecurityEvent> securityEventList = new ArrayList<SecurityEvent>();
@@ -697,8 +697,8 @@ public class TransportBindingIntegration
         HttpsTokenSecurityEvent httpsTokenSecurityEvent = new HttpsTokenSecurityEvent();
         httpsTokenSecurityEvent.setIssuerName("CN=transmitter,OU=swssf,C=CH");
         httpsTokenSecurityEvent.setAuthenticationType(HttpsTokenSecurityEvent.AuthenticationType.HttpsClientCertificateAuthentication);
-        HttpsSecurityToken httpsSecurityToken = new HttpsSecurityToken(true, "CN=transmitter,OU=swssf,C=CH", null);
-        httpsSecurityToken.addTokenUsage(SecurityToken.TokenUsage.MainSignature);
+        HttpsSecurityTokenImpl httpsSecurityToken = new HttpsSecurityTokenImpl(true, "CN=transmitter,OU=swssf,C=CH");
+        httpsSecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
         httpsTokenSecurityEvent.setSecurityToken(httpsSecurityToken);
 
         List<SecurityEvent> securityEventList = new ArrayList<SecurityEvent>();
@@ -813,8 +813,8 @@ public class TransportBindingIntegration
         HttpsTokenSecurityEvent httpsTokenSecurityEvent = new HttpsTokenSecurityEvent();
         httpsTokenSecurityEvent.setIssuerName("CN=example,OU=swssf,C=CH");
         httpsTokenSecurityEvent.setAuthenticationType(HttpsTokenSecurityEvent.AuthenticationType.HttpsClientCertificateAuthentication);
-        HttpsSecurityToken httpsSecurityToken = new HttpsSecurityToken(true, "CN=example,OU=swssf,C=CH", null);
-        httpsSecurityToken.addTokenUsage(SecurityToken.TokenUsage.MainSignature);
+        HttpsSecurityTokenImpl httpsSecurityToken = new HttpsSecurityTokenImpl(true, "CN=example,OU=swssf,C=CH");
+        httpsSecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
         httpsTokenSecurityEvent.setSecurityToken(httpsSecurityToken);
 
         List<SecurityEvent> securityEventList = new ArrayList<SecurityEvent>();
@@ -928,8 +928,8 @@ public class TransportBindingIntegration
         HttpsTokenSecurityEvent httpsTokenSecurityEvent = new HttpsTokenSecurityEvent();
         httpsTokenSecurityEvent.setIssuerName("transmitter");
         httpsTokenSecurityEvent.setAuthenticationType(HttpsTokenSecurityEvent.AuthenticationType.HttpBasicAuthentication);
-        HttpsSecurityToken httpsSecurityToken = new HttpsSecurityToken(true, "transmitter", null);
-        httpsSecurityToken.addTokenUsage(SecurityToken.TokenUsage.MainSignature);
+        HttpsSecurityTokenImpl httpsSecurityToken = new HttpsSecurityTokenImpl(true, "transmitter");
+        httpsSecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
         httpsTokenSecurityEvent.setSecurityToken(httpsSecurityToken);
 
         List<SecurityEvent> securityEventList = new ArrayList<SecurityEvent>();
@@ -1045,8 +1045,8 @@ public class TransportBindingIntegration
         HttpsTokenSecurityEvent httpsTokenSecurityEvent = new HttpsTokenSecurityEvent();
         httpsTokenSecurityEvent.setIssuerName("transmitter");
         httpsTokenSecurityEvent.setAuthenticationType(HttpsTokenSecurityEvent.AuthenticationType.HttpBasicAuthentication);
-        HttpsSecurityToken httpsSecurityToken = new HttpsSecurityToken(true, "transmitter", null);
-        httpsSecurityToken.addTokenUsage(SecurityToken.TokenUsage.MainSignature);
+        HttpsSecurityTokenImpl httpsSecurityToken = new HttpsSecurityTokenImpl(true, "transmitter");
+        httpsSecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
         httpsTokenSecurityEvent.setSecurityToken(httpsSecurityToken);
 
         List<SecurityEvent> securityEventList = new ArrayList<SecurityEvent>();
@@ -1160,8 +1160,8 @@ public class TransportBindingIntegration
         HttpsTokenSecurityEvent httpsTokenSecurityEvent = new HttpsTokenSecurityEvent();
         httpsTokenSecurityEvent.setIssuerName("transmitter");
         httpsTokenSecurityEvent.setAuthenticationType(HttpsTokenSecurityEvent.AuthenticationType.HttpBasicAuthentication);
-        HttpsSecurityToken httpsSecurityToken = new HttpsSecurityToken(true, "transmitter", null);
-        httpsSecurityToken.addTokenUsage(SecurityToken.TokenUsage.MainSignature);
+        HttpsSecurityTokenImpl httpsSecurityToken = new HttpsSecurityTokenImpl(true, "transmitter");
+        httpsSecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
         httpsTokenSecurityEvent.setSecurityToken(httpsSecurityToken);
 
         List<SecurityEvent> securityEventList = new ArrayList<SecurityEvent>();
@@ -1278,8 +1278,8 @@ public class TransportBindingIntegration
         HttpsTokenSecurityEvent httpsTokenSecurityEvent = new HttpsTokenSecurityEvent();
         httpsTokenSecurityEvent.setIssuerName("transmitter");
         httpsTokenSecurityEvent.setAuthenticationType(HttpsTokenSecurityEvent.AuthenticationType.HttpBasicAuthentication);
-        HttpsSecurityToken httpsSecurityToken = new HttpsSecurityToken(true, "transmitter", null);
-        httpsSecurityToken.addTokenUsage(SecurityToken.TokenUsage.MainSignature);
+        HttpsSecurityTokenImpl httpsSecurityToken = new HttpsSecurityTokenImpl(true, "transmitter");
+        httpsSecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
         httpsTokenSecurityEvent.setSecurityToken(httpsSecurityToken);
 
         List<SecurityEvent> securityEventList = new ArrayList<SecurityEvent>();
@@ -1392,8 +1392,8 @@ public class TransportBindingIntegration
         HttpsTokenSecurityEvent httpsTokenSecurityEvent = new HttpsTokenSecurityEvent();
         httpsTokenSecurityEvent.setIssuerName("transmitter");
         httpsTokenSecurityEvent.setAuthenticationType(HttpsTokenSecurityEvent.AuthenticationType.HttpBasicAuthentication);
-        HttpsSecurityToken httpsSecurityToken = new HttpsSecurityToken(true, "transmitter", null);
-        httpsSecurityToken.addTokenUsage(SecurityToken.TokenUsage.MainSignature);
+        HttpsSecurityTokenImpl httpsSecurityToken = new HttpsSecurityTokenImpl(true, "transmitter", null);
+        httpsSecurityToken.addTokenUsage(WSTokenConstants.TokenUsage_MainSignature);
         httpsTokenSecurityEvent.setSecurityToken(httpsSecurityToken);
 
         List<SecurityEvent> securityEventList = new ArrayList<SecurityEvent>();

Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/TransportBindingTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/TransportBindingTest.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/TransportBindingTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/TransportBindingTest.java Mon Apr  1 13:57:32 2013
@@ -22,9 +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.impl.securityToken.HttpsSecurityToken;
+import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
+import org.apache.wss4j.stax.impl.securityToken.HttpsSecurityTokenImpl;
 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.testng.Assert;
@@ -62,8 +62,8 @@ public class TransportBindingTest extend
         policyEnforcer.registerSecurityEvent(requiredElementSecurityEvent);
 
         HttpsTokenSecurityEvent httpsTokenSecurityEvent = new HttpsTokenSecurityEvent();
-        HttpsSecurityToken httpsSecurityToken = new HttpsSecurityToken(true, "username", null);
-        httpsSecurityToken.addTokenUsage(SecurityToken.TokenUsage.MainSignature);
+        HttpsSecurityTokenImpl httpsSecurityToken = new HttpsSecurityTokenImpl(true, "username");
+        httpsSecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
         httpsTokenSecurityEvent.setSecurityToken(httpsSecurityToken);
         policyEnforcer.registerSecurityEvent(httpsTokenSecurityEvent);
 
@@ -110,8 +110,8 @@ public class TransportBindingTest extend
         PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
 
         HttpsTokenSecurityEvent httpsTokenSecurityEvent = new HttpsTokenSecurityEvent();
-        HttpsSecurityToken httpsSecurityToken = new HttpsSecurityToken(true, "username", null);
-        httpsSecurityToken.addTokenUsage(SecurityToken.TokenUsage.MainSignature);
+        HttpsSecurityTokenImpl httpsSecurityToken = new HttpsSecurityTokenImpl(true, "username");
+        httpsSecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
         httpsTokenSecurityEvent.setSecurityToken(httpsSecurityToken);
         policyEnforcer.registerSecurityEvent(httpsTokenSecurityEvent);
 
@@ -158,8 +158,8 @@ public class TransportBindingTest extend
         policyEnforcer.registerSecurityEvent(requiredElementSecurityEvent);
 
         HttpsTokenSecurityEvent httpsTokenSecurityEvent = new HttpsTokenSecurityEvent();
-        HttpsSecurityToken httpsSecurityToken = new HttpsSecurityToken(true, "username", null);
-        httpsSecurityToken.addTokenUsage(SecurityToken.TokenUsage.MainSignature);
+        HttpsSecurityTokenImpl httpsSecurityToken = new HttpsSecurityTokenImpl(true, "username");
+        httpsSecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
         httpsTokenSecurityEvent.setSecurityToken(httpsSecurityToken);
         policyEnforcer.registerSecurityEvent(httpsTokenSecurityEvent);
 
@@ -205,8 +205,8 @@ public class TransportBindingTest extend
         policyEnforcer.registerSecurityEvent(requiredElementSecurityEvent);
 
         HttpsTokenSecurityEvent httpsTokenSecurityEvent = new HttpsTokenSecurityEvent();
-        HttpsSecurityToken httpsSecurityToken = new HttpsSecurityToken(true, "username", null);
-        httpsSecurityToken.addTokenUsage(SecurityToken.TokenUsage.MainSignature);
+        HttpsSecurityTokenImpl httpsSecurityToken = new HttpsSecurityTokenImpl(true, "username");
+        httpsSecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
         httpsTokenSecurityEvent.setSecurityToken(httpsSecurityToken);
         policyEnforcer.registerSecurityEvent(httpsTokenSecurityEvent);
 

Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/UsernameTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/UsernameTokenTest.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/UsernameTokenTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/UsernameTokenTest.java Mon Apr  1 13:57:32 2013
@@ -22,13 +22,14 @@ 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.impl.securityToken.UsernameSecurityToken;
+import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
+import org.apache.wss4j.stax.impl.securityToken.UsernameSecurityTokenImpl;
 import org.apache.wss4j.stax.securityEvent.OperationSecurityEvent;
 import org.apache.wss4j.stax.securityEvent.SignedPartSecurityEvent;
 import org.apache.wss4j.stax.securityEvent.UsernameTokenSecurityEvent;
-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.securityToken.InboundSecurityToken;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
@@ -76,33 +77,37 @@ public class UsernameTokenTest extends A
 
         PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
         UsernameTokenSecurityEvent initiatorTokenSecurityEvent = new UsernameTokenSecurityEvent();
-        initiatorTokenSecurityEvent.setUsernameTokenPasswordType(WSSConstants.UsernameTokenPasswordType.PASSWORD_DIGEST);
         initiatorTokenSecurityEvent.setUsernameTokenProfile(WSSConstants.NS_USERNAMETOKEN_PROFILE11);
-        SecurityToken securityToken = new UsernameSecurityToken(
-                "username", "password", new Date().toString(), new byte[10], new byte[10], 10L,
+        UsernameSecurityTokenImpl securityToken = new UsernameSecurityTokenImpl(
+                WSSConstants.UsernameTokenPasswordType.PASSWORD_DIGEST,
+                "username", "password", new Date().toString(), null, new byte[10], 10L,
                 null, null, null);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.MainSignature);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
         initiatorTokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(initiatorTokenSecurityEvent);
 
         UsernameTokenSecurityEvent recipientTokenSecurityEvent = new UsernameTokenSecurityEvent();
-        recipientTokenSecurityEvent.setUsernameTokenPasswordType(WSSConstants.UsernameTokenPasswordType.PASSWORD_DIGEST);
         recipientTokenSecurityEvent.setUsernameTokenProfile(WSSConstants.NS_USERNAMETOKEN_PROFILE11);
-        securityToken = new UsernameSecurityToken(
-                "username", "password", new Date().toString(), new byte[10], new byte[10], 10L,
+        securityToken = new UsernameSecurityTokenImpl(
+                WSSConstants.UsernameTokenPasswordType.PASSWORD_DIGEST,
+                "username", "password", new Date().toString(), null, new byte[10], 10L,
                 null, null, null);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.MainEncryption);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainEncryption);
         recipientTokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(recipientTokenSecurityEvent);
 
         List<XMLSecurityConstants.ContentType> protectionOrder = new LinkedList<XMLSecurityConstants.ContentType>();
         protectionOrder.add(XMLSecurityConstants.ContentType.SIGNATURE);
         protectionOrder.add(XMLSecurityConstants.ContentType.ENCRYPTION);
-        SignedPartSecurityEvent signedPartSecurityEvent = new SignedPartSecurityEvent(recipientTokenSecurityEvent.getSecurityToken(), true, protectionOrder);
+        SignedPartSecurityEvent signedPartSecurityEvent =
+                new SignedPartSecurityEvent(
+                        (InboundSecurityToken)recipientTokenSecurityEvent.getSecurityToken(), true, protectionOrder);
         signedPartSecurityEvent.setElementPath(WSSConstants.SOAP_11_BODY_PATH);
         policyEnforcer.registerSecurityEvent(signedPartSecurityEvent);
 
-        ContentEncryptedElementSecurityEvent contentEncryptedElementSecurityEvent = new ContentEncryptedElementSecurityEvent(recipientTokenSecurityEvent.getSecurityToken(), true, protectionOrder);
+        ContentEncryptedElementSecurityEvent contentEncryptedElementSecurityEvent =
+                new ContentEncryptedElementSecurityEvent(
+                        (InboundSecurityToken)recipientTokenSecurityEvent.getSecurityToken(), true, protectionOrder);
         contentEncryptedElementSecurityEvent.setElementPath(WSSConstants.SOAP_11_BODY_PATH);
         policyEnforcer.registerSecurityEvent(contentEncryptedElementSecurityEvent);
 
@@ -150,33 +155,37 @@ public class UsernameTokenTest extends A
 
         PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
         UsernameTokenSecurityEvent usernameTokenSecurityEvent = new UsernameTokenSecurityEvent();
-        usernameTokenSecurityEvent.setUsernameTokenPasswordType(WSSConstants.UsernameTokenPasswordType.PASSWORD_TEXT);
         usernameTokenSecurityEvent.setUsernameTokenProfile(WSSConstants.NS_USERNAMETOKEN_PROFILE11);
-        SecurityToken securityToken = new UsernameSecurityToken(
-                "username", "password", new Date().toString(), new byte[10], new byte[10], 10L,
+        UsernameSecurityTokenImpl securityToken = new UsernameSecurityTokenImpl(
+                WSSConstants.UsernameTokenPasswordType.PASSWORD_TEXT,
+                "username", "password", new Date().toString(), null, new byte[10], 10L,
                 null, null, null);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.MainSignature);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
         usernameTokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(usernameTokenSecurityEvent);
 
         UsernameTokenSecurityEvent recipientTokenSecurityEvent = new UsernameTokenSecurityEvent();
-        recipientTokenSecurityEvent.setUsernameTokenPasswordType(WSSConstants.UsernameTokenPasswordType.PASSWORD_TEXT);
         recipientTokenSecurityEvent.setUsernameTokenProfile(WSSConstants.NS_USERNAMETOKEN_PROFILE11);
-        securityToken = new UsernameSecurityToken(
-                "username", "password", new Date().toString(), new byte[10], new byte[10], 10L,
+        securityToken = new UsernameSecurityTokenImpl(
+                WSSConstants.UsernameTokenPasswordType.PASSWORD_TEXT,
+                "username", "password", new Date().toString(), null, new byte[10], 10L,
                 null, null, null);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.MainEncryption);
+        securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainEncryption);
         recipientTokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(recipientTokenSecurityEvent);
 
         List<XMLSecurityConstants.ContentType> protectionOrder = new LinkedList<XMLSecurityConstants.ContentType>();
         protectionOrder.add(XMLSecurityConstants.ContentType.SIGNATURE);
         protectionOrder.add(XMLSecurityConstants.ContentType.ENCRYPTION);
-        SignedPartSecurityEvent signedPartSecurityEvent = new SignedPartSecurityEvent(recipientTokenSecurityEvent.getSecurityToken(), true, protectionOrder);
+        SignedPartSecurityEvent signedPartSecurityEvent =
+                new SignedPartSecurityEvent(
+                        (InboundSecurityToken)recipientTokenSecurityEvent.getSecurityToken(), true, protectionOrder);
         signedPartSecurityEvent.setElementPath(WSSConstants.SOAP_11_BODY_PATH);
         policyEnforcer.registerSecurityEvent(signedPartSecurityEvent);
 
-        ContentEncryptedElementSecurityEvent contentEncryptedElementSecurityEvent = new ContentEncryptedElementSecurityEvent(recipientTokenSecurityEvent.getSecurityToken(), true, protectionOrder);
+        ContentEncryptedElementSecurityEvent contentEncryptedElementSecurityEvent =
+                new ContentEncryptedElementSecurityEvent(
+                        (InboundSecurityToken)recipientTokenSecurityEvent.getSecurityToken(), true, protectionOrder);
         contentEncryptedElementSecurityEvent.setElementPath(WSSConstants.SOAP_11_BODY_PATH);
         policyEnforcer.registerSecurityEvent(contentEncryptedElementSecurityEvent);
 

Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/X509TokenTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/X509TokenTest.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/X509TokenTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/X509TokenTest.java Mon Apr  1 13:57:32 2013
@@ -21,12 +21,14 @@ 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.stax.ext.WSSConstants;
+import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
+import org.apache.wss4j.stax.impl.securityToken.X509SecurityTokenImpl;
 import org.apache.wss4j.stax.securityEvent.OperationSecurityEvent;
 import org.apache.wss4j.stax.securityEvent.SignedPartSecurityEvent;
-import org.apache.xml.security.stax.ext.SecurityToken;
+import org.apache.wss4j.stax.securityEvent.X509TokenSecurityEvent;
 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;
 
@@ -73,25 +75,29 @@ public class X509TokenTest extends Abstr
 
         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);
         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);
 
@@ -139,25 +145,29 @@ public class X509TokenTest extends Abstr
 
         PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
         X509TokenSecurityEvent initiatorX509TokenSecurityEvent = new X509TokenSecurityEvent();
-        SecurityToken securityToken = getX509Token(WSSConstants.X509V1Token);
-        securityToken.addTokenUsage(SecurityToken.TokenUsage.MainSignature);
+        X509SecurityTokenImpl securityToken = getX509Token(WSSecurityTokenConstants.X509V1Token);
+        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);
         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);
 

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/WSSec.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/WSSec.java?rev=1463136&r1=1463135&r2=1463136&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/WSSec.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/WSSec.java Mon Apr  1 13:57:32 2013
@@ -30,6 +30,7 @@ import org.apache.wss4j.stax.ext.Outboun
 import org.apache.wss4j.stax.ext.WSSConfigurationException;
 import org.apache.wss4j.stax.ext.WSSConstants;
 import org.apache.wss4j.stax.ext.WSSSecurityProperties;
+import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
 import org.apache.xml.security.exceptions.XMLSecurityException;
 import org.apache.xml.security.stax.config.Init;
 import org.apache.xml.security.stax.ext.SecurePart;
@@ -119,11 +120,11 @@ public class WSSec {
 
         for (int i = 0; i < securityProperties.getOutAction().length; i++) {
             XMLSecurityConstants.Action action = securityProperties.getOutAction()[i];
-            if (action.equals(WSSConstants.TIMESTAMP)) {
+            if (WSSConstants.TIMESTAMP.equals(action)) {
                 if (securityProperties.getTimestampTTL() == null) {
                     securityProperties.setTimestampTTL(300);
                 }
-            } else if (action.equals(WSSConstants.SIGNATURE)) {
+            } else if (WSSConstants.SIGNATURE.equals(action)) {
                 if (securityProperties.getSignatureKeyStore() == null) {
                     throw new WSSConfigurationException(WSSConfigurationException.ErrorCode.FAILURE, "signatureKeyStoreNotSet");
                 }
@@ -142,10 +143,10 @@ public class WSSec {
                 if (securityProperties.getSignatureCanonicalizationAlgorithm() == null) {
                     securityProperties.setSignatureCanonicalizationAlgorithm("http://www.w3.org/2001/10/xml-exc-c14n#");
                 }
-                if (securityProperties.getSignatureKeyIdentifierType() == null) {
-                    securityProperties.setSignatureKeyIdentifierType(WSSConstants.WSSKeyIdentifierType.ISSUER_SERIAL);
+                if (securityProperties.getSignatureKeyIdentifier() == null) {
+                    securityProperties.setSignatureKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_IssuerSerial);
                 }
-            } else if (action.equals(WSSConstants.ENCRYPT)) {
+            } else if (WSSConstants.ENCRYPT.equals(action)) {
                 if (securityProperties.getEncryptionUseThisCertificate() == null
                         && securityProperties.getEncryptionKeyStore() == null
                         && !securityProperties.isUseReqSigCertForEncryption()) {
@@ -165,10 +166,10 @@ public class WSSec {
                     //@see http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/Overview.html#rsa-oaep-mgf1p
                     securityProperties.setEncryptionKeyTransportAlgorithm("http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p");
                 }
-                if (securityProperties.getEncryptionKeyIdentifierType() == null) {
-                    securityProperties.setEncryptionKeyIdentifierType(WSSConstants.WSSKeyIdentifierType.ISSUER_SERIAL);
+                if (securityProperties.getEncryptionKeyIdentifier() == null) {
+                    securityProperties.setEncryptionKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_IssuerSerial);
                 }
-            } else if (action.equals(WSSConstants.USERNAMETOKEN)) {
+            } else if (WSSConstants.USERNAMETOKEN.equals(action)) {
                 if (securityProperties.getTokenUser() == null) {
                     throw new WSSConfigurationException(WSSConfigurationException.ErrorCode.FAILURE, "noTokenUser");
                 }
@@ -178,7 +179,7 @@ public class WSSec {
                 if (securityProperties.getUsernameTokenPasswordType() == null) {
                     securityProperties.setUsernameTokenPasswordType(WSSConstants.UsernameTokenPasswordType.PASSWORD_DIGEST);
                 }
-            } else if (action.equals(WSSConstants.USERNAMETOKEN_SIGNED)) {
+            } else if (WSSConstants.USERNAMETOKEN_SIGNED.equals(action)) {
                 if (securityProperties.getTokenUser() == null) {
                     throw new WSSConfigurationException(WSSConfigurationException.ErrorCode.FAILURE, "noTokenUser");
                 }
@@ -194,13 +195,13 @@ public class WSSec {
                 if (securityProperties.getSignatureCanonicalizationAlgorithm() == null) {
                     securityProperties.setSignatureCanonicalizationAlgorithm("http://www.w3.org/2001/10/xml-exc-c14n#");
                 }
-                securityProperties.setSignatureKeyIdentifierType(WSSConstants.WSSKeyIdentifierType.USERNAMETOKEN_REFERENCE);
+                securityProperties.setSignatureKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_UsernameTokenReference);
                 if (securityProperties.getUsernameTokenPasswordType() == null) {
                     securityProperties.setUsernameTokenPasswordType(WSSConstants.UsernameTokenPasswordType.PASSWORD_DIGEST);
                 }
-            } else if (action.equals(WSSConstants.SIGNATURE_CONFIRMATION)) {
+            } else if (WSSConstants.SIGNATURE_CONFIRMATION.equals(action)) {
                 securityProperties.addSignaturePart(new SecurePart(WSSConstants.TAG_wsse11_SignatureConfirmation, SecurePart.Modifier.Element));
-            } else if (action.equals(WSSConstants.SIGNATURE_WITH_DERIVED_KEY)) {
+            } else if (WSSConstants.SIGNATURE_WITH_DERIVED_KEY.equals(action)) {
                 if (securityProperties.getCallbackHandler() == null) {
                     throw new WSSConfigurationException(WSSConfigurationException.ErrorCode.FAILURE, "noCallback");
                 }
@@ -213,7 +214,7 @@ public class WSSec {
                 if (securityProperties.getSignatureCanonicalizationAlgorithm() == null) {
                     securityProperties.setSignatureCanonicalizationAlgorithm("http://www.w3.org/2001/10/xml-exc-c14n#");
                 }
-                securityProperties.setSignatureKeyIdentifierType(WSSConstants.WSSKeyIdentifierType.SECURITY_TOKEN_DIRECT_REFERENCE);
+                securityProperties.setSignatureKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
                 if (securityProperties.getEncryptionSymAlgorithm() == null) {
                     securityProperties.setEncryptionSymAlgorithm("http://www.w3.org/2001/04/xmlenc#aes256-cbc");
                 }
@@ -223,19 +224,19 @@ public class WSSec {
                     //@see http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/Overview.html#rsa-oaep-mgf1p
                     securityProperties.setEncryptionKeyTransportAlgorithm("http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p");
                 }
-                if (securityProperties.getEncryptionKeyIdentifierType() == null) {
-                    securityProperties.setEncryptionKeyIdentifierType(WSSConstants.WSSKeyIdentifierType.X509_KEY_IDENTIFIER);
+                if (securityProperties.getEncryptionKeyIdentifier() == null) {
+                    securityProperties.setEncryptionKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_X509KeyIdentifier);
                 }
-                if (securityProperties.getDerivedKeyKeyIdentifierType() == null) {
-                    securityProperties.setDerivedKeyKeyIdentifierType(WSSConstants.WSSKeyIdentifierType.X509_KEY_IDENTIFIER);
+                if (securityProperties.getDerivedKeyKeyIdentifier() == null) {
+                    securityProperties.setDerivedKeyKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_X509KeyIdentifier);
                 }
                 if (securityProperties.getDerivedKeyTokenReference() == null) {
                     securityProperties.setDerivedKeyTokenReference(WSSConstants.DerivedKeyTokenReference.DirectReference);
                 }
                 if (securityProperties.getDerivedKeyTokenReference() != WSSConstants.DerivedKeyTokenReference.DirectReference) {
-                    securityProperties.setDerivedKeyKeyIdentifierType(WSSConstants.WSSKeyIdentifierType.SECURITY_TOKEN_DIRECT_REFERENCE);
+                    securityProperties.setDerivedKeyKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
                 }
-            } else if (action.equals(WSSConstants.ENCRYPT_WITH_DERIVED_KEY)) {
+            } else if (WSSConstants.ENCRYPT_WITH_DERIVED_KEY.equals(action)) {
                 if (securityProperties.getCallbackHandler() == null) {
                     throw new WSSConfigurationException(WSSConfigurationException.ErrorCode.FAILURE, "noCallback");
                 }
@@ -258,19 +259,19 @@ public class WSSec {
                     //@see http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/Overview.html#rsa-oaep-mgf1p
                     securityProperties.setEncryptionKeyTransportAlgorithm("http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p");
                 }
-                if (securityProperties.getEncryptionKeyIdentifierType() == null) {
-                    securityProperties.setEncryptionKeyIdentifierType(WSSConstants.WSSKeyIdentifierType.X509_KEY_IDENTIFIER);
+                if (securityProperties.getEncryptionKeyIdentifier() == null) {
+                    securityProperties.setEncryptionKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_X509KeyIdentifier);
                 }
-                if (securityProperties.getDerivedKeyKeyIdentifierType() == null) {
-                    securityProperties.setDerivedKeyKeyIdentifierType(WSSConstants.WSSKeyIdentifierType.X509_KEY_IDENTIFIER);
+                if (securityProperties.getDerivedKeyKeyIdentifier() == null) {
+                    securityProperties.setDerivedKeyKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_X509KeyIdentifier);
                 }
                 if (securityProperties.getDerivedKeyTokenReference() == null) {
                     securityProperties.setDerivedKeyTokenReference(WSSConstants.DerivedKeyTokenReference.EncryptedKey);
                 }
                 if (securityProperties.getDerivedKeyTokenReference() != WSSConstants.DerivedKeyTokenReference.DirectReference) {
-                    securityProperties.setDerivedKeyKeyIdentifierType(WSSConstants.WSSKeyIdentifierType.SECURITY_TOKEN_DIRECT_REFERENCE);
+                    securityProperties.setDerivedKeyKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
                 }
-            } else if (action.equals(WSSConstants.SAML_TOKEN_SIGNED)) {
+            } else if (WSSConstants.SAML_TOKEN_SIGNED.equals(action)) {
                 if (securityProperties.getCallbackHandler() == null) {
                     throw new WSSConfigurationException(WSSConfigurationException.ErrorCode.FAILURE, "noCallback");
                 }
@@ -283,13 +284,13 @@ public class WSSec {
                 if (securityProperties.getSignatureCanonicalizationAlgorithm() == null) {
                     securityProperties.setSignatureCanonicalizationAlgorithm("http://www.w3.org/2001/10/xml-exc-c14n#");
                 }
-                if (securityProperties.getSignatureKeyIdentifierType() == null) {
-                    securityProperties.setSignatureKeyIdentifierType(WSSConstants.WSSKeyIdentifierType.SECURITY_TOKEN_DIRECT_REFERENCE);
+                if (securityProperties.getSignatureKeyIdentifier() == null) {
+                    securityProperties.setSignatureKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
                 }
-            } else if (action.equals(WSSConstants.SAML_TOKEN_UNSIGNED) && 
+            } else if (WSSConstants.SAML_TOKEN_UNSIGNED.equals(action) &&
                     (securityProperties.getCallbackHandler() == null)) {
                 throw new WSSConfigurationException(WSSConfigurationException.ErrorCode.FAILURE, "noCallback");
-            } else if (action.equals(WSSConstants.SIGNATURE_WITH_KERBEROS_TOKEN)) {
+            } else if (WSSConstants.SIGNATURE_WITH_KERBEROS_TOKEN.equals(action)) {
                 if (securityProperties.getCallbackHandler() == null) {
                     throw new WSSConfigurationException(WSSConfigurationException.ErrorCode.FAILURE, "noCallback");
                 }
@@ -302,18 +303,18 @@ public class WSSec {
                 if (securityProperties.getSignatureCanonicalizationAlgorithm() == null) {
                     securityProperties.setSignatureCanonicalizationAlgorithm("http://www.w3.org/2001/10/xml-exc-c14n#");
                 }
-                if (securityProperties.getSignatureKeyIdentifierType() == null) {
-                    securityProperties.setSignatureKeyIdentifierType(WSSConstants.WSSKeyIdentifierType.SECURITY_TOKEN_DIRECT_REFERENCE);
+                if (securityProperties.getSignatureKeyIdentifier() == null) {
+                    securityProperties.setSignatureKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
                 }
-            } else if (action.equals(WSSConstants.ENCRYPT_WITH_KERBEROS_TOKEN)) {
+            } else if (WSSConstants.ENCRYPT_WITH_KERBEROS_TOKEN.equals(action)) {
                 if (securityProperties.getCallbackHandler() == null) {
                     throw new WSSConfigurationException(WSSConfigurationException.ErrorCode.FAILURE, "noCallback");
                 }
                 if (securityProperties.getEncryptionSymAlgorithm() == null) {
                     securityProperties.setEncryptionSymAlgorithm("http://www.w3.org/2001/04/xmlenc#aes256-cbc");
                 }
-                if (securityProperties.getSignatureKeyIdentifierType() == null) {
-                    securityProperties.setSignatureKeyIdentifierType(WSSConstants.WSSKeyIdentifierType.SECURITY_TOKEN_DIRECT_REFERENCE);
+                if (securityProperties.getSignatureKeyIdentifier() == null) {
+                    securityProperties.setSignatureKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
                 }
             }
         }

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/InboundWSSec.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/InboundWSSec.java?rev=1463136&r1=1463135&r2=1463136&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/InboundWSSec.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/InboundWSSec.java Mon Apr  1 13:57:32 2013
@@ -27,8 +27,6 @@ import org.apache.wss4j.stax.impl.proces
 import org.apache.wss4j.stax.securityEvent.WSSecurityEventConstants;
 import org.apache.xml.security.exceptions.XMLSecurityException;
 import org.apache.xml.security.stax.ext.InputProcessor;
-import org.apache.xml.security.stax.ext.SecurityToken;
-import org.apache.xml.security.stax.ext.SecurityTokenProvider;
 import org.apache.xml.security.stax.impl.DocumentContextImpl;
 import org.apache.xml.security.stax.impl.InputProcessorChainImpl;
 import org.apache.xml.security.stax.impl.processor.input.LogInputProcessor;
@@ -37,6 +35,8 @@ import org.apache.xml.security.stax.impl
 import org.apache.xml.security.stax.securityEvent.SecurityEvent;
 import org.apache.xml.security.stax.securityEvent.SecurityEventListener;
 import org.apache.xml.security.stax.securityEvent.TokenSecurityEvent;
+import org.apache.xml.security.stax.securityToken.InboundSecurityToken;
+import org.apache.xml.security.stax.securityToken.SecurityTokenProvider;
 
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamException;
@@ -134,20 +134,22 @@ public class InboundWSSec {
                 while (securityEventIterator.hasNext()) {
                     SecurityEvent securityEvent = securityEventIterator.next();
                     if (securityEvent instanceof TokenSecurityEvent) {
-                        final TokenSecurityEvent tokenSecurityEvent = (TokenSecurityEvent)securityEvent;
+                        @SuppressWarnings("unchecked")
+                        final TokenSecurityEvent<? extends InboundSecurityToken> tokenSecurityEvent =
+                                (TokenSecurityEvent)securityEvent;
 
-                        if (securityEvent.getSecurityEventType() == WSSecurityEventConstants.HttpsToken) {
+                        if (WSSecurityEventConstants.HttpsToken.equals(securityEvent.getSecurityEventType())) {
                             securityContextImpl.registerSecurityEvent(securityEvent);
                             securityContextImpl.put(WSSConstants.TRANSPORT_SECURITY_ACTIVE, Boolean.TRUE);
                         }
 
-                        SecurityTokenProvider securityTokenProvider = new SecurityTokenProvider() {
+                        SecurityTokenProvider<InboundSecurityToken> securityTokenProvider =
+                                new SecurityTokenProvider<InboundSecurityToken>() {
 
                             private String id;
 
-                            @SuppressWarnings("unchecked")
                             @Override
-                            public SecurityToken getSecurityToken() throws XMLSecurityException {
+                            public InboundSecurityToken getSecurityToken() throws XMLSecurityException {
                                 return tokenSecurityEvent.getSecurityToken();
                             }
 

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/OutboundWSSec.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/OutboundWSSec.java?rev=1463136&r1=1463135&r2=1463136&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/OutboundWSSec.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/OutboundWSSec.java Mon Apr  1 13:57:32 2013
@@ -19,12 +19,12 @@
 package org.apache.wss4j.stax.ext;
 
 import org.apache.wss4j.common.ext.WSSecurityException;
-import org.apache.wss4j.stax.impl.WSSecurityContextImpl;
 import org.apache.wss4j.stax.impl.processor.output.*;
 import org.apache.xml.security.exceptions.XMLSecurityException;
 import org.apache.xml.security.stax.ext.OutputProcessor;
 import org.apache.xml.security.stax.ext.XMLSecurityConstants;
 import org.apache.xml.security.stax.impl.DocumentContextImpl;
+import org.apache.xml.security.stax.impl.OutboundSecurityContextImpl;
 import org.apache.xml.security.stax.impl.OutputProcessorChainImpl;
 import org.apache.xml.security.stax.impl.XMLSecurityStreamWriter;
 import org.apache.xml.security.stax.impl.processor.output.FinalOutputProcessor;
@@ -106,13 +106,13 @@ public class OutboundWSSec {
     private XMLStreamWriter processOutMessage(
             Object output, String encoding, List<SecurityEvent> requestSecurityEvents,
             SecurityEventListener securityEventListener) throws WSSecurityException {
-        final WSSecurityContextImpl securityContextImpl = new WSSecurityContextImpl();
-        securityContextImpl.putList(SecurityEvent.class, requestSecurityEvents);
-        securityContextImpl.addSecurityEventListener(securityEventListener);
+        final OutboundSecurityContextImpl outboundSecurityContext = new OutboundSecurityContextImpl();
+        outboundSecurityContext.putList(SecurityEvent.class, requestSecurityEvents);
+        outboundSecurityContext.addSecurityEventListener(securityEventListener);
         final DocumentContextImpl documentContext = new DocumentContextImpl();
         documentContext.setEncoding(encoding);
 
-        OutputProcessorChainImpl outputProcessorChain = new OutputProcessorChainImpl(securityContextImpl, documentContext);
+        OutputProcessorChainImpl outputProcessorChain = new OutputProcessorChainImpl(outboundSecurityContext, documentContext);
 
         try {
             final SecurityHeaderOutputProcessor securityHeaderOutputProcessor = new SecurityHeaderOutputProcessor();
@@ -121,11 +121,11 @@ public class OutboundWSSec {
             //todo they use the same signaure parts
             for (int i = 0; i < securityProperties.getOutAction().length; i++) {
                 XMLSecurityConstants.Action action = securityProperties.getOutAction()[i];
-                if (action.equals(WSSConstants.TIMESTAMP)) {
+                if (WSSConstants.TIMESTAMP.equals(action)) {
                     final TimestampOutputProcessor timestampOutputProcessor = new TimestampOutputProcessor();
                     initializeOutputProcessor(outputProcessorChain, timestampOutputProcessor, action);
 
-                } else if (action.equals(WSSConstants.SIGNATURE)) {
+                } else if (WSSConstants.SIGNATURE.equals(action)) {
                     final BinarySecurityTokenOutputProcessor binarySecurityTokenOutputProcessor =
                             new BinarySecurityTokenOutputProcessor();
                     initializeOutputProcessor(outputProcessorChain, binarySecurityTokenOutputProcessor, action);
@@ -133,7 +133,7 @@ public class OutboundWSSec {
                     final WSSSignatureOutputProcessor signatureOutputProcessor = new WSSSignatureOutputProcessor();
                     initializeOutputProcessor(outputProcessorChain, signatureOutputProcessor, action);
 
-                } else if (action.equals(WSSConstants.ENCRYPT)) {
+                } else if (WSSConstants.ENCRYPT.equals(action)) {
                     final BinarySecurityTokenOutputProcessor binarySecurityTokenOutputProcessor =
                             new BinarySecurityTokenOutputProcessor();
                     initializeOutputProcessor(outputProcessorChain, binarySecurityTokenOutputProcessor, action);
@@ -144,23 +144,23 @@ public class OutboundWSSec {
                     final EncryptOutputProcessor encryptOutputProcessor = new EncryptOutputProcessor();
                     initializeOutputProcessor(outputProcessorChain, encryptOutputProcessor, action);
 
-                } else if (action.equals(WSSConstants.USERNAMETOKEN)) {
+                } else if (WSSConstants.USERNAMETOKEN.equals(action)) {
                     final UsernameTokenOutputProcessor usernameTokenOutputProcessor = new UsernameTokenOutputProcessor();
                     initializeOutputProcessor(outputProcessorChain, usernameTokenOutputProcessor, action);
 
-                } else if (action.equals(WSSConstants.USERNAMETOKEN_SIGNED)) {
+                } else if (WSSConstants.USERNAMETOKEN_SIGNED.equals(action)) {
                     final UsernameTokenOutputProcessor usernameTokenOutputProcessor = new UsernameTokenOutputProcessor();
                     initializeOutputProcessor(outputProcessorChain, usernameTokenOutputProcessor, action);
 
                     final WSSSignatureOutputProcessor signatureOutputProcessor = new WSSSignatureOutputProcessor();
                     initializeOutputProcessor(outputProcessorChain, signatureOutputProcessor, action);
 
-                } else if (action.equals(WSSConstants.SIGNATURE_CONFIRMATION)) {
+                } else if (WSSConstants.SIGNATURE_CONFIRMATION.equals(action)) {
                     final SignatureConfirmationOutputProcessor signatureConfirmationOutputProcessor =
                             new SignatureConfirmationOutputProcessor();
                     initializeOutputProcessor(outputProcessorChain, signatureConfirmationOutputProcessor, action);
 
-                } else if (action.equals(WSSConstants.SIGNATURE_WITH_DERIVED_KEY)) {
+                } else if (WSSConstants.SIGNATURE_WITH_DERIVED_KEY.equals(action)) {
                     final BinarySecurityTokenOutputProcessor binarySecurityTokenOutputProcessor =
                             new BinarySecurityTokenOutputProcessor();
                     initializeOutputProcessor(outputProcessorChain, binarySecurityTokenOutputProcessor, action);
@@ -181,7 +181,7 @@ public class OutboundWSSec {
                     final WSSSignatureOutputProcessor signatureOutputProcessor = new WSSSignatureOutputProcessor();
                     initializeOutputProcessor(outputProcessorChain, signatureOutputProcessor, action);
 
-                } else if (action.equals(WSSConstants.ENCRYPT_WITH_DERIVED_KEY)) {
+                } else if (WSSConstants.ENCRYPT_WITH_DERIVED_KEY.equals(action)) {
                     final BinarySecurityTokenOutputProcessor binarySecurityTokenOutputProcessor =
                             new BinarySecurityTokenOutputProcessor();
                     initializeOutputProcessor(outputProcessorChain, binarySecurityTokenOutputProcessor, action);
@@ -202,24 +202,24 @@ public class OutboundWSSec {
                     final EncryptOutputProcessor encryptOutputProcessor = new EncryptOutputProcessor();
                     initializeOutputProcessor(outputProcessorChain, encryptOutputProcessor, action);
 
-                } else if (action.equals(WSSConstants.SAML_TOKEN_SIGNED)) {
+                } else if (WSSConstants.SAML_TOKEN_SIGNED.equals(action)) {
                     final SAMLTokenOutputProcessor samlTokenOutputProcessor = new SAMLTokenOutputProcessor();
                     initializeOutputProcessor(outputProcessorChain, samlTokenOutputProcessor, action);
 
                     final WSSSignatureOutputProcessor signatureOutputProcessor = new WSSSignatureOutputProcessor();
                     initializeOutputProcessor(outputProcessorChain, signatureOutputProcessor, action);
 
-                } else if (action.equals(WSSConstants.SAML_TOKEN_UNSIGNED)) {
+                } else if (WSSConstants.SAML_TOKEN_UNSIGNED.equals(action)) {
                     final SAMLTokenOutputProcessor samlTokenOutputProcessor = new SAMLTokenOutputProcessor();
                     initializeOutputProcessor(outputProcessorChain, samlTokenOutputProcessor, action);
-                } else if (action.equals(WSSConstants.SIGNATURE_WITH_KERBEROS_TOKEN)) {
+                } else if (WSSConstants.SIGNATURE_WITH_KERBEROS_TOKEN.equals(action)) {
                     final KerberosSecurityTokenOutputProcessor kerberosTokenOutputProcessor =
                             new KerberosSecurityTokenOutputProcessor();
                     initializeOutputProcessor(outputProcessorChain, kerberosTokenOutputProcessor, action);
 
                     final WSSSignatureOutputProcessor signatureOutputProcessor = new WSSSignatureOutputProcessor();
                     initializeOutputProcessor(outputProcessorChain, signatureOutputProcessor, action);
-                } else if (action.equals(WSSConstants.ENCRYPT_WITH_KERBEROS_TOKEN)) {
+                } else if (WSSConstants.ENCRYPT_WITH_KERBEROS_TOKEN.equals(action)) {
                     final KerberosSecurityTokenOutputProcessor kerberosTokenOutputProcessor =
                             new KerberosSecurityTokenOutputProcessor();
                     initializeOutputProcessor(outputProcessorChain, kerberosTokenOutputProcessor, action);

Copied: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/WSInboundSecurityContext.java (from r1460765, webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/WSSecurityContext.java)
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/WSInboundSecurityContext.java?p2=webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/WSInboundSecurityContext.java&p1=webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/WSSecurityContext.java&r1=1460765&r2=1463136&rev=1463136&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/WSSecurityContext.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/WSInboundSecurityContext.java Mon Apr  1 13:57:32 2013
@@ -20,14 +20,14 @@ package org.apache.wss4j.stax.ext;
 
 import org.apache.wss4j.common.bsp.BSPRule;
 import org.apache.wss4j.common.ext.WSSecurityException;
-import org.apache.xml.security.stax.ext.SecurityContext;
+import org.apache.xml.security.stax.ext.InboundSecurityContext;
 
 import java.util.List;
 
 /**
  * The document security context
  */
-public interface WSSecurityContext extends SecurityContext {
+public interface WSInboundSecurityContext extends InboundSecurityContext {
 
     public void handleBSPRule(BSPRule bspRule) throws WSSecurityException;
 

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/WSSConstants.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/WSSConstants.java?rev=1463136&r1=1463135&r2=1463136&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/WSSConstants.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/WSSConstants.java Mon Apr  1 13:57:32 2013
@@ -272,8 +272,6 @@ public class WSSConstants extends XMLSec
     public static final int WSE_DERIVED_KEY_LEN = 16;
     public static final String LABEL_FOR_DERIVED_KEY = "WS-Security";
 
-    public static final Action SIGNATURE = new Action(XMLSecurityConstants.SIGNATURE.toString());
-    public static final Action ENCRYPT = new Action(XMLSecurityConstants.ENCRYPT.toString());
     public static final Action TIMESTAMP = new Action("TIMESTAMP");
     public static final Action USERNAMETOKEN = new Action("USERNAMETOKEN");
     public static final Action USERNAMETOKEN_SIGNED = new Action("USERNAMETOKEN_SIGNED");
@@ -285,45 +283,12 @@ public class WSSConstants extends XMLSec
     public static final Action SIGNATURE_WITH_KERBEROS_TOKEN = new Action("SIGNATURE_WITH_KERBEROS_TOKEN");
     public static final Action ENCRYPT_WITH_KERBEROS_TOKEN = new Action("ENCRYPT_WITH_KERBEROS_TOKEN");
 
-    public static class Action extends XMLSecurityConstants.Action {
-        protected Action(String name) {
-            super(name);
-        }
-    }
-
-    //todo rename KeyUsage because C14N, etc are not keys...
-    public static final KeyUsage Comp_Key = new KeyUsage("Comp_Key");
-    public static final KeyUsage Enc_KD = new KeyUsage("Enc_KD");
-    public static final KeyUsage Sig_KD = new KeyUsage("Sig_KD");
-    public static final KeyUsage Soap_Norm = new KeyUsage("Soap_Norm");
-    public static final KeyUsage STR_Trans = new KeyUsage("STR_Trans");
-    public static final KeyUsage XPath = new KeyUsage("XPath");
-
-    public static final TokenType UsernameToken = new TokenType("UsernameToken");
-    public static final TokenType SecurityContextToken = new TokenType("SecurityContextToken");
-    public static final TokenType Saml10Token = new TokenType("Saml10Token");
-    public static final TokenType Saml11Token = new TokenType("Saml11Token");
-    public static final TokenType Saml20Token = new TokenType("Saml20Token");
-    public static final TokenType IssuedToken = new TokenType("IssuedToken");
-    public static final TokenType SecureConversationToken = new TokenType("SecureConversationToken");
-    public static final TokenType HttpsToken = new TokenType("HttpsToken");
-    public static final TokenType KerberosToken = new TokenType("KerberosToken");
-    public static final TokenType SpnegoContextToken = new TokenType("SpnegoContextToken");
-    public static final TokenType RelToken = new TokenType("RelToken");
-    public static final TokenType DerivedKeyToken = new TokenType("DerivedKeyToken");
-
-    //todo correct/cleanup/rename/revisit KeyIdentifierTypes over the whole framework. I messed it up...
-    public enum WSSKeyIdentifierType implements KeyIdentifierType {
-        ISSUER_SERIAL,
-        SECURITY_TOKEN_DIRECT_REFERENCE,
-        X509_KEY_IDENTIFIER,
-        SKI_KEY_IDENTIFIER,
-        THUMBPRINT_IDENTIFIER,
-        EMBEDDED_KEYIDENTIFIER_REF,
-        USERNAMETOKEN_REFERENCE,
-        KEY_VALUE,
-        SECURITY_TOKEN_REFERENCE,
-    }
+    public static final AlgorithmUsage Comp_Key = new AlgorithmUsage("Comp_Key");
+    public static final AlgorithmUsage Enc_KD = new AlgorithmUsage("Enc_KD");
+    public static final AlgorithmUsage Sig_KD = new AlgorithmUsage("Sig_KD");
+    public static final AlgorithmUsage Soap_Norm = new AlgorithmUsage("Soap_Norm");
+    public static final AlgorithmUsage STR_Trans = new AlgorithmUsage("STR_Trans");
+    public static final AlgorithmUsage XPath = new AlgorithmUsage("XPath");
 
     public enum DerivedKeyTokenReference {
         DirectReference,
@@ -372,5 +337,4 @@ public class WSSConstants extends XMLSec
         WSSE_SECURITY_HEADER_PATH.add(WSSConstants.TAG_wsse_Security);
 
     }
-
 }

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/WSSSecurityProperties.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/WSSSecurityProperties.java?rev=1463136&r1=1463135&r2=1463136&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/WSSSecurityProperties.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/WSSSecurityProperties.java Mon Apr  1 13:57:32 2013
@@ -29,6 +29,7 @@ import java.util.*;
 import org.apache.wss4j.common.bsp.BSPRule;
 import org.apache.wss4j.common.crypto.Crypto;
 import org.apache.wss4j.common.crypto.Merlin;
+import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
 import org.apache.wss4j.stax.validate.Validator;
 import org.apache.xml.security.stax.config.ConfigurationProperties;
 import org.apache.xml.security.stax.ext.XMLSecurityProperties;
@@ -66,7 +67,7 @@ public class WSSSecurityProperties exten
     private WSSConstants.UsernameTokenPasswordType usernameTokenPasswordType;
     private String tokenUser;
 
-    private WSSConstants.KeyIdentifierType derivedKeyKeyIdentifierType;
+    private WSSecurityTokenConstants.KeyIdentifier derivedKeyKeyIdentifier;
     private WSSConstants.DerivedKeyTokenReference derivedKeyTokenReference;
 
     private Class<? extends Merlin> signatureCryptoClass;
@@ -92,7 +93,7 @@ public class WSSSecurityProperties exten
     private Crypto cachedEncryptionCrypto;
     private KeyStore cachedEncryptionKeyStore;
     private String encryptionUser;
-    private WSSConstants.KeyIdentifierType encryptionKeyIdentifierType;
+    private WSSecurityTokenConstants.KeyIdentifier encryptionKeyIdentifier;
     private boolean useReqSigCertForEncryption = false;
     private String encryptionCompressionAlgorithm;
     private boolean enableRevocation = false;
@@ -118,7 +119,7 @@ public class WSSSecurityProperties exten
         this.usernameTokenPasswordType = wssSecurityProperties.usernameTokenPasswordType;
         this.allowUsernameTokenNoPassword = wssSecurityProperties.allowUsernameTokenNoPassword;
         this.tokenUser = wssSecurityProperties.tokenUser;
-        this.derivedKeyKeyIdentifierType = wssSecurityProperties.derivedKeyKeyIdentifierType;
+        this.derivedKeyKeyIdentifier = wssSecurityProperties.derivedKeyKeyIdentifier;
         this.derivedKeyTokenReference = wssSecurityProperties.derivedKeyTokenReference;
         this.signatureCryptoClass = wssSecurityProperties.signatureCryptoClass;
         this.cachedSignatureCrypto = wssSecurityProperties.cachedSignatureCrypto;
@@ -139,7 +140,7 @@ public class WSSSecurityProperties exten
         this.cachedEncryptionCrypto = wssSecurityProperties.cachedEncryptionCrypto;
         this.cachedEncryptionKeyStore = wssSecurityProperties.cachedEncryptionKeyStore;
         this.encryptionUser = wssSecurityProperties.encryptionUser;
-        this.encryptionKeyIdentifierType = wssSecurityProperties.encryptionKeyIdentifierType;
+        this.encryptionKeyIdentifier = wssSecurityProperties.encryptionKeyIdentifier;
         this.useReqSigCertForEncryption = wssSecurityProperties.useReqSigCertForEncryption;
         this.encryptionCompressionAlgorithm = wssSecurityProperties.encryptionCompressionAlgorithm;
         this.enableRevocation = wssSecurityProperties.enableRevocation;
@@ -170,17 +171,17 @@ public class WSSSecurityProperties exten
      *
      * @return The KeyIdentifierType
      */
-    public WSSConstants.KeyIdentifierType getEncryptionKeyIdentifierType() {
-        return encryptionKeyIdentifierType;
+    public WSSecurityTokenConstants.KeyIdentifier getEncryptionKeyIdentifier() {
+        return encryptionKeyIdentifier;
     }
 
     /**
      * Specifies the KeyIdentifierType to use in the secured document
      *
-     * @param encryptionKeyIdentifierType
+     * @param encryptionKeyIdentifier
      */
-    public void setEncryptionKeyIdentifierType(WSSConstants.KeyIdentifierType encryptionKeyIdentifierType) {
-        this.encryptionKeyIdentifierType = encryptionKeyIdentifierType;
+    public void setEncryptionKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier encryptionKeyIdentifier) {
+        this.encryptionKeyIdentifier = encryptionKeyIdentifier;
     }
 
     public Integer getTimestampTTL() {
@@ -256,12 +257,12 @@ public class WSSSecurityProperties exten
         this.actor = actor;
     }
 
-    public WSSConstants.KeyIdentifierType getDerivedKeyKeyIdentifierType() {
-        return derivedKeyKeyIdentifierType;
+    public WSSecurityTokenConstants.KeyIdentifier getDerivedKeyKeyIdentifier() {
+        return derivedKeyKeyIdentifier;
     }
 
-    public void setDerivedKeyKeyIdentifierType(WSSConstants.KeyIdentifierType derivedKeyKeyIdentifierType) {
-        this.derivedKeyKeyIdentifierType = derivedKeyKeyIdentifierType;
+    public void setDerivedKeyKeyIdentifier(WSSecurityTokenConstants.KeyIdentifier derivedKeyKeyIdentifier) {
+        this.derivedKeyKeyIdentifier = derivedKeyKeyIdentifier;
     }
 
     public WSSConstants.DerivedKeyTokenReference getDerivedKeyTokenReference() {



Mime
View raw message