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 2004/08/30 11:39:24 UTC

cvs commit: ws-fx/wss4j/src/org/apache/ws/security/util WSSecurityUtil.java

dims        2004/08/30 02:39:24

  Modified:    wss4j/src/org/apache/ws/security/message WSBaseMessage.java
               wss4j/src/org/apache/ws/security/util WSSecurityUtil.java
  Log:
  Fix for(WSFX-33) [Patch] client handler chaining with different actors
  from Yves Langisch yves@langisch.ch
  
  Revision  Changes    Path
  1.13      +1 -0      ws-fx/wss4j/src/org/apache/ws/security/message/WSBaseMessage.java
  
  Index: WSBaseMessage.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/wss4j/src/org/apache/ws/security/message/WSBaseMessage.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- WSBaseMessage.java	9 Aug 2004 17:53:45 -0000	1.12
  +++ WSBaseMessage.java	30 Aug 2004 09:39:23 -0000	1.13
  @@ -254,6 +254,7 @@
                       WSSecurityUtil.findWsseSecurityHeaderBlock(wssConfig,
                               doc,
                               doc.getDocumentElement(),
  +                            actor,
                               true);
   
               String soapPrefix =
  
  
  
  1.21      +23 -12    ws-fx/wss4j/src/org/apache/ws/security/util/WSSecurityUtil.java
  
  Index: WSSecurityUtil.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/wss4j/src/org/apache/ws/security/util/WSSecurityUtil.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- WSSecurityUtil.java	9 Aug 2004 17:53:47 -0000	1.20
  +++ WSSecurityUtil.java	30 Aug 2004 09:39:24 -0000	1.21
  @@ -651,7 +651,7 @@
       }
   
       /**
  -     * find the ws-security header block
  +     * find the first ws-security header block
        * <p/>
        *
        * @param doc
  @@ -660,24 +660,35 @@
        * @return
        */
       public static Element findWsseSecurityHeaderBlock(WSSConfig wssConfig, Document doc, Element envelope, boolean doCreate) {
  +        return findWsseSecurityHeaderBlock(wssConfig, doc, envelope, null, doCreate);
  +    }
  +
  +    /**
  +     * find a ws-security header block for a given actor
  +     * <p/>
  +     *
  +     * @param doc
  +     * @param envelope
  +     * @param actor
  +     * @param doCreate
  +     * @return
  +     */
  +    public static Element findWsseSecurityHeaderBlock(WSSConfig wssConfig,
  +                                                      Document doc,
  +                                                      Element envelope,
  +                                                      String actor,
  +                                                      boolean doCreate) {
           SOAPConstants sc = getSOAPConstants(envelope);
  +        Element wsseSecurity = getSecurityHeader(wssConfig, doc, actor, sc);
  +        if (wsseSecurity != null) {
  +            return wsseSecurity;
  +        }
           Element header = findChildElement(envelope, sc.getEnvelopeURI(), sc.getHeaderQName().getLocalPart());
           if (header == null) {
               if (doCreate) {
                   header = createElementInSameNamespace(envelope, sc.getHeaderQName().getLocalPart());
                   header = prependChildElement(doc, envelope, header, true);
               }
  -        }
  -        Element wsseSecurity = null;
  -        if (wssConfig.getProcessNonCompliantMessages()) {
  -            for (int i = 0; wsseSecurity == null && i < WSConstants.WSSE_NS_ARRAY.length; ++i) {
  -                wsseSecurity = findChildElement(header, WSConstants.WSSE_NS_ARRAY[i], "Security");
  -            }
  -        } else {
  -            wsseSecurity = findChildElement(header, wssConfig.getWsseNS(), "Security");
  -        }
  -        if (wsseSecurity != null) {
  -            return wsseSecurity;
           }
           if (doCreate) {
               wsseSecurity = header.getOwnerDocument().createElementNS(wssConfig.getWsseNS(), "wsse:Security");