ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1531959 - /webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/OutboundWSSec.java
Date Mon, 14 Oct 2013 16:06:30 GMT
Author: coheigea
Date: Mon Oct 14 16:06:29 2013
New Revision: 1531959

URL: http://svn.apache.org/r1531959
Log:
A fix for an AsymmetricBinding IssuedToken case

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

Modified: webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/OutboundWSSec.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/OutboundWSSec.java?rev=1531959&r1=1531958&r2=1531959&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/OutboundWSSec.java
(original)
+++ webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/OutboundWSSec.java
Mon Oct 14 16:06:29 2013
@@ -381,10 +381,18 @@ public class OutboundWSSec {
             if (signatureAlgorithm.contains("hmac-sha")
                 && securityToken.getSecretKey(signatureAlgorithm) != null) {
                 return;
-            } else if (!signatureAlgorithm.contains("hmac-sha")
-                && (securityToken.getPublicKey() != null
-                    || securityToken.getX509Certificates() != null)) {
-                return;
+            } else if (!signatureAlgorithm.contains("hmac-sha") && securityToken.getX509Certificates()
!= null) {
+                if (securityToken.getSecretKey(signatureAlgorithm) != null) {
+                    return;
+                } else {
+                    // We have certs but no private key set. Use the CallbackHandler
+                    Key key = 
+                        securityProperties.getSignatureCrypto().getPrivateKey(
+                            securityToken.getX509Certificates()[0], securityProperties.getCallbackHandler()
+                        );
+                    securityToken.setSecretKey(signatureAlgorithm, key);
+                    return;
+                }
             }
         }
         



Mime
View raw message