ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1665842 - in /webservices/wss4j/trunk: ws-security-common/src/main/resources/messages/ ws-security-dom/src/main/java/org/apache/wss4j/dom/action/ ws-security-dom/src/main/java/org/apache/wss4j/dom/handler/
Date Wed, 11 Mar 2015 10:56:56 GMT
Author: coheigea
Date: Wed Mar 11 10:56:55 2015
New Revision: 1665842

URL: http://svn.apache.org/r1665842
Log:
More minor refactoring

Modified:
    webservices/wss4j/trunk/ws-security-common/src/main/resources/messages/wss4j_errors.properties
    webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SignatureAction.java
    webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/UsernameTokenAction.java
    webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/UsernameTokenSignedAction.java
    webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/handler/WSHandler.java

Modified: webservices/wss4j/trunk/ws-security-common/src/main/resources/messages/wss4j_errors.properties
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/resources/messages/wss4j_errors.properties?rev=1665842&r1=1665841&r2=1665842&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/resources/messages/wss4j_errors.properties
(original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/resources/messages/wss4j_errors.properties
Wed Mar 11 10:56:55 2015
@@ -72,6 +72,7 @@ noSKIHandling = Problem with SKI informa
 notASOAPMessage = Request is not a valid SOAP Message
 noToken = Referenced Token \"{0}\" not found
 noTokenUser = Token user is not set
+noUser = User is not set
 noUserCertsFound = No certificates for user {0} were found for {1}
 noXMLSig = Cannot setup signature data structure
 parseError = Cannot parse/decode the certificate data

Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SignatureAction.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SignatureAction.java?rev=1665842&r1=1665841&r2=1665842&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SignatureAction.java
(original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SignatureAction.java
Wed Mar 11 10:56:55 2015
@@ -81,6 +81,8 @@ public class SignatureAction implements
             wsSign.setSecretKey(passwordCallback.getKey());
         } else if (signatureToken.getKey() != null) {
             wsSign.setSecretKey(signatureToken.getKey());
+        } else if (signatureToken.getUser() == null) {
+            throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "noSignatureUser");
         }
         
         if (signatureToken.getTokenId() != null) {

Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/UsernameTokenAction.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/UsernameTokenAction.java?rev=1665842&r1=1665841&r2=1665842&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/UsernameTokenAction.java
(original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/UsernameTokenAction.java
Wed Mar 11 10:56:55 2015
@@ -45,6 +45,10 @@ public class UsernameTokenAction impleme
             username = passwordCallback.getIdentifier();
             password = passwordCallback.getPassword();
         }
+        
+        if (username == null) {
+            throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "noUser");
+        }
 
         WSSecUsernameToken builder = new WSSecUsernameToken(reqData.getWssConfig());
         builder.setPasswordType(reqData.getPwType());

Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/UsernameTokenSignedAction.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/UsernameTokenSignedAction.java?rev=1665842&r1=1665841&r2=1665842&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/UsernameTokenSignedAction.java
(original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/UsernameTokenSignedAction.java
Wed Mar 11 10:56:55 2015
@@ -55,6 +55,10 @@ public class UsernameTokenSignedAction i
         WSPasswordCallback passwordCallback = 
             handler.getPasswordCB(reqData.getUsername(), WSConstants.UT_SIGN, callbackHandler,
reqData);
 
+        if (reqData.getUsername() == null) {
+            throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "noUser");
+        }
+        
         WSSecUsernameToken builder = new WSSecUsernameToken(reqData.getWssConfig());
         
         int iterations = reqData.getDerivedKeyIterations();

Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/handler/WSHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/handler/WSHandler.java?rev=1665842&r1=1665841&r2=1665842&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/handler/WSHandler.java
(original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/handler/WSHandler.java
Wed Mar 11 10:56:55 2015
@@ -39,7 +39,6 @@ import javax.security.auth.callback.Call
 import org.apache.wss4j.dom.WSConstants;
 import org.apache.wss4j.dom.WSSConfig;
 import org.apache.wss4j.dom.WSSecurityEngineResult;
-import org.apache.wss4j.dom.action.Action;
 import org.apache.wss4j.common.EncryptionActionToken;
 import org.apache.wss4j.common.SignatureActionToken;
 import org.apache.wss4j.common.SignatureEncryptionActionToken;
@@ -169,10 +168,7 @@ public abstract class WSHandler {
             reqData.setSignatureToken(signatureToken);
         }
         if (signatureToken.getParts().isEmpty()) {
-            WSEncryptionPart encP = new WSEncryptionPart(reqData.getSoapConstants()
-                    .getBodyQName().getLocalPart(), reqData.getSoapConstants()
-                    .getEnvelopeURI(), "Content");
-            signatureToken.getParts().add(encP);
+            signatureToken.getParts().add(WSSecurityUtil.getDefaultEncryptionPart(doc));
         }
         /*
          * If SignatureConfirmation is enabled and this is a response then
@@ -214,38 +210,9 @@ public abstract class WSHandler {
                 LOG.debug("Performing Action: " + actionToDo.getAction());
             }
 
-            switch (actionToDo.getAction()) {
-            case WSConstants.UT:
-            case WSConstants.ENCR:
-            case WSConstants.SIGN:
-            case WSConstants.DKT_SIGN:
-            case WSConstants.DKT_ENCR:
-            case WSConstants.ST_SIGNED:
-            case WSConstants.ST_UNSIGNED:
-            case WSConstants.TS:
-            case WSConstants.UT_SIGN:
-            case WSConstants.CUSTOM_TOKEN:
+            if (WSConstants.NO_SECURITY != actionToDo.getAction()) {
                 wssConfig.getAction(actionToDo.getAction()).execute(
                     this, actionToDo.getActionToken(), doc, reqData);
-                break;
-                //
-                // Handle any "custom" actions, similarly,
-                // but to preserve behavior from previous
-                // versions, consume (but LOG. action lookup failures.
-                //
-            default:
-                Action doit = null;
-            try {
-                doit = wssConfig.getAction(actionToDo.getAction());
-            } catch (final WSSecurityException e) {
-                LOG.warn(
-                        "Error trying to locate a custom action (" + actionToDo + ")", 
-                        e
-                );
-            }
-            if (doit != null) {
-                doit.execute(this, actionToDo.getActionToken(), doc, reqData);
-            }
             }
         }
         



Mime
View raw message