cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r736125 - in /cxf/trunk: api/src/main/java/org/apache/cxf/phase/AbstractPhaseInterceptor.java rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
Date Tue, 20 Jan 2009 21:56:57 GMT
Author: dkulp
Date: Tue Jan 20 13:56:57 2009
New Revision: 736125

URL: http://svn.apache.org/viewvc?rev=736125&view=rev
Log:
Fix some issues with symetric binding and endorsed tokens

Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/phase/AbstractPhaseInterceptor.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/phase/AbstractPhaseInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/phase/AbstractPhaseInterceptor.java?rev=736125&r1=736124&r2=736125&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/phase/AbstractPhaseInterceptor.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/phase/AbstractPhaseInterceptor.java Tue Jan
20 13:56:57 2009
@@ -26,6 +26,7 @@
 
 import org.apache.cxf.common.util.SortedArraySet;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageUtils;
 
 public abstract class AbstractPhaseInterceptor<T extends Message> implements PhaseInterceptor<T>
{
     private final String id;
@@ -103,8 +104,7 @@
     }
     
     protected boolean isRequestor(T message) {
-        return Boolean.TRUE.equals(message.containsKey(
-            org.apache.cxf.message.Message.REQUESTOR_ROLE));
+        return MessageUtils.isRequestor(message);
     }  
 
 }

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java?rev=736125&r1=736124&r2=736125&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
Tue Jan 20 13:56:57 2009
@@ -61,6 +61,7 @@
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.helpers.MapNamespaceContext;
+import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.resource.ResourceManager;
 import org.apache.cxf.ws.policy.AssertionInfo;
 import org.apache.cxf.ws.policy.AssertionInfoMap;
@@ -232,9 +233,9 @@
     }
     
     protected boolean isRequestor() {
-        return Boolean.TRUE.equals(message.containsKey(
-            org.apache.cxf.message.Message.REQUESTOR_ROLE));
-    }  
+        return MessageUtils.isRequestor(message);
+    }
+    
     protected void policyNotAsserted(PolicyAssertion assertion, Exception reason) {
         if (assertion == null) {
             return;
@@ -1032,30 +1033,35 @@
         Crypto crypto = encryptCrypto ? getEncryptionCrypto(wrapper) 
             : getSignatureCrypto(wrapper);
         
+        if (endorse && crypto == null && binding instanceof SymmetricBinding)
{
+            userNameKey = SecurityConstants.ENCRYPT_USERNAME;
+            crypto = getEncryptionCrypto(wrapper);
+        }
         
         if (!endorse) {
             message.getExchange().put(SecurityConstants.SIGNATURE_CRYPTO, crypto);
         }
         String user = (String)message.getContextualProperty(userNameKey);
-        if (StringUtils.isEmpty(user)) {
-            user = crypto.getDefaultX509Alias();
-        }
-        if (user == null) {
-            try {
-                Enumeration<String> en = crypto.getKeyStore().aliases();
-                if (en.hasMoreElements()) {
-                    user = en.nextElement();
+        if (crypto != null) {
+            if (StringUtils.isEmpty(user)) {
+                user = crypto.getDefaultX509Alias();
+            }
+            if (user == null) {
+                try {
+                    Enumeration<String> en = crypto.getKeyStore().aliases();
+                    if (en.hasMoreElements()) {
+                        user = en.nextElement();
+                    }
+                    if (en.hasMoreElements()) {
+                        //more than one alias in the keystore, user WILL need
+                        //to specify
+                        user = null;
+                    }            
+                } catch (KeyStoreException e) {
+                    //ignore
                 }
-                if (en.hasMoreElements()) {
-                    //more than one alias in the keystore, user WILL need
-                    //to specify
-                    user = null;
-                }            
-            } catch (KeyStoreException e) {
-                //ignore
             }
         }
-                
         if (StringUtils.isEmpty(user)) {
             policyNotAsserted(token, "No " + type + " username found.");
         }



Mime
View raw message