You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by di...@apache.org on 2005/08/17 18:59:10 UTC

cvs commit: ws-wss4j/src/org/apache/ws/axis/security/util AxisUtil.java

dims        2005/08/17 09:59:10

  Modified:    src/org/apache/ws/axis/security WSDoAllReceiver.java
                        WSDoAllSender.java
               src/org/apache/ws/security/util WSSecurityUtil.java
  Removed:     src/org/apache/ws/axis/security/util AxisUtil.java
  Log:
  Move useful code to WSSecurityUtil and remove AxisUtil
  
  Revision  Changes    Path
  1.28      +1 -2      ws-wss4j/src/org/apache/ws/axis/security/WSDoAllReceiver.java
  
  Index: WSDoAllReceiver.java
  ===================================================================
  RCS file: /home/cvs/ws-wss4j/src/org/apache/ws/axis/security/WSDoAllReceiver.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- WSDoAllReceiver.java	17 Aug 2005 03:19:46 -0000	1.27
  +++ WSDoAllReceiver.java	17 Aug 2005 16:59:10 -0000	1.28
  @@ -29,7 +29,6 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   import org.apache.ws.axis.security.handler.WSDoAllHandler;
  -import org.apache.ws.axis.security.util.AxisUtil;
   import org.apache.ws.security.SOAPConstants;
   import org.apache.ws.security.WSConstants;
   import org.apache.ws.security.WSSecurityEngineResult;
  @@ -90,7 +89,7 @@
               if (action == null) {
                   throw new AxisFault("WSDoAllReceiver: No action defined");
               }
  -            int doAction = AxisUtil.decodeAction(action, actions);
  +            int doAction = WSSecurityUtil.decodeAction(action, actions);
   
               String actor = (String) getOption(WSHandlerConstants.ACTOR);
   
  
  
  
  1.35      +1 -2      ws-wss4j/src/org/apache/ws/axis/security/WSDoAllSender.java
  
  Index: WSDoAllSender.java
  ===================================================================
  RCS file: /home/cvs/ws-wss4j/src/org/apache/ws/axis/security/WSDoAllSender.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- WSDoAllSender.java	17 Aug 2005 03:19:46 -0000	1.34
  +++ WSDoAllSender.java	17 Aug 2005 16:59:10 -0000	1.35
  @@ -24,7 +24,6 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   import org.apache.ws.axis.security.handler.WSDoAllHandler;
  -import org.apache.ws.axis.security.util.AxisUtil;
   import org.apache.ws.security.WSConstants;
   import org.apache.ws.security.WSSecurityException;
   import org.apache.ws.security.handler.RequestData;
  @@ -78,7 +77,7 @@
               if (action == null) {
                   throw new AxisFault("WSDoAllSender: No action defined");
               }
  -            int doAction = AxisUtil.decodeAction(action, actions);
  +            int doAction = WSSecurityUtil.decodeAction(action, actions);
               if (doAction == WSConstants.NO_SECURITY) {
                   return;
               }
  
  
  
  1.29      +46 -0     ws-wss4j/src/org/apache/ws/security/util/WSSecurityUtil.java
  
  Index: WSSecurityUtil.java
  ===================================================================
  RCS file: /home/cvs/ws-wss4j/src/org/apache/ws/security/util/WSSecurityUtil.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- WSSecurityUtil.java	8 Jul 2005 19:07:59 -0000	1.28
  +++ WSSecurityUtil.java	17 Aug 2005 16:59:10 -0000	1.29
  @@ -27,11 +27,13 @@
   import org.apache.ws.security.WSSConfig;
   import org.apache.ws.security.WSSecurityEngineResult;
   import org.apache.ws.security.WSSecurityException;
  +import org.apache.ws.security.handler.WSHandlerConstants;
   import org.apache.ws.security.message.token.BinarySecurity;
   import org.apache.ws.security.message.token.X509Security;
   import org.apache.xml.security.algorithms.JCEMapper;
   import org.apache.xml.security.utils.Base64;
   import org.apache.xpath.XPathAPI;
  +import org.apache.axis.AxisFault;
   import org.w3c.dom.Attr;
   import org.w3c.dom.Document;
   import org.w3c.dom.Element;
  @@ -927,4 +929,48 @@
   
           return wsResult;
       }
  +
  +    static public int decodeAction(String action, Vector actions)
  +            throws AxisFault {
  +
  +        int doAction = 0;
  +
  +        if (action == null) {
  +            return doAction;
  +        }
  +        String single[] = StringUtil.split(action, ' ');
  +        for (int i = 0; i < single.length; i++) {
  +            if (single[i].equals(WSHandlerConstants.NO_SECURITY)) {
  +                doAction = WSConstants.NO_SECURITY;
  +                return doAction;
  +            } else if (single[i].equals(WSHandlerConstants.USERNAME_TOKEN)) {
  +                doAction |= WSConstants.UT;
  +                actions.add(new Integer(WSConstants.UT));
  +            } else if (single[i].equals(WSHandlerConstants.SIGNATURE)) {
  +                doAction |= WSConstants.SIGN;
  +                actions.add(new Integer(WSConstants.SIGN));
  +            } else if (single[i].equals(WSHandlerConstants.ENCRYPT)) {
  +                doAction |= WSConstants.ENCR;
  +                actions.add(new Integer(WSConstants.ENCR));
  +            } else if (single[i].equals(WSHandlerConstants.SAML_TOKEN_UNSIGNED)) {
  +                doAction |= WSConstants.ST_UNSIGNED;
  +                actions.add(new Integer(WSConstants.ST_UNSIGNED));
  +            } else if (single[i].equals(WSHandlerConstants.SAML_TOKEN_SIGNED)) {
  +                doAction |= WSConstants.ST_SIGNED;
  +                actions.add(new Integer(WSConstants.ST_SIGNED));
  +            } else if (single[i].equals(WSHandlerConstants.TIMESTAMP)) {
  +                doAction |= WSConstants.TS;
  +                actions.add(new Integer(WSConstants.TS));
  +            } else if (single[i].equals(WSHandlerConstants.NO_SERIALIZATION)) {
  +                doAction |= WSConstants.NO_SERIALIZE;
  +                actions.add(new Integer(WSConstants.NO_SERIALIZE));
  +            } else if (single[i].equals(WSHandlerConstants.SIGN_WITH_UT_KEY)) {
  +                doAction |= WSConstants.UT_SIGN;
  +                actions.add(new Integer(WSConstants.UT_SIGN));
  +            } else {
  +                throw new AxisFault("WSDoAllSender: Unknown action defined" + single[i]);
  +            }
  +        }
  +        return doAction;
  +    }
   }
  
  
  

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