[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wss4j-dev
Subject:    svn commit: r264767 - in /webservices/wss4j/trunk/src/org/apache/ws:
From:       werner () apache ! org
Date:       2005-08-30 12:25:32
Message-ID: 20050830122532.42205.qmail () minotaur ! apache ! org
[Download RAW message or body]

Author: werner
Date: Tue Aug 30 05:25:25 2005
New Revision: 264767

URL: http://svn.apache.org/viewcvs?rev=264767&view=rev
Log:
Put common code of WSDoAllSender and WSS4JHandler into the abstract
WSHandler class.

Modified:
    webservices/wss4j/trunk/src/org/apache/ws/axis/security/WSDoAllSender.java
    webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSHandler.java
    webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSS4JHandler.java

Modified: webservices/wss4j/trunk/src/org/apache/ws/axis/security/WSDoAllSender.java
URL: http://svn.apache.org/viewcvs/webservices/wss4j/trunk/src/org/apache/ws/axis/security/WSDoAllSender.java?rev=264767&r1=264766&r2=264767&view=diff
 ==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/axis/security/WSDoAllSender.java \
                (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/axis/security/WSDoAllSender.java Tue \
Aug 30 05:25:25 2005 @@ -161,93 +161,7 @@
                                     + e);
                 }
             }
