cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1560364 - in /cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers: AbstractStaxBindingHandler.java StaxAsymmetricBindingHandler.java StaxSymmetricBindingHandler.java StaxTransportBindingHandler.java
Date Wed, 22 Jan 2014 14:40:50 GMT
Author: coheigea
Date: Wed Jan 22 14:40:49 2014
New Revision: 1560364

URL: http://svn.apache.org/r1560364
Log:
Add the ability to use SecurityTokenReferences returned by an STS in the streaming layer

Modified:
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractStaxBindingHandler.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxAsymmetricBindingHandler.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxSymmetricBindingHandler.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxTransportBindingHandler.java

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractStaxBindingHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractStaxBindingHandler.java?rev=1560364&r1=1560363&r2=1560364&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractStaxBindingHandler.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractStaxBindingHandler.java
Wed Jan 22 14:40:49 2014
@@ -382,7 +382,7 @@ public abstract class AbstractStaxBindin
         return null;
     }
     
-    protected void storeSecurityToken(SecurityToken tok) {
+    protected void storeSecurityToken(AbstractToken policyToken, SecurityToken tok) {
         SecurityTokenConstants.TokenType tokenType = WSSecurityTokenConstants.EncryptedKeyToken;
         if (tok.getTokenType() != null) {
             if (tok.getTokenType().startsWith(WSSConstants.NS_KERBEROS11_TOKEN_PROFILE))
{
@@ -425,7 +425,18 @@ public abstract class AbstractStaxBindin
                     return super.getSecretKey(algorithmURI);
                 }
             };
-        
+            
+        // Store a DOM Element reference if it exists
+        Element ref;
+        if (isTokenRequired(policyToken.getIncludeTokenType())) {
+            ref = tok.getAttachedReference();
+        } else {
+            ref = tok.getUnattachedReference();
+        }
+
+        if (ref != null && policyToken instanceof IssuedToken) {
+            encryptedKeySecurityToken.setCustomTokenReference(ref);
+        }
         final SecurityTokenProvider<OutboundSecurityToken> encryptedKeySecurityTokenProvider
=
             new SecurityTokenProvider<OutboundSecurityToken>() {
 

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxAsymmetricBindingHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxAsymmetricBindingHandler.java?rev=1560364&r1=1560363&r2=1560364&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxAsymmetricBindingHandler.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxAsymmetricBindingHandler.java
Wed Jan 22 14:40:49 2014
@@ -131,7 +131,7 @@ public class StaxAsymmetricBindingHandle
                         customTokenAdded = true;
                     }
                     if (sigTok != null) {
-                        storeSecurityToken(sigTok);
+                        storeSecurityToken(initiatorToken, sigTok);
                         outboundTokens.remove(WSSConstants.PROP_USE_THIS_TOKEN_ID_FOR_ENCRYPTION);

                     }
                     
@@ -272,7 +272,7 @@ public class StaxAsymmetricBindingHandle
                     }
                     
                     if (sigTok != null) {
-                        storeSecurityToken(sigTok);
+                        storeSecurityToken(initiatorToken, sigTok);
                         outboundTokens.remove(WSSConstants.PROP_USE_THIS_TOKEN_ID_FOR_ENCRYPTION);

                     }
                     

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxSymmetricBindingHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxSymmetricBindingHandler.java?rev=1560364&r1=1560363&r2=1560364&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxSymmetricBindingHandler.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxSymmetricBindingHandler.java
Wed Jan 22 14:40:49 2014
@@ -215,7 +215,7 @@ public class StaxSymmetricBindingHandler
             
             // Store key
             if (!(MessageUtils.isRequestor(message) && encryptionToken instanceof
KerberosToken)) {
-                storeSecurityToken(tok);
+                storeSecurityToken(encryptionToken, tok);
             }
             
             List<SecurePart> encrParts = null;
@@ -352,7 +352,7 @@ public class StaxSymmetricBindingHandler
             
             // Store key
             if (!(MessageUtils.isRequestor(message) && sigToken instanceof KerberosToken))
{
-                storeSecurityToken(sigTok);
+                storeSecurityToken(sigToken, sigTok);
             }
 
             // Add timestamp

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxTransportBindingHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxTransportBindingHandler.java?rev=1560364&r1=1560363&r2=1560364&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxTransportBindingHandler.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxTransportBindingHandler.java
Wed Jan 22 14:40:49 2014
@@ -310,7 +310,7 @@ public class StaxTransportBindingHandler
             
             WSSSecurityProperties properties = getProperties();
             if (securityToken != null) {
-                storeSecurityToken(securityToken);
+                storeSecurityToken(token, securityToken);
                 
                 // Set up CallbackHandler which wraps the configured Handler
                 TokenStoreCallbackHandler callbackHandler = 



Mime
View raw message