ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1486920 - /webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ConfigurationConverter.java
Date Tue, 28 May 2013 13:42:58 GMT
Author: coheigea
Date: Tue May 28 13:42:57 2013
New Revision: 1486920

URL: http://svn.apache.org/r1486920
Log:
Fall back to using the default Crypto X509 Identifier for the signature user, if none is specified

Modified:
    webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ConfigurationConverter.java

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ConfigurationConverter.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ConfigurationConverter.java?rev=1486920&r1=1486919&r2=1486920&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ConfigurationConverter.java
(original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ConfigurationConverter.java
Tue May 28 13:42:57 2013
@@ -33,6 +33,7 @@ import org.apache.wss4j.common.crypto.Cr
 import org.apache.wss4j.common.ext.WSSecurityException;
 import org.apache.wss4j.common.util.Loader;
 import org.apache.wss4j.common.util.StringUtil;
+import org.apache.wss4j.stax.ext.WSSConfigurationException;
 import org.apache.wss4j.stax.ext.WSSConstants;
 import org.apache.wss4j.stax.ext.WSSConstants.UsernameTokenPasswordType;
 import org.apache.wss4j.stax.ext.WSSSecurityProperties;
@@ -147,6 +148,9 @@ public final class ConfigurationConverte
                 foundSigRef = true;
                 properties.setSignatureCryptoProperties((Properties)sigRef);
             }
+            if (foundSigRef && properties.getSignatureUser() == null) {
+                properties.setSignatureUser(getDefaultX509Identifier(properties));
+            }
         }
         
         if (!foundSigRef) {
@@ -156,6 +160,9 @@ public final class ConfigurationConverte
                     Properties sigProperties = 
                         CryptoFactory.getProperties(sigPropFile, getClassLoader());
                     properties.setSignatureCryptoProperties(sigProperties);
+                    if (properties.getSignatureUser() == null) {
+                        properties.setSignatureUser(getDefaultX509Identifier(properties));
+                    }
                 } catch (WSSecurityException e) {
                     log.error(e.getMessage(), e);
                 }
@@ -241,6 +248,20 @@ public final class ConfigurationConverte
         }
     }
     
+    private static String getDefaultX509Identifier(
+        WSSSecurityProperties properties
+    ) {
+        try {
+            Crypto sigCrypto = properties.getSignatureCrypto();
+            return sigCrypto.getDefaultX509Identifier();
+        } catch (WSSConfigurationException e) {
+            log.debug(e.getMessage(), e);
+        } catch (WSSecurityException e) {
+            log.debug(e.getMessage(), e);
+        }
+        return null;
+    }
+    
     private static void parseCallback(
         Map<String, Object> config, 
         WSSSecurityProperties properties



Mime
View raw message