-            reqData.setSoapConstants(WSSecurityUtil.getSOAPConstants(doc
-                    .getDocumentElement()));
-            /*
-                * Here we have action, username, password, and actor,
-                * mustUnderstand. Now get the action specific parameters.
-                */
-            if ((doAction & WSConstants.UT) == WSConstants.UT) {
-                decodeUTParameter(reqData);
-            }
-            /*
-                * Here we have action, username, password, and actor,
-                * mustUnderstand. Now get the action specific parameters.
-                */
-            if ((doAction & WSConstants.UT_SIGN) == WSConstants.UT_SIGN) {
-                decodeUTParameter(reqData);
-                decodeSignatureParameter(reqData);
-            }
-            /*
-                * Get and check the Signature specific parameters first because
-                * they may be used for encryption too.
-                */
-            if ((doAction & WSConstants.SIGN) == WSConstants.SIGN) {
-                reqData.setSigCrypto(loadSignatureCrypto(reqData));
-                decodeSignatureParameter(reqData);
-            }
-            /*
-                * If we need to handle signed SAML token then we need may of the
-                * Signature parameters. The handle procedure loads the signature
-                * crypto file on demand, thus don't do it here.
-                */
-            if ((doAction & WSConstants.ST_SIGNED) == WSConstants.ST_SIGNED) {
-                decodeSignatureParameter(reqData);
-            }
-            /*
-                * Set and check the encryption specific parameters, if necessary
-                * take over signature parameters username and crypto instance.
-                */
-            if ((doAction & WSConstants.ENCR) == WSConstants.ENCR) {
-                reqData.setEncCrypto(loadEncryptionCrypto(reqData));
-                decodeEncryptionParameter(reqData);
-            }
-            /*
-                * Here we have all necessary information to perform the requested
-                * action(s).
-                */
-            for (int i = 0; i < actions.size(); i++) {
-
-                int actionToDo = ((Integer) actions.get(i)).intValue();
-                if (doDebug) {
-                    log.debug("Performing Action: " + actionToDo);
-                }
-
-                String password = null;
-                switch (actionToDo) {
-                case WSConstants.UT:
-                    performUTAction(actionToDo, mu, doc, reqData);
-                    break;
-
-                case WSConstants.ENCR:
-                    performENCRAction(mu, actionToDo, doc, reqData);
-                    break;
-
-                case WSConstants.SIGN:
-                    performSIGNAction(actionToDo, mu, doc, reqData);
-                    break;
-
-                case WSConstants.ST_SIGNED:
-                    performST_SIGNAction(actionToDo, mu, doc, reqData);
-                    break;
-
-                case WSConstants.ST_UNSIGNED:
-                    performSTAction(actionToDo, mu, doc, reqData);
-                    break;
-
-                case WSConstants.TS:
-                    performTSAction(actionToDo, mu, doc, reqData);
-                    break;
-
-                case WSConstants.UT_SIGN:
-                    performUT_SIGNAction(actionToDo, mu, doc, reqData);
-                    break;
-
-                case WSConstants.NO_SERIALIZE:
-                    reqData.setNoSerialization(true);
-                    break;
-                }
-            }
+            doSenderAction(doAction, mu, doc, reqData, actions);
 
             /*
                 * If required convert the resulting document into a message first.

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSHandler.java
URL: http://svn.apache.org/viewcvs/webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSHandler.java?rev=264767&r1=264766&r2=264767&view=diff
 ==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSHandler.java \
                (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSHandler.java Tue Aug \
30 05:25:25 2005 @@ -60,6 +60,111 @@
     protected static boolean doDebug = true;
     protected static Hashtable cryptos = new Hashtable(5);
 
+    
+    /**
+     * Performs all defined security actions to set-up the SOAP request.
+     * 
+     * 
+     * @param doAction a set defining the actions to do 
+     * @param mu	if true set the musetUnderstand flag to true in the SOAP 
+     * 				request
+     * @param doc   the request as DOM document 
+     * @param reqData a data storage to pass values around bewteen methods
+     * @param actions a vector holding the actions to do in the order defined in
+     *                the deployment file or property
+     * @throws WSSecurityException
+     */
+    protected void doSenderAction(int doAction, boolean mu, Document doc,
+			RequestData reqData, Vector actions) throws WSSecurityException {
+
+		reqData.setSoapConstants(WSSecurityUtil.getSOAPConstants(doc
+				.getDocumentElement()));
+		/*
+		 * Here we have action, username, password, and actor, mustUnderstand.
+		 * Now get the action specific parameters.
+		 */
+		if ((doAction & WSConstants.UT) == WSConstants.UT) {
+			decodeUTParameter(reqData);
+		}
+		/*
+		 * Here we have action, username, password, and actor, mustUnderstand.
+		 * Now get the action specific parameters.
+		 */
+		if ((doAction & WSConstants.UT_SIGN) == WSConstants.UT_SIGN) {
+			decodeUTParameter(reqData);
+			decodeSignatureParameter(reqData);
+		}
+		/*
+		 * Get and check the Signature specific parameters first because they
+		 * may be used for encryption too.
+		 */
+		if ((doAction & WSConstants.SIGN) == WSConstants.SIGN) {
+			reqData.setSigCrypto(loadSignatureCrypto(reqData));
+			decodeSignatureParameter(reqData);
+		}
+		/*
+		 * If we need to handle signed SAML token then we need may of the
+		 * Signature parameters. The handle procedure loads the signature crypto
+		 * file on demand, thus don't do it here.
+		 */
+		if ((doAction & WSConstants.ST_SIGNED) == WSConstants.ST_SIGNED) {
+			decodeSignatureParameter(reqData);
+		}
+		/*
+		 * Set and check the encryption specific parameters, if necessary take
+		 * over signature parameters username and crypto instance.
+		 */
+		if ((doAction & WSConstants.ENCR) == WSConstants.ENCR) {
+			reqData.setEncCrypto(loadEncryptionCrypto(reqData));
+			decodeEncryptionParameter(reqData);
+		}
+		/*
+		 * Here we have all necessary information to perform the requested
+		 * action(s).
+		 */
+		for (int i = 0; i < actions.size(); i++) {
+
+			int actionToDo = ((Integer) actions.get(i)).intValue();
+			if (doDebug) {
+				log.debug("Performing Action: " + actionToDo);
+			}
+
+			switch (actionToDo) {
+			case WSConstants.UT:
+				performUTAction(actionToDo, mu, doc, reqData);
+				break;
+
+			case WSConstants.ENCR:
+				performENCRAction(actionToDo, mu, doc, reqData);
+				break;
+
+			case WSConstants.SIGN:
+				performSIGNAction(actionToDo, mu, doc, reqData);
+				break;
+
+			case WSConstants.ST_SIGNED:
+				performST_SIGNAction(actionToDo, mu, doc, reqData);
+				break;
+
+			case WSConstants.ST_UNSIGNED:
+				performSTAction(actionToDo, mu, doc, reqData);
+				break;
+
+			case WSConstants.TS:
+				performTSAction(actionToDo, mu, doc, reqData);
+				break;
+
+			case WSConstants.UT_SIGN:
+				performUT_SIGNAction(actionToDo, mu, doc, reqData);
+				break;
+
+			case WSConstants.NO_SERIALIZE:
+				reqData.setNoSerialization(true);
+				break;
+			}
+		}
+	}
+    
     protected void performSIGNAction(int actionToDo, boolean mu, Document doc, \
RequestData reqData)  throws WSSecurityException {
         String password;
@@ -90,7 +195,7 @@
         }
     }
 
