ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gi...@apache.org
Subject svn commit: r1490977 [3/4] - in /webservices/wss4j/trunk: ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/ ws-security-policy-stax/src/main/java/org/apache/wss4j/policy/stax/assertionStates/ ws-security-policy-stax/src/test/java/org/...
Date Sat, 08 Jun 2013 13:20:19 GMT
Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SupportingTokensTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SupportingTokensTest.java?rev=1490977&r1=1490976&r2=1490977&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SupportingTokensTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SupportingTokensTest.java Sat Jun  8 13:20:18 2013
@@ -25,6 +25,7 @@ import org.apache.wss4j.common.saml.bean
 import org.apache.wss4j.policy.WSSPolicyException;
 import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
 import org.apache.wss4j.stax.impl.securityToken.*;
+import org.apache.xml.security.stax.impl.util.IDGenerator;
 import org.opensaml.common.SAMLVersion;
 import org.apache.wss4j.policy.stax.PolicyEnforcer;
 import org.apache.wss4j.stax.ext.WSSConstants;
@@ -268,7 +269,7 @@ public class SupportingTokensTest extend
         UsernameSecurityTokenImpl usernameSecurityToken = new UsernameSecurityTokenImpl(
                 WSSConstants.UsernameTokenPasswordType.PASSWORD_NONE,
                 "username", null, new Date().toString(), null, new byte[10], 10L,
-                null, null, null);
+                null, IDGenerator.generateID(null), WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
         usernameSecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_SupportingTokens);
         usernameTokenSecurityEvent.setSecurityToken(usernameSecurityToken);
         policyEnforcer.registerSecurityEvent(usernameTokenSecurityEvent);
@@ -278,7 +279,7 @@ public class SupportingTokensTest extend
         usernameSecurityToken = new UsernameSecurityTokenImpl(
                 WSSConstants.UsernameTokenPasswordType.PASSWORD_NONE,
                 "username", null, new Date().toString(), null, new byte[10], 10L,
-                null, null, null);
+                null, IDGenerator.generateID(null), WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
         usernameSecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_SupportingTokens);
         usernameTokenSecurityEvent.setSecurityToken(usernameSecurityToken);
         policyEnforcer.registerSecurityEvent(usernameTokenSecurityEvent);
@@ -310,7 +311,7 @@ public class SupportingTokensTest extend
         UsernameSecurityTokenImpl securityToken = new UsernameSecurityTokenImpl(
                 WSSConstants.UsernameTokenPasswordType.PASSWORD_DIGEST,
                 "username", null, new Date().toString(), null, new byte[10], 10L,
-                null, null, null);
+                null, IDGenerator.generateID(null), WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
         securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_SupportingTokens);
         usernameTokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(usernameTokenSecurityEvent);
@@ -320,7 +321,7 @@ public class SupportingTokensTest extend
         securityToken = new UsernameSecurityTokenImpl(
                 WSSConstants.UsernameTokenPasswordType.PASSWORD_DIGEST,
                 "username", null, new Date().toString(), null, new byte[10], 10L,
-                null, null, null);
+                null, IDGenerator.generateID(null), WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
         securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_SupportingTokens);
         usernameTokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(usernameTokenSecurityEvent);
@@ -356,7 +357,7 @@ public class SupportingTokensTest extend
         UsernameSecurityTokenImpl securityToken = new UsernameSecurityTokenImpl(
                 WSSConstants.UsernameTokenPasswordType.PASSWORD_NONE,
                 "username", null, new Date().toString(), null, new byte[10], 10L,
-                null, null, null);
+                null, IDGenerator.generateID(null), WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
         securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_SupportingTokens);
         usernameTokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(usernameTokenSecurityEvent);
@@ -366,7 +367,7 @@ public class SupportingTokensTest extend
         securityToken = new UsernameSecurityTokenImpl(
                 WSSConstants.UsernameTokenPasswordType.PASSWORD_DIGEST,
                 "username", "password", new Date().toString(), null, new byte[10], 10L,
-                null, null, null);
+                null, IDGenerator.generateID(null), WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
         securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_SupportingTokens);
         usernameTokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(usernameTokenSecurityEvent);
@@ -398,7 +399,7 @@ public class SupportingTokensTest extend
         UsernameSecurityTokenImpl securityToken = new UsernameSecurityTokenImpl(
                 WSSConstants.UsernameTokenPasswordType.PASSWORD_DIGEST,
                 "username", "password", new Date().toString(), null, new byte[10], 10L,
-                null, null, null);
+                null, IDGenerator.generateID(null), WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
         securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_SupportingTokens);
         usernameTokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(usernameTokenSecurityEvent);
@@ -408,7 +409,7 @@ public class SupportingTokensTest extend
         securityToken = new UsernameSecurityTokenImpl(
                 WSSConstants.UsernameTokenPasswordType.PASSWORD_NONE,
                 "username", null, new Date().toString(), null, new byte[10], 10L,
-                null, null, null);
+                null, IDGenerator.generateID(null), WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
         securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_SupportingTokens);
         usernameTokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(usernameTokenSecurityEvent);
@@ -1167,14 +1168,18 @@ public class SupportingTokensTest extend
 
         SamlTokenSecurityEvent tokenSecurityEvent = new SamlTokenSecurityEvent();
         SamlSecurityTokenImpl samlSecurityToken =
-            new SamlSecurityTokenImpl(samlAssertionWrapper, getX509Token(WSSecurityTokenConstants.X509V3Token), null, null, null, null);
+            new SamlSecurityTokenImpl(
+                    samlAssertionWrapper, getX509Token(WSSecurityTokenConstants.X509V3Token), null, null,
+                    WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference, null);
         samlSecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_SupportingTokens);
         tokenSecurityEvent.setSecurityToken(samlSecurityToken);
         policyEnforcer.registerSecurityEvent(tokenSecurityEvent);
 
         tokenSecurityEvent = new SamlTokenSecurityEvent();
         samlSecurityToken =
-            new SamlSecurityTokenImpl(samlAssertionWrapper, getX509Token(WSSecurityTokenConstants.X509V3Token), null, null, null, null);
+            new SamlSecurityTokenImpl(
+                    samlAssertionWrapper, getX509Token(WSSecurityTokenConstants.X509V3Token), null, null,
+                    WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference, null);
         samlSecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_SupportingTokens);
         tokenSecurityEvent.setSecurityToken(samlSecurityToken);
         policyEnforcer.registerSecurityEvent(tokenSecurityEvent);
@@ -1209,14 +1214,18 @@ public class SupportingTokensTest extend
 
         SamlTokenSecurityEvent tokenSecurityEvent = new SamlTokenSecurityEvent();
         SamlSecurityTokenImpl samlSecurityToken =
-            new SamlSecurityTokenImpl(samlAssertionWrapper, getX509Token(WSSecurityTokenConstants.X509V3Token), null, null, null, null);
+            new SamlSecurityTokenImpl(
+                    samlAssertionWrapper, getX509Token(WSSecurityTokenConstants.X509V3Token), null, null,
+                    WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference, null);
         samlSecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_SupportingTokens);
         tokenSecurityEvent.setSecurityToken(samlSecurityToken);
         policyEnforcer.registerSecurityEvent(tokenSecurityEvent);
 
         tokenSecurityEvent = new SamlTokenSecurityEvent();
         samlSecurityToken =
-            new SamlSecurityTokenImpl(samlAssertionWrapper, getX509Token(WSSecurityTokenConstants.X509V3Token), null, null, null, null);
+            new SamlSecurityTokenImpl(
+                    samlAssertionWrapper, getX509Token(WSSecurityTokenConstants.X509V3Token), null, null,
+                    WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference, null);
         samlSecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_SupportingTokens);
         tokenSecurityEvent.setSecurityToken(samlSecurityToken);
         policyEnforcer.registerSecurityEvent(tokenSecurityEvent);
@@ -1255,7 +1264,9 @@ public class SupportingTokensTest extend
 
         SamlTokenSecurityEvent tokenSecurityEvent = new SamlTokenSecurityEvent();
         SamlSecurityTokenImpl samlSecurityToken =
-            new SamlSecurityTokenImpl(samlAssertionWrapper, getX509Token(WSSecurityTokenConstants.X509V3Token), null, null, null, null);
+            new SamlSecurityTokenImpl(
+                    samlAssertionWrapper, getX509Token(WSSecurityTokenConstants.X509V3Token), null, null,
+                    WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference, null);
         samlSecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_SupportingTokens);
         tokenSecurityEvent.setSecurityToken(samlSecurityToken);
         policyEnforcer.registerSecurityEvent(tokenSecurityEvent);
@@ -1265,7 +1276,9 @@ public class SupportingTokensTest extend
 
         tokenSecurityEvent = new SamlTokenSecurityEvent();
         samlSecurityToken =
-            new SamlSecurityTokenImpl(samlAssertionWrapper, getX509Token(WSSecurityTokenConstants.X509V3Token), null, null, null, null);
+            new SamlSecurityTokenImpl(
+                    samlAssertionWrapper, getX509Token(WSSecurityTokenConstants.X509V3Token), null, null,
+                    WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference, null);
         samlSecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_SupportingTokens);
         tokenSecurityEvent.setSecurityToken(samlSecurityToken);
         policyEnforcer.registerSecurityEvent(tokenSecurityEvent);
@@ -1300,7 +1313,9 @@ public class SupportingTokensTest extend
 
         SamlTokenSecurityEvent tokenSecurityEvent = new SamlTokenSecurityEvent();
         SamlSecurityTokenImpl samlSecurityToken =
-            new SamlSecurityTokenImpl(samlAssertionWrapper, getX509Token(WSSecurityTokenConstants.X509V3Token), null, null, null, null);
+            new SamlSecurityTokenImpl(
+                    samlAssertionWrapper, getX509Token(WSSecurityTokenConstants.X509V3Token), null, null,
+                    WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference, null);
         samlSecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_SupportingTokens);
         tokenSecurityEvent.setSecurityToken(samlSecurityToken);
         policyEnforcer.registerSecurityEvent(tokenSecurityEvent);
@@ -1310,7 +1325,9 @@ public class SupportingTokensTest extend
 
         tokenSecurityEvent = new SamlTokenSecurityEvent();
         samlSecurityToken =
-            new SamlSecurityTokenImpl(samlAssertionWrapper, getX509Token(WSSecurityTokenConstants.X509V3Token), null, null, null, null);
+            new SamlSecurityTokenImpl(
+                    samlAssertionWrapper, getX509Token(WSSecurityTokenConstants.X509V3Token), null, null,
+                    WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference, null);
         samlSecurityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_SupportingTokens);
         tokenSecurityEvent.setSecurityToken(samlSecurityToken);
         policyEnforcer.registerSecurityEvent(tokenSecurityEvent);

Modified: webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SymmetricBindingTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SymmetricBindingTest.java?rev=1490977&r1=1490976&r2=1490977&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SymmetricBindingTest.java (original)
+++ webservices/wss4j/trunk/ws-security-policy-stax/src/test/java/org/apache/wss4j/policy/stax/test/SymmetricBindingTest.java Sat Jun  8 13:20:18 2013
@@ -65,13 +65,16 @@ public class SymmetricBindingTest extend
         policyEnforcer.registerSecurityEvent(requiredElementSecurityEvent);
 
         SecureConversationTokenSecurityEvent initiatorTokenSecurityEvent = new SecureConversationTokenSecurityEvent();
-        SecureConversationSecurityTokenImpl securityToken = new SecureConversationSecurityTokenImpl(null, "1", null);
+        SecureConversationSecurityTokenImpl securityToken =
+                new SecureConversationSecurityTokenImpl(
+                        null, "1", WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
         securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
         initiatorTokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(initiatorTokenSecurityEvent);
 
         SecureConversationTokenSecurityEvent recipientTokenSecurityEvent = new SecureConversationTokenSecurityEvent();
-        securityToken = new SecureConversationSecurityTokenImpl(null, "1", null);
+        securityToken = new SecureConversationSecurityTokenImpl(
+                null, "1", WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
         securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainEncryption);
         recipientTokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(recipientTokenSecurityEvent);
@@ -121,13 +124,16 @@ public class SymmetricBindingTest extend
         PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
 
         SecureConversationTokenSecurityEvent initiatorTokenSecurityEvent = new SecureConversationTokenSecurityEvent();
-        SecureConversationSecurityTokenImpl securityToken = new SecureConversationSecurityTokenImpl(null, "1", null);
+        SecureConversationSecurityTokenImpl securityToken =
+                new SecureConversationSecurityTokenImpl(
+                        null, "1", WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
         securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
         initiatorTokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(initiatorTokenSecurityEvent);
 
         SecureConversationTokenSecurityEvent recipientTokenSecurityEvent = new SecureConversationTokenSecurityEvent();
-        securityToken = new SecureConversationSecurityTokenImpl(null, "1", null);
+        securityToken = new SecureConversationSecurityTokenImpl(
+                null, "1", WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
         securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainEncryption);
         recipientTokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(recipientTokenSecurityEvent);
@@ -167,7 +173,9 @@ public class SymmetricBindingTest extend
                         "</sp:SymmetricBinding>";
         PolicyEnforcer policyEnforcer = buildAndStartPolicyEngine(policyString);
         SecureConversationTokenSecurityEvent secureConversationTokenSecurityEvent = new SecureConversationTokenSecurityEvent();
-        SecureConversationSecurityTokenImpl securityToken = new SecureConversationSecurityTokenImpl(null, "1", null);
+        SecureConversationSecurityTokenImpl securityToken =
+                new SecureConversationSecurityTokenImpl(
+                        null, "1", WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
         securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainEncryption);
         secureConversationTokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(secureConversationTokenSecurityEvent);
@@ -213,13 +221,16 @@ public class SymmetricBindingTest extend
         policyEnforcer.registerSecurityEvent(timestampSecurityEvent);
 
         SecureConversationTokenSecurityEvent initiatorTokenSecurityEvent = new SecureConversationTokenSecurityEvent();
-        SecureConversationSecurityTokenImpl securityToken = new SecureConversationSecurityTokenImpl(null, "1", null);
+        SecureConversationSecurityTokenImpl securityToken =
+                new SecureConversationSecurityTokenImpl(
+                        null, "1", WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
         securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
         initiatorTokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(initiatorTokenSecurityEvent);
 
         SecureConversationTokenSecurityEvent recipientTokenSecurityEvent = new SecureConversationTokenSecurityEvent();
-        securityToken = new SecureConversationSecurityTokenImpl(null, "1", null);
+        securityToken = new SecureConversationSecurityTokenImpl(
+                null, "1", WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
         securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainEncryption);
         recipientTokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(recipientTokenSecurityEvent);
@@ -267,13 +278,16 @@ public class SymmetricBindingTest extend
         policyEnforcer.registerSecurityEvent(timestampSecurityEvent);
 
         SecureConversationTokenSecurityEvent initiatorTokenSecurityEvent = new SecureConversationTokenSecurityEvent();
-        SecureConversationSecurityTokenImpl securityToken = new SecureConversationSecurityTokenImpl(null, "1", null);
+        SecureConversationSecurityTokenImpl securityToken =
+                new SecureConversationSecurityTokenImpl(
+                        null, "1", WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
         securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
         initiatorTokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(initiatorTokenSecurityEvent);
 
         SecureConversationTokenSecurityEvent recipientTokenSecurityEvent = new SecureConversationTokenSecurityEvent();
-        securityToken = new SecureConversationSecurityTokenImpl(null, "1", null);
+        securityToken = new SecureConversationSecurityTokenImpl(
+                null, "1", WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
         securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainEncryption);
         recipientTokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(recipientTokenSecurityEvent);

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=1490977&r1=1490976&r2=1490977&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 Sat Jun  8 13:20:18 2013
@@ -309,7 +309,7 @@ public class TransportBindingIntegration
                         "                </sp:ContentEncryptedElements>\n" +
                         "                <sp:SignedSupportingTokens>\n" +
                         "                    <wsp:Policy>\n" +
-                        "                        <sp:UsernameToken IncludeToken=\"http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient\">\n" +
+                        "                        <sp:UsernameToken sp:IncludeToken=\"http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient\">\n" +
                         "                            <wsp:Policy>\n" +
                         "                                <sp:NoPassword/>\n" +
                         "                            </wsp:Policy>\n" +
@@ -420,7 +420,7 @@ public class TransportBindingIntegration
                         "                </sp:ContentEncryptedElements>\n" +
                         "                <sp:SignedSupportingTokens>\n" +
                         "                    <wsp:Policy>\n" +
-                        "                        <sp:UsernameToken IncludeToken=\"http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient\">\n" +
+                        "                        <sp:UsernameToken sp:IncludeToken=\"http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient\">\n" +
                         "                            <wsp:Policy>\n" +
                         "                                <sp:NoPassword/>\n" +
                         "                            </wsp:Policy>\n" +
@@ -519,7 +519,7 @@ public class TransportBindingIntegration
                         "                </sp:TransportBinding>\n" +
                         "                <sp:SignedSupportingTokens>\n" +
                         "                    <wsp:Policy>\n" +
-                        "                        <sp:UsernameToken IncludeToken=\"http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient\">\n" +
+                        "                        <sp:UsernameToken sp:IncludeToken=\"http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient\">\n" +
                         "                            <wsp:Policy>\n" +
                         "                                <sp:NoPassword/>\n" +
                         "                            </wsp:Policy>\n" +
@@ -640,7 +640,7 @@ public class TransportBindingIntegration
                         "                </sp:ContentEncryptedElements>\n" +
                         "                <sp:SignedEncryptedSupportingTokens>\n" +
                         "                    <wsp:Policy>\n" +
-                        "                        <sp:UsernameToken IncludeToken=\"http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient\">\n" +
+                        "                        <sp:UsernameToken sp:IncludeToken=\"http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient\">\n" +
                         "                            <wsp:Policy>\n" +
                         "                                <sp:NoPassword/>\n" +
                         "                            </wsp:Policy>\n" +
@@ -743,7 +743,7 @@ public class TransportBindingIntegration
                         "                </sp:EncryptedParts>\n" +
                         "                <sp:SignedSupportingTokens>\n" +
                         "                    <wsp:Policy>\n" +
-                        "                        <sp:UsernameToken IncludeToken=\"http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient\">\n" +
+                        "                        <sp:UsernameToken sp:IncludeToken=\"http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient\">\n" +
                         "                            <wsp:Policy>\n" +
                         "                                <sp:NoPassword/>\n" +
                         "                            </wsp:Policy>\n" +
@@ -868,7 +868,7 @@ public class TransportBindingIntegration
                         "                </sp:ContentEncryptedElements>\n" +
                         "                <sp:SignedSupportingTokens>\n" +
                         "                    <wsp:Policy>\n" +
-                        "                        <sp:UsernameToken IncludeToken=\"http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient\">\n" +
+                        "                        <sp:UsernameToken sp:IncludeToken=\"http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient\">\n" +
                         "                            <wsp:Policy>\n" +
                         "                                <!--<sp:HashPassword/>-->\n" +
                         "                                <sp:NoPassword/>\n" +
@@ -984,7 +984,7 @@ public class TransportBindingIntegration
                         "                </sp:ContentEncryptedElements>\n" +
                         "                <sp:SignedSupportingTokens>\n" +
                         "                    <wsp:Policy>\n" +
-                        "                        <sp:UsernameToken IncludeToken=\"http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient\">\n" +
+                        "                        <sp:UsernameToken sp:IncludeToken=\"http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient\">\n" +
                         "                            <wsp:Policy>\n" +
                         "                                <!--<sp:HashPassword/>-->\n" +
                         "                                <sp:NoPassword/>\n" +

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=1490977&r1=1490976&r2=1490977&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 Sat Jun  8 13:20:18 2013
@@ -28,6 +28,7 @@ import org.apache.wss4j.stax.securityEve
 import org.apache.wss4j.stax.securityEvent.SignedPartSecurityEvent;
 import org.apache.wss4j.stax.securityEvent.UsernameTokenSecurityEvent;
 import org.apache.xml.security.stax.ext.XMLSecurityConstants;
+import org.apache.xml.security.stax.impl.util.IDGenerator;
 import org.apache.xml.security.stax.securityEvent.ContentEncryptedElementSecurityEvent;
 import org.apache.xml.security.stax.securityToken.InboundSecurityToken;
 import org.testng.Assert;
@@ -81,7 +82,7 @@ public class UsernameTokenTest extends A
         UsernameSecurityTokenImpl securityToken = new UsernameSecurityTokenImpl(
                 WSSConstants.UsernameTokenPasswordType.PASSWORD_DIGEST,
                 "username", "password", new Date().toString(), null, new byte[10], 10L,
-                null, null, null);
+                null, IDGenerator.generateID(null), WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
         securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
         initiatorTokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(initiatorTokenSecurityEvent);
@@ -91,7 +92,7 @@ public class UsernameTokenTest extends A
         securityToken = new UsernameSecurityTokenImpl(
                 WSSConstants.UsernameTokenPasswordType.PASSWORD_DIGEST,
                 "username", "password", new Date().toString(), null, new byte[10], 10L,
-                null, null, null);
+                null, IDGenerator.generateID(null), WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
         securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainEncryption);
         recipientTokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(recipientTokenSecurityEvent);
@@ -159,7 +160,7 @@ public class UsernameTokenTest extends A
         UsernameSecurityTokenImpl securityToken = new UsernameSecurityTokenImpl(
                 WSSConstants.UsernameTokenPasswordType.PASSWORD_TEXT,
                 "username", "password", new Date().toString(), null, new byte[10], 10L,
-                null, null, null);
+                null, IDGenerator.generateID(null), WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
         securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainSignature);
         usernameTokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(usernameTokenSecurityEvent);
@@ -169,7 +170,7 @@ public class UsernameTokenTest extends A
         securityToken = new UsernameSecurityTokenImpl(
                 WSSConstants.UsernameTokenPasswordType.PASSWORD_TEXT,
                 "username", "password", new Date().toString(), null, new byte[10], 10L,
-                null, null, null);
+                null, IDGenerator.generateID(null), WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
         securityToken.addTokenUsage(WSSecurityTokenConstants.TokenUsage_MainEncryption);
         recipientTokenSecurityEvent.setSecurityToken(securityToken);
         policyEnforcer.registerSecurityEvent(recipientTokenSecurityEvent);

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/InboundWSSecurityContextImpl.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/InboundWSSecurityContextImpl.java?rev=1490977&r1=1490976&r2=1490977&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/InboundWSSecurityContextImpl.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/InboundWSSecurityContextImpl.java Sat Jun  8 13:20:18 2013
@@ -364,10 +364,12 @@ public class InboundWSSecurityContextImp
     }
 
     private boolean containsSecurityToken(List<TokenSecurityEvent<? extends InboundSecurityToken>> supportingTokens, SecurityToken securityToken) {
-        for (int i = 0; i < supportingTokens.size(); i++) {
-            TokenSecurityEvent<? extends SecurityToken> tokenSecurityEvent = supportingTokens.get(i);
-            if (tokenSecurityEvent.getSecurityToken() == securityToken) {
-                return true;
+        if (securityToken != null) {
+            for (int i = 0; i < supportingTokens.size(); i++) {
+                TokenSecurityEvent<? extends SecurityToken> tokenSecurityEvent = supportingTokens.get(i);
+                if (tokenSecurityEvent.getSecurityToken().getId().equals(securityToken.getId())) {
+                    return true;
+                }
             }
         }
         return false;
@@ -376,10 +378,12 @@ public class InboundWSSecurityContextImp
     private TokenSecurityEvent<? extends InboundSecurityToken> getTokenSecurityEvent(
             InboundSecurityToken securityToken,
             List<TokenSecurityEvent<? extends InboundSecurityToken>> tokenSecurityEvents) throws XMLSecurityException {
-        for (int i = 0; i < tokenSecurityEvents.size(); i++) {
-            TokenSecurityEvent<? extends InboundSecurityToken> tokenSecurityEvent = tokenSecurityEvents.get(i);
-            if (tokenSecurityEvent.getSecurityToken() == securityToken) {
-                return tokenSecurityEvent;
+        if (securityToken != null) {
+            for (int i = 0; i < tokenSecurityEvents.size(); i++) {
+                TokenSecurityEvent<? extends InboundSecurityToken> tokenSecurityEvent = tokenSecurityEvents.get(i);
+                if (tokenSecurityEvent.getSecurityToken().getId().equals(securityToken.getId())) {
+                    return tokenSecurityEvent;
+                }
             }
         }
         return null;
@@ -514,7 +518,7 @@ public class InboundWSSecurityContextImp
             if (WSSecurityEventConstants.SignedElement.equals(securityEvent.getSecurityEventType())) {
                 SignedElementSecurityEvent signedElementSecurityEvent = (SignedElementSecurityEvent) securityEvent;
                 if (signedElementSecurityEvent.isSigned()
-                        && signedElementSecurityEvent.getSecurityToken() == tokenSecurityEvent.getSecurityToken()
+                        && signedElementSecurityEvent.getSecurityToken().getId().equals(tokenSecurityEvent.getSecurityToken().getId())
                         && WSSUtils.pathMatches(elementPath, signedElementSecurityEvent.getElementPath(), true, false)) {
                     return true;
                 }
@@ -530,14 +534,14 @@ public class InboundWSSecurityContextImp
             if (WSSecurityEventConstants.EncryptedElement.equals(securityEvent.getSecurityEventType())) {
                 EncryptedElementSecurityEvent encryptedElementSecurityEvent = (EncryptedElementSecurityEvent) securityEvent;
                 if (encryptedElementSecurityEvent.isEncrypted()
-                        && encryptedElementSecurityEvent.getSecurityToken() == tokenSecurityEvent.getSecurityToken()
+                        && encryptedElementSecurityEvent.getSecurityToken().getId().equals(tokenSecurityEvent.getSecurityToken().getId())
                         && WSSUtils.pathMatches(elementPath, encryptedElementSecurityEvent.getElementPath(), true, false)) {
                     return true;
                 }
             } else if (WSSecurityEventConstants.ContentEncrypted.equals(securityEvent.getSecurityEventType())) {
                 ContentEncryptedElementSecurityEvent contentEncryptedElementSecurityEvent = (ContentEncryptedElementSecurityEvent) securityEvent;
                 if (contentEncryptedElementSecurityEvent.isEncrypted()
-                        && contentEncryptedElementSecurityEvent.getSecurityToken() == tokenSecurityEvent.getSecurityToken()
+                        && contentEncryptedElementSecurityEvent.getSecurityToken().getId().equals(tokenSecurityEvent.getSecurityToken().getId())
                         && contentEncryptedElementSecurityEvent.getXmlSecEvent() == tokenSecurityEvent.getSecurityToken().getXMLSecEvent()
                         && WSSUtils.pathMatches(elementPath, contentEncryptedElementSecurityEvent.getElementPath(), true, false)) {
                     return true;

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/DerivedKeyTokenInputHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/DerivedKeyTokenInputHandler.java?rev=1490977&r1=1490976&r2=1490977&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/DerivedKeyTokenInputHandler.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/DerivedKeyTokenInputHandler.java Sat Jun  8 13:20:18 2013
@@ -84,7 +84,8 @@ public class DerivedKeyTokenInputHandler
                 //todo implement interface to access all derivedKeys? The same would be needed in UserNameToken
                 this.derivedKeySecurityToken = new AbstractInboundSecurityToken(
                         (WSInboundSecurityContext) inputProcessorChain.getSecurityContext(),
-                        derivedKeyTokenType.getId(), null) {
+                        derivedKeyTokenType.getId(), WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference,
+                        true) {
 
                     private InboundSecurityToken referencedSecurityToken = null;
 

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SAMLTokenInputHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SAMLTokenInputHandler.java?rev=1490977&r1=1490976&r2=1490977&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SAMLTokenInputHandler.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SAMLTokenInputHandler.java Sat Jun  8 13:20:18 2013
@@ -50,6 +50,7 @@ import org.apache.xml.security.stax.ext.
 import org.apache.xml.security.stax.ext.stax.XMLSecStartElement;
 import org.apache.xml.security.stax.impl.XMLSecurityEventReader;
 import org.apache.xml.security.stax.impl.securityToken.AbstractInboundSecurityToken;
+import org.apache.xml.security.stax.impl.util.IDGenerator;
 import org.apache.xml.security.stax.securityEvent.SecurityEvent;
 import org.apache.xml.security.stax.securityEvent.SecurityEventListener;
 import org.apache.xml.security.stax.securityEvent.SignedElementSecurityEvent;
@@ -172,8 +173,8 @@ public class SAMLTokenInputHandler exten
             if (subjectSecretKey != null && subjectSecretKey.length > 0) {
 
                 subjectSecurityToken = new AbstractInboundSecurityToken(
-                        wsInboundSecurityContext, "",
-                        WSSecurityTokenConstants.KeyIdentifier_NoKeyInfo) {
+                        wsInboundSecurityContext, IDGenerator.generateID(null),
+                        WSSecurityTokenConstants.KeyIdentifier_NoKeyInfo, true) {
                     @Override
                     public WSSecurityTokenConstants.TokenType getTokenType() {
                         return WSSecurityTokenConstants.DefaultToken;
@@ -359,8 +360,8 @@ public class SAMLTokenInputHandler exten
             }
 
             return new AbstractInboundSecurityToken(
-                    inputProcessorChain.getSecurityContext(), "",
-                    WSSecurityTokenConstants.KeyIdentifier_NoKeyInfo) {
+                    inputProcessorChain.getSecurityContext(), IDGenerator.generateID(null),
+                    WSSecurityTokenConstants.KeyIdentifier_NoKeyInfo, true) {
                 @Override
                 public WSSecurityTokenConstants.TokenType getTokenType() {
                     return WSSecurityTokenConstants.DefaultToken;

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SecurityTokenReferenceInputHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SecurityTokenReferenceInputHandler.java?rev=1490977&r1=1490976&r2=1490977&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SecurityTokenReferenceInputHandler.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SecurityTokenReferenceInputHandler.java Sat Jun  8 13:20:18 2013
@@ -163,7 +163,7 @@ public class SecurityTokenReferenceInput
                                         xmlSecEventList,
                                         (WSInboundSecurityContext) inputProcessorChain.getSecurityContext(),
                                         securityTokenReferenceId,
-                                        WSSecurityTokenConstants.KeyIdentifier_SecurityTokenReference);
+                                        WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
                             }
 
                             @Override

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/DsaKeyValueSecurityTokenImpl.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/DsaKeyValueSecurityTokenImpl.java?rev=1490977&r1=1490976&r2=1490977&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/DsaKeyValueSecurityTokenImpl.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/DsaKeyValueSecurityTokenImpl.java Sat Jun  8 13:20:18 2013
@@ -22,7 +22,6 @@ import org.apache.wss4j.common.ext.WSSec
 import org.apache.wss4j.common.principal.PublicKeyPrincipalImpl;
 import org.apache.wss4j.stax.ext.WSInboundSecurityContext;
 import org.apache.wss4j.stax.securityToken.DsaKeyValueSecurityToken;
-import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
 import org.apache.xml.security.binding.xmldsig.DSAKeyValueType;
 import org.apache.xml.security.exceptions.XMLSecurityException;
 
@@ -36,9 +35,8 @@ public class DsaKeyValueSecurityTokenImp
     private Principal principal;
 
     public DsaKeyValueSecurityTokenImpl(
-            DSAKeyValueType dsaKeyValueType, WSInboundSecurityContext wsInboundSecurityContext,
-            WSSecurityTokenConstants.KeyIdentifier keyIdentifier) throws XMLSecurityException {
-        super(dsaKeyValueType, wsInboundSecurityContext, keyIdentifier);
+            DSAKeyValueType dsaKeyValueType, WSInboundSecurityContext wsInboundSecurityContext) {
+        super(dsaKeyValueType, wsInboundSecurityContext);
     }
 
     @Override

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/ECKeyValueSecurityTokenImpl.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/ECKeyValueSecurityTokenImpl.java?rev=1490977&r1=1490976&r2=1490977&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/ECKeyValueSecurityTokenImpl.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/ECKeyValueSecurityTokenImpl.java Sat Jun  8 13:20:18 2013
@@ -22,7 +22,6 @@ import org.apache.wss4j.common.ext.WSSec
 import org.apache.wss4j.common.principal.PublicKeyPrincipalImpl;
 import org.apache.wss4j.stax.ext.WSInboundSecurityContext;
 import org.apache.wss4j.stax.securityToken.ECKeyValueSecurityToken;
-import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
 import org.apache.xml.security.binding.xmldsig11.ECKeyValueType;
 import org.apache.xml.security.exceptions.XMLSecurityException;
 
@@ -36,9 +35,9 @@ public class ECKeyValueSecurityTokenImpl
     private Principal principal;
 
     public ECKeyValueSecurityTokenImpl(
-            ECKeyValueType ecKeyValueType, WSInboundSecurityContext wsInboundSecurityContext,
-            WSSecurityTokenConstants.KeyIdentifier keyIdentifier) throws XMLSecurityException {
-        super(ecKeyValueType, wsInboundSecurityContext, keyIdentifier);
+            ECKeyValueType ecKeyValueType, WSInboundSecurityContext wsInboundSecurityContext)
+            throws XMLSecurityException {
+        super(ecKeyValueType, wsInboundSecurityContext);
     }
 
     @Override

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/EncryptedKeySha1SecurityTokenImpl.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/EncryptedKeySha1SecurityTokenImpl.java?rev=1490977&r1=1490976&r2=1490977&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/EncryptedKeySha1SecurityTokenImpl.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/EncryptedKeySha1SecurityTokenImpl.java Sat Jun  8 13:20:18 2013
@@ -41,11 +41,11 @@ public class EncryptedKeySha1SecurityTok
     private CallbackHandler callbackHandler;
     private String sha1Identifier;
 
-    public EncryptedKeySha1SecurityTokenImpl(WSInboundSecurityContext inboundSecurityContext,
-                                             CallbackHandler callbackHandler, String sha1Identifier,
-                                             String id, SecurityTokenConstants.KeyIdentifier keyIdentifier) {
+    public EncryptedKeySha1SecurityTokenImpl(
+            WSInboundSecurityContext inboundSecurityContext, CallbackHandler callbackHandler,
+            String sha1Identifier, String id) {
 
-        super(inboundSecurityContext, id, keyIdentifier);
+        super(inboundSecurityContext, id, WSSecurityTokenConstants.KeyIdentifier_EncryptedKeySha1Identifier, false);
         this.callbackHandler = callbackHandler;
         this.sha1Identifier = sha1Identifier;
     }

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/HttpsSecurityTokenImpl.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/HttpsSecurityTokenImpl.java?rev=1490977&r1=1490976&r2=1490977&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/HttpsSecurityTokenImpl.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/HttpsSecurityTokenImpl.java Sat Jun  8 13:20:18 2013
@@ -43,20 +43,18 @@ public class HttpsSecurityTokenImpl exte
     }
 
     public HttpsSecurityTokenImpl() {
-        super(null, IDGenerator.generateID(null), null);
+        super(null, IDGenerator.generateID(null), WSSecurityTokenConstants.KeyIdentifier_NoKeyInfo, true);
         this.authenticationType = AuthenticationType.noAuthentication;
     }
     
     public HttpsSecurityTokenImpl(X509Certificate x509Certificate) {
-
-        super(null, IDGenerator.generateID(null), null);
+        super(null, IDGenerator.generateID(null), WSSecurityTokenConstants.KeyIdentifier_NoKeyInfo, true);
         setX509Certificates(new X509Certificate[]{x509Certificate});
         this.authenticationType = AuthenticationType.httpsClientAuthentication;
     }
 
     public HttpsSecurityTokenImpl(boolean basicAuthentication, String username) {
-
-        super(null, IDGenerator.generateID(null), null);
+        super(null, IDGenerator.generateID(null), WSSecurityTokenConstants.KeyIdentifier_NoKeyInfo, true);
         if (basicAuthentication) {
             this.authenticationType = AuthenticationType.httpBasicAuthentication;
         } else {

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/KerberosServiceSecurityTokenImpl.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/KerberosServiceSecurityTokenImpl.java?rev=1490977&r1=1490976&r2=1490977&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/KerberosServiceSecurityTokenImpl.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/KerberosServiceSecurityTokenImpl.java Sat Jun  8 13:20:18 2013
@@ -56,7 +56,7 @@ public class KerberosServiceSecurityToke
     public KerberosServiceSecurityTokenImpl(WSInboundSecurityContext wsInboundSecurityContext, CallbackHandler callbackHandler,
                                             byte[] binaryContent, String kerberosTokenValueType, String id,
                                             WSSecurityTokenConstants.KeyIdentifier keyIdentifier) {
-        super(wsInboundSecurityContext, id, keyIdentifier);
+        super(wsInboundSecurityContext, id, keyIdentifier, true);
         this.callbackHandler = callbackHandler;
         this.binaryContent = binaryContent;
         this.kerberosTokenValueType = kerberosTokenValueType;

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/RsaKeyValueSecurityTokenImpl.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/RsaKeyValueSecurityTokenImpl.java?rev=1490977&r1=1490976&r2=1490977&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/RsaKeyValueSecurityTokenImpl.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/RsaKeyValueSecurityTokenImpl.java Sat Jun  8 13:20:18 2013
@@ -22,7 +22,6 @@ import org.apache.wss4j.common.ext.WSSec
 import org.apache.wss4j.common.principal.PublicKeyPrincipalImpl;
 import org.apache.wss4j.stax.ext.WSInboundSecurityContext;
 import org.apache.wss4j.stax.securityToken.RsaKeyValueSecurityToken;
-import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants;
 import org.apache.xml.security.binding.xmldsig.RSAKeyValueType;
 import org.apache.xml.security.exceptions.XMLSecurityException;
 
@@ -36,9 +35,8 @@ public class RsaKeyValueSecurityTokenImp
     private Principal principal;
 
     public RsaKeyValueSecurityTokenImpl(
-            RSAKeyValueType rsaKeyValueType, WSInboundSecurityContext wsInboundSecurityContext,
-            WSSecurityTokenConstants.KeyIdentifier keyIdentifier) throws XMLSecurityException {
-        super(rsaKeyValueType, wsInboundSecurityContext, keyIdentifier);
+            RSAKeyValueType rsaKeyValueType, WSInboundSecurityContext wsInboundSecurityContext) {
+        super(rsaKeyValueType, wsInboundSecurityContext);
     }
 
     @Override

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/SamlSecurityTokenImpl.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/SamlSecurityTokenImpl.java?rev=1490977&r1=1490976&r2=1490977&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/SamlSecurityTokenImpl.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/SamlSecurityTokenImpl.java Sat Jun  8 13:20:18 2013
@@ -54,7 +54,7 @@ public class SamlSecurityTokenImpl exten
                                  WSInboundSecurityContext wsInboundSecurityContext, Crypto crypto,
                                  WSSecurityTokenConstants.KeyIdentifier keyIdentifier,
                                  WSSSecurityProperties securityProperties) {
-        super(wsInboundSecurityContext, samlAssertionWrapper.getId(), keyIdentifier);
+        super(wsInboundSecurityContext, samlAssertionWrapper.getId(), keyIdentifier, true);
         this.samlAssertionWrapper = samlAssertionWrapper;
         this.crypto = crypto;
         this.subjectSecurityToken = subjectSecurityToken;

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/SecureConversationSecurityTokenImpl.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/SecureConversationSecurityTokenImpl.java?rev=1490977&r1=1490976&r2=1490977&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/SecureConversationSecurityTokenImpl.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/SecureConversationSecurityTokenImpl.java Sat Jun  8 13:20:18 2013
@@ -29,7 +29,7 @@ public class SecureConversationSecurityT
 
     public SecureConversationSecurityTokenImpl(WSInboundSecurityContext wsInboundSecurityContext, String id,
                                                WSSecurityTokenConstants.KeyIdentifier keyIdentifier) {
-        super(wsInboundSecurityContext, id, keyIdentifier);
+        super(wsInboundSecurityContext, id, keyIdentifier, false);
     }
 
     @Override

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/SecurityTokenFactoryImpl.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/SecurityTokenFactoryImpl.java?rev=1490977&r1=1490976&r2=1490977&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/SecurityTokenFactoryImpl.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/SecurityTokenFactoryImpl.java Sat Jun  8 13:20:18 2013
@@ -33,11 +33,16 @@ import org.apache.xml.security.binding.x
 import org.apache.xml.security.binding.xmldsig11.ECKeyValueType;
 import org.apache.xml.security.exceptions.XMLSecurityException;
 import org.apache.xml.security.stax.ext.*;
+import org.apache.xml.security.stax.impl.util.IDGenerator;
 import org.apache.xml.security.stax.securityToken.InboundSecurityToken;
 import org.apache.xml.security.stax.securityToken.SecurityTokenFactory;
 import org.apache.xml.security.stax.securityToken.SecurityTokenProvider;
 
 import javax.security.auth.callback.CallbackHandler;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 import java.util.Arrays;
@@ -76,10 +81,10 @@ public class SecurityTokenFactoryImpl ex
                 return getSecurityToken(keyValueType, crypto, ((WSSSecurityProperties)securityProperties).getCallbackHandler(), inboundSecurityContext);
             }
 
-        } else if (crypto.getDefaultX509Identifier() != null) {
+        } else if (crypto != null && crypto.getDefaultX509Identifier() != null) {
             return new X509DefaultSecurityTokenImpl(
                     (WSInboundSecurityContext) inboundSecurityContext, crypto, ((WSSSecurityProperties)securityProperties).getCallbackHandler(), crypto.getDefaultX509Identifier(),
-                    crypto.getDefaultX509Identifier(), null, ((WSSSecurityProperties)securityProperties)
+                    crypto.getDefaultX509Identifier(), WSSecurityTokenConstants.KeyIdentifier_NoKeyInfo, ((WSSSecurityProperties)securityProperties)
             );
         }
         throw new WSSecurityException(WSSecurityException.ErrorCode.INVALID_SECURITY, "noKeyinfo");
@@ -101,16 +106,46 @@ public class SecurityTokenFactoryImpl ex
             if (securityTokenReferenceType.getAny().size() > 1) {
                 ((WSInboundSecurityContext) inboundSecurityContext).handleBSPRule(BSPRule.R3061);
             }
+
+            if (securityTokenReferenceType.getId() == null) {
+                securityTokenReferenceType.setId(IDGenerator.generateID(null));
+            }
             
             //todo BSP.R3027 KeyName? not supported ATM
             //todo BSP.R3060,BSP.R3025,BSP.R3056 only one Embedded element? Not supported ATM
             final X509DataType x509DataType
                     = XMLSecurityUtils.getQNameType(securityTokenReferenceType.getAny(), WSSConstants.TAG_dsig_X509Data);
             if (x509DataType != null) {
-                return new X509DataSecurityTokenImpl((WSInboundSecurityContext) inboundSecurityContext, crypto, callbackHandler,
-                        x509DataType, securityTokenReferenceType.getId(),
-                        WSSecurityTokenConstants.KeyIdentifier_IssuerSerial,
-                        securityProperties);
+
+                //Issuer Serial
+                X509IssuerSerialType x509IssuerSerialType = XMLSecurityUtils.getQNameType(
+                        x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName(), WSSConstants.TAG_dsig_X509IssuerSerial);
+                if (x509IssuerSerialType != null) {
+                    return new X509IssuerSerialTokenImpl(
+                            (WSInboundSecurityContext) inboundSecurityContext, crypto, callbackHandler, x509IssuerSerialType,
+                            securityTokenReferenceType.getId(), securityProperties);
+                }
+
+                //Subject Key Identifier
+                byte[] skiBytes =
+                        XMLSecurityUtils.getQNameType(
+                                x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName(),
+                                XMLSecurityConstants.TAG_dsig_X509SKI
+                        );
+                if (skiBytes != null) {
+                    return new X509SKISecurityTokenImpl(
+                            (WSInboundSecurityContext) inboundSecurityContext, crypto, callbackHandler, skiBytes,
+                            securityTokenReferenceType.getId(), securityProperties);
+                }
+
+                //X509Certificate
+                byte[] x509CertificateBytes = XMLSecurityUtils.getQNameType(
+                        x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName(), WSSConstants.TAG_dsig_X509Certificate);
+                if (x509CertificateBytes != null) {
+                    return new X509V3SecurityTokenImpl(
+                            (WSInboundSecurityContext) inboundSecurityContext, crypto, callbackHandler,
+                            x509CertificateBytes, securityTokenReferenceType.getId(), securityProperties);
+                }
             }
             
             String tokenType = 
@@ -142,24 +177,21 @@ public class SecurityTokenFactoryImpl ex
                 }
 
                 if (WSSConstants.NS_X509_V3_TYPE.equals(valueType)) {
-                    return new X509_V3SecurityTokenImpl(
+                    return new X509V3SecurityTokenImpl(
                             (WSInboundSecurityContext) inboundSecurityContext, crypto, callbackHandler,
-                            binaryContent, securityTokenReferenceType.getId(), WSSecurityTokenConstants.KeyIdentifier_X509KeyIdentifier,
-                            securityProperties);
+                            binaryContent, securityTokenReferenceType.getId(), securityProperties);
                 } else if (WSSConstants.NS_X509SubjectKeyIdentifier.equals(valueType)) {
-                    return new X509SubjectKeyIdentifierSecurityTokenImpl(
+                    return new X509SKISecurityTokenImpl(
                             (WSInboundSecurityContext) inboundSecurityContext, crypto, callbackHandler, binaryContent,
-                            securityTokenReferenceType.getId(), WSSecurityTokenConstants.KeyIdentifier_SkiKeyIdentifier,
-                            securityProperties);
+                            securityTokenReferenceType.getId(), securityProperties);
                 } else if (WSSConstants.NS_THUMBPRINT.equals(valueType)) {
-                    return new ThumbprintSHA1SecurityTokenImpl(
+                    return new X509ThumbprintSHA1SecurityTokenImpl(
                             (WSInboundSecurityContext) inboundSecurityContext, crypto, callbackHandler, binaryContent,
-                            securityTokenReferenceType.getId(), WSSecurityTokenConstants.KeyIdentifier_ThumbprintIdentifier,
-                            securityProperties);
+                            securityTokenReferenceType.getId(), securityProperties);
                 } else if (WSSConstants.NS_ENCRYPTED_KEY_SHA1.equals(valueType)) {
                     return new EncryptedKeySha1SecurityTokenImpl(
                             (WSInboundSecurityContext) inboundSecurityContext, callbackHandler, keyIdentifierType.getValue(),
-                            securityTokenReferenceType.getId(), WSSecurityTokenConstants.KeyIdentifier_EncryptedKeySha1Identifier);
+                            securityTokenReferenceType.getId());
                 } else if (WSSConstants.NS_SAML10_TYPE.equals(valueType) || WSSConstants.NS_SAML20_TYPE.equals(valueType)) {
                     if (WSSConstants.NS_SAML20_TYPE.equals(valueType) && !WSSConstants.NS_SAML20_TOKEN_PROFILE_TYPE.equals(tokenType)) {
                         ((WSInboundSecurityContext) inboundSecurityContext).handleBSPRule(BSPRule.R6617);
@@ -172,12 +204,14 @@ public class SecurityTokenFactoryImpl ex
                         throw new WSSecurityException(
                                 WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, "noToken", keyIdentifierType.getValue());
                     }
-                    return securityTokenProvider.getSecurityToken();
+                    return createSecurityTokenProxy(securityTokenProvider.getSecurityToken(),
+                            WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
                 } else if (WSSConstants.NS_Kerberos5_AP_REQ_SHA1.equals(valueType)) {
                     SecurityTokenProvider<? extends InboundSecurityToken> securityTokenProvider =
                             inboundSecurityContext.getSecurityTokenProvider(keyIdentifierType.getValue());
                     if (securityTokenProvider != null) {
-                        return securityTokenProvider.getSecurityToken();
+                        return createSecurityTokenProxy(securityTokenProvider.getSecurityToken(),
+                                WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
                     }
 
                     MessageDigest messageDigest = null;
@@ -196,7 +230,8 @@ public class SecurityTokenFactoryImpl ex
                             KerberosServiceSecurityToken kerberosSecurityToken = (KerberosServiceSecurityToken)inboundSecurityToken;
                             byte[] tokenDigest = messageDigest.digest(kerberosSecurityToken.getBinaryContent());
                             if (Arrays.equals(tokenDigest, binaryContent)) {
-                                return inboundSecurityToken;
+                                return createSecurityTokenProxy(inboundSecurityToken,
+                                        WSSecurityTokenConstants.KeyIdentifier_ThumbprintIdentifier);
                             }
                         }
                     }
@@ -278,7 +313,8 @@ public class SecurityTokenFactoryImpl ex
                     }
                 }
                 
-                return securityTokenProvider.getSecurityToken();
+                return createSecurityTokenProxy(securityTokenProvider.getSecurityToken(),
+                        WSSecurityTokenConstants.KeyIdentifier_SecurityTokenDirectReference);
             }
             throw new WSSecurityException(WSSecurityException.ErrorCode.INVALID_SECURITY, "noKeyinfo");
         } finally {
@@ -295,8 +331,7 @@ public class SecurityTokenFactoryImpl ex
         final RSAKeyValueType rsaKeyValueType
                 = XMLSecurityUtils.getQNameType(keyValueType.getContent(), WSSConstants.TAG_dsig_RSAKeyValue);
         if (rsaKeyValueType != null) {
-            return new RsaKeyValueSecurityTokenImpl(rsaKeyValueType, (WSInboundSecurityContext) securityContext,
-                    WSSecurityTokenConstants.KeyIdentifier_KeyValue) {
+            return new RsaKeyValueSecurityTokenImpl(rsaKeyValueType, (WSInboundSecurityContext) securityContext) {
                 @Override
                 public void verify() throws XMLSecurityException {
                     crypto.verifyTrust(getPubKey("", null, null));
@@ -306,8 +341,7 @@ public class SecurityTokenFactoryImpl ex
         final DSAKeyValueType dsaKeyValueType
                 = XMLSecurityUtils.getQNameType(keyValueType.getContent(), WSSConstants.TAG_dsig_DSAKeyValue);
         if (dsaKeyValueType != null) {
-            return new DsaKeyValueSecurityTokenImpl(dsaKeyValueType, (WSInboundSecurityContext) securityContext,
-                    WSSecurityTokenConstants.KeyIdentifier_KeyValue) {
+            return new DsaKeyValueSecurityTokenImpl(dsaKeyValueType, (WSInboundSecurityContext) securityContext) {
                 @Override
                 public void verify() throws XMLSecurityException {
                     crypto.verifyTrust(getPubKey("", null, null));
@@ -317,8 +351,7 @@ public class SecurityTokenFactoryImpl ex
         final ECKeyValueType ecKeyValueType
                 = XMLSecurityUtils.getQNameType(keyValueType.getContent(), WSSConstants.TAG_dsig11_ECKeyValue);
         if (ecKeyValueType != null) {
-            return new ECKeyValueSecurityTokenImpl(ecKeyValueType, (WSInboundSecurityContext) securityContext,
-                    WSSecurityTokenConstants.KeyIdentifier_KeyValue) {
+            return new ECKeyValueSecurityTokenImpl(ecKeyValueType, (WSInboundSecurityContext) securityContext) {
                 @Override
                 public void verify() throws XMLSecurityException {
                     crypto.verifyTrust(getPubKey("", null, null));
@@ -327,4 +360,31 @@ public class SecurityTokenFactoryImpl ex
         }
         throw new WSSecurityException(WSSecurityException.ErrorCode.INVALID_SECURITY, "unsupportedKeyInfo");
     }
+
+    private static InboundSecurityToken createSecurityTokenProxy(
+            final InboundSecurityToken inboundSecurityToken,
+            final WSSecurityTokenConstants.KeyIdentifier keyIdentifier) {
+
+        Class<?>[] interfaces = new Class<?>[inboundSecurityToken.getClass().getInterfaces().length + 1];
+        System.arraycopy(inboundSecurityToken.getClass().getInterfaces(), 0, interfaces, 0, inboundSecurityToken.getClass().getInterfaces().length);
+        interfaces[interfaces.length - 1] = InboundSecurityToken.class;
+        return (InboundSecurityToken) Proxy.newProxyInstance(
+                inboundSecurityToken.getClass().getClassLoader(),
+                interfaces,
+                new InvocationHandler() {
+
+                    @Override
+                    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+                        //todo static final initializer for getKeyIdentifier?
+                        if (method.getName().equals("getKeyIdentifier")) {
+                            return keyIdentifier;
+                        }
+                        try {
+                            return method.invoke(inboundSecurityToken, args);
+                        } catch (InvocationTargetException e) {
+                            throw e.getTargetException();
+                        }
+                    }
+                });
+    }
 }

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/SecurityTokenReferenceImpl.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/SecurityTokenReferenceImpl.java?rev=1490977&r1=1490976&r2=1490977&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/SecurityTokenReferenceImpl.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/SecurityTokenReferenceImpl.java Sat Jun  8 13:20:18 2013
@@ -41,7 +41,7 @@ public class SecurityTokenReferenceImpl 
     public SecurityTokenReferenceImpl(InboundSecurityToken inboundSecurityToken, Deque<XMLSecEvent> xmlSecEvents,
                                       WSInboundSecurityContext wsInboundSecurityContext, String id,
                                       WSSecurityTokenConstants.KeyIdentifier keyIdentifier) {
-        super(wsInboundSecurityContext, id, keyIdentifier);
+        super(wsInboundSecurityContext, id, keyIdentifier, true);
         this.inboundSecurityToken = inboundSecurityToken;
         this.xmlSecEvents = xmlSecEvents;
     }
@@ -93,6 +93,11 @@ public class SecurityTokenReferenceImpl 
     }
 
     @Override
+    public boolean isIncludedInMessage() {
+        return inboundSecurityToken.isIncludedInMessage();
+    }
+
+    @Override
     public WSSecurityTokenConstants.TokenType getTokenType() {
         return inboundSecurityToken.getTokenType();
     }

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/UsernameSecurityTokenImpl.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/UsernameSecurityTokenImpl.java?rev=1490977&r1=1490976&r2=1490977&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/UsernameSecurityTokenImpl.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/UsernameSecurityTokenImpl.java Sat Jun  8 13:20:18 2013
@@ -56,7 +56,7 @@ public class UsernameSecurityTokenImpl e
                                      byte[] salt, Long iteration,
                                      WSInboundSecurityContext wsInboundSecurityContext, String id,
                                      WSSecurityTokenConstants.KeyIdentifier keyIdentifier) {
-        super(wsInboundSecurityContext, id, keyIdentifier);
+        super(wsInboundSecurityContext, id, keyIdentifier, true);
         this.usernameTokenPasswordType = usernameTokenPasswordType;
         this.username = username;
         this.password = password;

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509DefaultSecurityTokenImpl.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509DefaultSecurityTokenImpl.java?rev=1490977&r1=1490976&r2=1490977&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509DefaultSecurityTokenImpl.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509DefaultSecurityTokenImpl.java Sat Jun  8 13:20:18 2013
@@ -30,10 +30,13 @@ public class X509DefaultSecurityTokenImp
 
     private String alias = null;
 
-    X509DefaultSecurityTokenImpl(WSInboundSecurityContext wsInboundSecurityContext, Crypto crypto, CallbackHandler callbackHandler,
-                                 String alias, String id, WSSecurityTokenConstants.KeyIdentifier keyIdentifier,
-                                 WSSSecurityProperties securityProperties) {
-        super(WSSecurityTokenConstants.X509V3Token, wsInboundSecurityContext, crypto, callbackHandler, id, keyIdentifier, securityProperties);
+    X509DefaultSecurityTokenImpl(
+            WSInboundSecurityContext wsInboundSecurityContext, Crypto crypto, CallbackHandler callbackHandler,
+            String alias, String id, WSSecurityTokenConstants.KeyIdentifier keyIdentifier,
+            WSSSecurityProperties securityProperties) {
+
+        super(WSSecurityTokenConstants.X509V3Token, wsInboundSecurityContext, crypto, callbackHandler, id,
+                keyIdentifier, securityProperties, false);
         this.alias = alias;
     }
 

Copied: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509IssuerSerialTokenImpl.java (from r1485168, webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509DataSecurityTokenImpl.java)
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509IssuerSerialTokenImpl.java?p2=webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509IssuerSerialTokenImpl.java&p1=webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509DataSecurityTokenImpl.java&r1=1485168&r2=1490977&rev=1490977&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509DataSecurityTokenImpl.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509IssuerSerialTokenImpl.java Sat Jun  8 13:20:18 2013
@@ -22,62 +22,47 @@ import org.apache.wss4j.common.crypto.Cr
 import org.apache.wss4j.common.crypto.CryptoType;
 import org.apache.wss4j.common.ext.WSSecurityException;
 import org.apache.wss4j.stax.ext.WSInboundSecurityContext;
-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.binding.xmldsig.X509DataType;
 import org.apache.xml.security.binding.xmldsig.X509IssuerSerialType;
 import org.apache.xml.security.exceptions.XMLSecurityException;
-import org.apache.xml.security.stax.ext.XMLSecurityUtils;
-import org.apache.xml.security.stax.impl.util.UnsynchronizedByteArrayInputStream;
 
 import javax.security.auth.callback.CallbackHandler;
 import java.security.cert.X509Certificate;
 
-public class X509DataSecurityTokenImpl extends X509SecurityTokenImpl {
+public class X509IssuerSerialTokenImpl extends X509SecurityTokenImpl {
 
     private String alias = null;
-    private final X509DataType x509DataType;
+    private final X509IssuerSerialType x509IssuerSerialType;
 
-    X509DataSecurityTokenImpl(WSInboundSecurityContext wsInboundSecurityContext, Crypto crypto, CallbackHandler callbackHandler,
-                              X509DataType x509DataType, String id, WSSecurityTokenConstants.KeyIdentifier keyIdentifier,
-                              WSSSecurityProperties securityProperties) {
-        super(WSSecurityTokenConstants.X509V3Token, wsInboundSecurityContext, crypto, callbackHandler, id, keyIdentifier, securityProperties);
-        this.x509DataType = x509DataType;
+    X509IssuerSerialTokenImpl(
+            WSInboundSecurityContext wsInboundSecurityContext, Crypto crypto, CallbackHandler callbackHandler,
+            X509IssuerSerialType x509IssuerSerialType, String id, WSSSecurityProperties securityProperties)
+            throws XMLSecurityException {
+
+        super(WSSecurityTokenConstants.X509V3Token, wsInboundSecurityContext, crypto, callbackHandler, id,
+                WSSecurityTokenConstants.KeyIdentifier_IssuerSerial, securityProperties, false);
+
+        if (x509IssuerSerialType.getX509IssuerName() == null
+                || x509IssuerSerialType.getX509SerialNumber() == null) {
+            throw new WSSecurityException(WSSecurityException.ErrorCode.INVALID_SECURITY, "noKeyinfo");
+        }
+        this.x509IssuerSerialType = x509IssuerSerialType;
     }
 
     @Override
     protected String getAlias() throws XMLSecurityException {
         if (this.alias == null) {
-            X509IssuerSerialType x509IssuerSerialType = XMLSecurityUtils.getQNameType(
-                    x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName(), WSSConstants.TAG_dsig_X509IssuerSerial);
-            if (x509IssuerSerialType != null) {
-                if (x509IssuerSerialType.getX509IssuerName() == null
-                        || x509IssuerSerialType.getX509SerialNumber() == null) {
-                    throw new WSSecurityException(WSSecurityException.ErrorCode.INVALID_SECURITY);
-                }
-                CryptoType cryptoType = new CryptoType(CryptoType.TYPE.ISSUER_SERIAL);
-                cryptoType.setIssuerSerial(
-                        x509IssuerSerialType.getX509IssuerName(), x509IssuerSerialType.getX509SerialNumber()
-                );
-                X509Certificate[] certs = getCrypto().getX509Certificates(cryptoType);
-                setX509Certificates(certs);
-                if (certs == null) {
-                    throw new WSSecurityException(WSSecurityException.ErrorCode.INVALID_SECURITY);
-                }
-                return this.alias = getCrypto().getX509Identifier(certs[0]);
-            }
-            byte[] x509CertificateBytes = XMLSecurityUtils.getQNameType(
-                    x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName(), WSSConstants.TAG_dsig_X509Certificate);
-            if (x509CertificateBytes != null) {
-                X509Certificate[] certs =
-                        new X509Certificate[]{
-                                getCrypto().loadCertificate(
-                                        new UnsynchronizedByteArrayInputStream(x509CertificateBytes))
-                        };
-                setX509Certificates(certs);
-                return this.alias = getCrypto().getX509Identifier(certs[0]);
+            CryptoType cryptoType = new CryptoType(CryptoType.TYPE.ISSUER_SERIAL);
+            cryptoType.setIssuerSerial(
+                    x509IssuerSerialType.getX509IssuerName(), x509IssuerSerialType.getX509SerialNumber()
+            );
+            X509Certificate[] certs = getCrypto().getX509Certificates(cryptoType);
+            setX509Certificates(certs);
+            if (certs == null) {
+                throw new WSSecurityException(WSSecurityException.ErrorCode.INVALID_SECURITY);
             }
+            return this.alias = getCrypto().getX509Identifier(certs[0]);
         }
         return this.alias;
     }

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509PKIPathv1SecurityTokenImpl.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509PKIPathv1SecurityTokenImpl.java?rev=1490977&r1=1490976&r2=1490977&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509PKIPathv1SecurityTokenImpl.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509PKIPathv1SecurityTokenImpl.java Sat Jun  8 13:20:18 2013
@@ -43,7 +43,9 @@ public class X509PKIPathv1SecurityTokenI
             WSInboundSecurityContext wsInboundSecurityContext, Crypto crypto, CallbackHandler callbackHandler,
             byte[] binaryContent, String id, WSSecurityTokenConstants.KeyIdentifier keyIdentifier,
             WSSSecurityProperties securityProperties) throws XMLSecurityException {
-        super(WSSecurityTokenConstants.X509PkiPathV1Token, wsInboundSecurityContext, crypto, callbackHandler, id, keyIdentifier, securityProperties);
+
+        super(WSSecurityTokenConstants.X509PkiPathV1Token, wsInboundSecurityContext, crypto,
+                callbackHandler, id, keyIdentifier, securityProperties, true);
 
         InputStream in = new UnsynchronizedByteArrayInputStream(binaryContent);
         try {

Copied: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509SKISecurityTokenImpl.java (from r1485168, webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509SubjectKeyIdentifierSecurityTokenImpl.java)
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509SKISecurityTokenImpl.java?p2=webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509SKISecurityTokenImpl.java&p1=webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509SubjectKeyIdentifierSecurityTokenImpl.java&r1=1485168&r2=1490977&rev=1490977&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509SubjectKeyIdentifierSecurityTokenImpl.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509SKISecurityTokenImpl.java Sat Jun  8 13:20:18 2013
@@ -28,15 +28,17 @@ import org.apache.xml.security.exception
 import javax.security.auth.callback.CallbackHandler;
 import java.security.cert.X509Certificate;
 
-public class X509SubjectKeyIdentifierSecurityTokenImpl extends X509SecurityTokenImpl {
+public class X509SKISecurityTokenImpl extends X509SecurityTokenImpl {
 
     private String alias = null;
     private final byte[] binaryContent;
 
-    X509SubjectKeyIdentifierSecurityTokenImpl(WSInboundSecurityContext wsInboundSecurityContext, Crypto crypto, CallbackHandler callbackHandler,
-                                              byte[] binaryContent, String id, WSSecurityTokenConstants.KeyIdentifier keyIdentifier,
-                                              WSSSecurityProperties securityProperties) {
-        super(WSSecurityTokenConstants.X509V3Token, wsInboundSecurityContext, crypto, callbackHandler, id, keyIdentifier, securityProperties);
+    X509SKISecurityTokenImpl(
+            WSInboundSecurityContext wsInboundSecurityContext, Crypto crypto, CallbackHandler callbackHandler,
+            byte[] binaryContent, String id, WSSSecurityProperties securityProperties) {
+
+        super(WSSecurityTokenConstants.X509V3Token, wsInboundSecurityContext, crypto, callbackHandler, id,
+                WSSecurityTokenConstants.KeyIdentifier_SkiKeyIdentifier, securityProperties, false);
         this.binaryContent = binaryContent;
     }
 

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509SecurityTokenImpl.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509SecurityTokenImpl.java?rev=1490977&r1=1490976&r2=1490977&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509SecurityTokenImpl.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509SecurityTokenImpl.java Sat Jun  8 13:20:18 2013
@@ -45,11 +45,12 @@ public abstract class X509SecurityTokenI
     private WSSSecurityProperties securityProperties;
     private Principal principal;
 
-    protected X509SecurityTokenImpl(WSSecurityTokenConstants.TokenType tokenType, WSInboundSecurityContext wsInboundSecurityContext,
-                                    Crypto crypto, CallbackHandler callbackHandler, String id,
-                                    WSSecurityTokenConstants.KeyIdentifier keyIdentifier,
-                                    WSSSecurityProperties securityProperties) {
-        super(tokenType, wsInboundSecurityContext, id, keyIdentifier);
+    protected X509SecurityTokenImpl(
+            WSSecurityTokenConstants.TokenType tokenType, WSInboundSecurityContext wsInboundSecurityContext,
+            Crypto crypto, CallbackHandler callbackHandler, String id,
+            WSSecurityTokenConstants.KeyIdentifier keyIdentifier, WSSSecurityProperties securityProperties,
+            boolean includedInMessage) {
+        super(tokenType, wsInboundSecurityContext, id, keyIdentifier, includedInMessage);
         this.crypto = crypto;
         this.callbackHandler = callbackHandler;
         this.securityProperties = securityProperties;
@@ -59,6 +60,10 @@ public abstract class X509SecurityTokenI
         return crypto;
     }
 
+    protected void setCrypto(Crypto crypto) {
+        this.crypto = crypto;
+    }
+
     public CallbackHandler getCallbackHandler() {
         return callbackHandler;
     }

Copied: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509ThumbprintSHA1SecurityTokenImpl.java (from r1485168, webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/ThumbprintSHA1SecurityTokenImpl.java)
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509ThumbprintSHA1SecurityTokenImpl.java?p2=webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509ThumbprintSHA1SecurityTokenImpl.java&p1=webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/ThumbprintSHA1SecurityTokenImpl.java&r1=1485168&r2=1490977&rev=1490977&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/ThumbprintSHA1SecurityTokenImpl.java (original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509ThumbprintSHA1SecurityTokenImpl.java Sat Jun  8 13:20:18 2013
@@ -28,15 +28,17 @@ import org.apache.xml.security.exception
 import javax.security.auth.callback.CallbackHandler;
 import java.security.cert.X509Certificate;
 
-public class ThumbprintSHA1SecurityTokenImpl extends X509SecurityTokenImpl {
+public class X509ThumbprintSHA1SecurityTokenImpl extends X509SecurityTokenImpl {
 
     private String alias = null;
     private final byte[] binaryContent;
 
-    ThumbprintSHA1SecurityTokenImpl(WSInboundSecurityContext wsInboundSecurityContext, Crypto crypto, CallbackHandler callbackHandler,
-                                    byte[] binaryContent, String id, WSSecurityTokenConstants.KeyIdentifier keyIdentifier,
-                                    WSSSecurityProperties securityProperties) {
-        super(WSSecurityTokenConstants.X509V3Token, wsInboundSecurityContext, crypto, callbackHandler, id, keyIdentifier, securityProperties);
+    X509ThumbprintSHA1SecurityTokenImpl(
+            WSInboundSecurityContext wsInboundSecurityContext, Crypto crypto, CallbackHandler callbackHandler,
+            byte[] binaryContent, String id, WSSSecurityProperties securityProperties) {
+
+        super(WSSecurityTokenConstants.X509V3Token, wsInboundSecurityContext, crypto, callbackHandler, id,
+                WSSecurityTokenConstants.KeyIdentifier_ThumbprintIdentifier, securityProperties, false);
         this.binaryContent = binaryContent;
     }
 



Mime
View raw message