-    protected void performENCRAction(boolean mu, int actionToDo, Document doc, \
RequestData reqData) +    protected void performENCRAction(int actionToDo, boolean \
mu, Document doc, RequestData reqData)  throws WSSecurityException {
         WSEncryptBody wsEncrypt = new WSEncryptBody(reqData.getActor(), mu);
         if (reqData.getEncKeyId() != 0) {

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSS4JHandler.java
                
URL: http://svn.apache.org/viewcvs/webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSS4JHandler.java?rev=264767&r1=264766&r2=264767&view=diff
 ==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSS4JHandler.java \
                (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSS4JHandler.java Tue \
Aug 30 05:25:25 2005 @@ -264,93 +264,7 @@
             log.debug("WSS4JHandler: orginal SOAP request: ");
             log.debug(org.apache.ws.security.util.XMLUtils.PrettyDocumentToString(doc));
  }
-
-        reqData.setSoapConstants(
-                WSSecurityUtil.getSOAPConstants(doc.getDocumentElement()));
-        /*
-        * Here we have action, username, password, and actor, mustUnderstand.
-        * Now get the action specific parameters.
-        */
-        if ((doAction & WSConstants.UT) == WSConstants.UT) {
-            decodeUTParameter(reqData);
-        }
-        /*
-        * Here we have action, username, password, and actor, mustUnderstand.
-        * Now get the action specific parameters.
-        */
-        if ((doAction & WSConstants.UT_SIGN) == WSConstants.UT_SIGN) {
-            decodeUTParameter(reqData);
-            decodeSignatureParameter(reqData);
-        }
-        /*
-        * Get and check the Signature specific parameters first because they
-        * may be used for encryption too.
-        */
-        if ((doAction & WSConstants.SIGN) == WSConstants.SIGN) {
-            reqData.setSigCrypto(loadSignatureCrypto(reqData));
-            decodeSignatureParameter(reqData);
-        }
-        /*
-        * If we need to handle signed SAML token then we need may of the
-        * Signature parameters. The handle procedure loads the signature
-        * crypto file on demand, thus don't do it here.
-        */
-        if ((doAction & WSConstants.ST_SIGNED) == WSConstants.ST_SIGNED) {
-            decodeSignatureParameter(reqData);
-        }
-        /*
-        * Set and check the encryption specific parameters, if necessary take
-        * over signature parameters username and crypto instance.
-        */
-        if ((doAction & WSConstants.ENCR) == WSConstants.ENCR) {
-            reqData.setEncCrypto(loadEncryptionCrypto(reqData));
-            decodeEncryptionParameter(reqData);
-        }
-        /*
-        * Here we have all necessary information to perform the requested
-        * action(s).
-        */
-        for (int i = 0; i < actions.size(); i++) {
-
-            int actionToDo = ((Integer) actions.get(i)).intValue();
-            if (doDebug) {
-                log.debug("Performing Action: " + actionToDo);
-            }
-
-            switch (actionToDo) {
-                case WSConstants.UT:
-                    performUTAction(actionToDo, mu, doc, reqData);
-                    break;
-
-                case WSConstants.ENCR:
-                    performENCRAction(mu, actionToDo, doc, reqData);
-                    break;
-
-                case WSConstants.SIGN:
-                    performSIGNAction(actionToDo, mu, doc, reqData);
-                    break;
-
-                case WSConstants.ST_SIGNED:
-                    performST_SIGNAction(actionToDo, mu, doc, reqData);
-                    break;
-
-                case WSConstants.ST_UNSIGNED:
-                    performSTAction(actionToDo, mu, doc, reqData);
-                    break;
-
-                case WSConstants.TS:
-                    performTSAction(actionToDo, mu, doc, reqData);
-                    break;
-
-                case WSConstants.UT_SIGN:
-                    performUT_SIGNAction(actionToDo, mu, doc, reqData);
-                    break;
-
-                case WSConstants.NO_SERIALIZE:
-                    reqData.setNoSerialization(true);
-                    break;
-            }
-        }
+        doSenderAction(doAction, mu, doc, reqData, actions);
 
         /*
         * If required convert the resulting document into a message first. The



---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic