axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r447305 [2/2] - in /webservices/axis2/trunk/java/modules: codegen/src/org/apache/axis2/wsdl/codegen/emitter/ codegen/src/org/apache/axis2/wsdl/codegen/extension/ kernel/src/org/apache/axis2/client/ kernel/src/org/apache/axis2/context/ kerne...
Date Mon, 18 Sep 2006 07:30:07 GMT
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/PolicyUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/PolicyUtil.java?view=diff&rev=447305&r1=447304&r2=447305
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/PolicyUtil.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/PolicyUtil.java
Mon Sep 18 00:30:05 2006
@@ -16,81 +16,131 @@
 
 package org.apache.axis2.util;
 
+import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.IOException;
 import java.io.OutputStream;
-import java.io.PrintWriter;
 
+import javax.xml.stream.FactoryConfigurationError;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory;
 import org.apache.axis2.description.PolicyInclude;
-import org.apache.ws.policy.Policy;
-import org.apache.ws.policy.util.PolicyFactory;
-import org.apache.ws.policy.util.PolicyWriter;
-import org.apache.ws.policy.util.StAXPolicyWriter;
+import org.apache.neethi.Constants;
+import org.apache.neethi.Policy;
+import org.apache.neethi.PolicyComponent;
+import org.apache.neethi.PolicyEngine;
+import org.apache.neethi.PolicyReference;
+import org.apache.woden.internal.util.dom.DOM2Writer;
+import org.w3c.dom.Element;
 
 public class PolicyUtil {
-    
-	public static void writePolicy(PolicyInclude policy, OutputStream out) {
-		if (policy != null) {
-			Policy pl = policy.getEffectivePolicy();
-			if (pl != null) {
-				PolicyWriter write = PolicyFactory
-						.getPolicyWriter(PolicyFactory.StAX_POLICY_WRITER);
-				write.writePolicy(pl, out);
-				try {
-					out.close();
-				} catch (IOException e) {
-					e.printStackTrace();
-				}
-			} else {
-				PrintWriter write = new PrintWriter(out);
-				write.write("<policy>no policy found</policy>");
-				write.flush();
-				write.close();
-			}
-		} else {
-			PrintWriter write = new PrintWriter(out);
-			write.write("<policy>no policy found</policy>");
-			write.flush();
-			write.close();
-		}
-	}
-
-	public static String getPolicyAsString(Policy policy) {
-		
-		ByteArrayOutputStream baos = new ByteArrayOutputStream();
-		StAXPolicyWriter pwtr = (StAXPolicyWriter) PolicyFactory
-				.getPolicyWriter(PolicyFactory.StAX_POLICY_WRITER);
-		
-		pwtr.writePolicy(policy, baos);
-		return getSafeString(baos.toString());
-	}
-	
-	private static String getSafeString(String unsafeString) {
-		StringBuffer sbuf = new StringBuffer();
-		
-		char[] chars = unsafeString.toCharArray();
-		
-		for (int i = 0; i < chars.length; i++) {
-			char c = chars[i];
-			
-			switch (c) {
-				case '\\' :
-					sbuf.append('\\'); sbuf.append('\\');
-					break;
-				case '"' :
-					sbuf.append('\\'); sbuf.append('"');
-					break;
-				case '\n':
-					sbuf.append('\\'); sbuf.append('n'); 
-					break;
-				case '\r':
-					sbuf.append('\\'); sbuf.append('r'); 
-					break;
-				default :
-					sbuf.append(c);					
-			}			
-		}
-		
-		return sbuf.toString();
-	}
+
+    private static String getSafeString(String unsafeString) {
+        StringBuffer sbuf = new StringBuffer();
+
+        char[] chars = unsafeString.toCharArray();
+
+        for (int i = 0; i < chars.length; i++) {
+            char c = chars[i];
+
+            switch (c) {
+            case '\\':
+                sbuf.append('\\');
+                sbuf.append('\\');
+                break;
+            case '"':
+                sbuf.append('\\');
+                sbuf.append('"');
+                break;
+            case '\n':
+                sbuf.append('\\');
+                sbuf.append('n');
+                break;
+            case '\r':
+                sbuf.append('\\');
+                sbuf.append('r');
+                break;
+            default:
+                sbuf.append(c);
+            }
+        }
+
+        return sbuf.toString();
+    }
+
+    public static OMElement getPolicyComponentAsOMElement(
+            PolicyComponent component) throws XMLStreamException,
+            FactoryConfigurationError {
+
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        XMLStreamWriter writer = XMLOutputFactory.newInstance()
+                .createXMLStreamWriter(baos);
+
+        component.serialize(writer);
+        writer.flush();
+
+        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+        return OMXMLBuilderFactory.createStAXOMBuilder(
+                OMAbstractFactory.getOMFactory(),
+                XMLInputFactory.newInstance().createXMLStreamReader(bais))
+                .getDocumentElement();
+    }
+
+    public static PolicyComponent getPolicyComponentFromOMElement(
+            OMElement policyComponent) throws IllegalArgumentException {
+
+        if (policyComponent instanceof Policy) {
+            return PolicyEngine.getPolicy(policyComponent);
+
+        } else if (policyComponent instanceof PolicyReference) {
+            return PolicyEngine.getPolicyReference(policyComponent);
+
+        } else {
+            throw new IllegalArgumentException(
+                    "Agrument is neither a <wsp:Policy> nor a <wsp:PolicyReference>
element");
+        }
+    }
+
+    public static PolicyComponent getPolicyComponent(Element element) {
+
+        String xmlString;
+        ByteArrayInputStream bais;
+
+        if (Constants.URI_POLICY_NS.equals(element.getNamespaceURI())) {
+
+            if (Constants.ELEM_POLICY.equals(element.getLocalName())) {
+                xmlString = DOM2Writer.nodeToString(element);
+                bais = new ByteArrayInputStream(xmlString.getBytes());
+
+                PolicyEngine.getPolicy(bais);
+            } else if (Constants.ELEM_POLICYREF.equals(element
+                    .getLocalName())) {
+                xmlString = DOM2Writer.nodeToString(element);
+                bais = new ByteArrayInputStream(xmlString.getBytes());
+
+                PolicyEngine.getPolicyReferene(bais);
+            }
+        }
+
+        throw new IllegalArgumentException(
+                "Agrument is neither a <wsp:Policy> nor a <wsp:PolicyReference>
element");
+    }
+
+    public static String policyComponentToString(PolicyComponent policyComponent)
+            throws XMLStreamException, FactoryConfigurationError {
+
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        XMLStreamWriter writer = XMLOutputFactory.newInstance()
+                .createXMLStreamWriter(baos);
+        
+        policyComponent.serialize(writer);
+        writer.flush();
+
+        return baos.toString();
+    }
 }

Modified: webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/Constants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/Constants.java?view=diff&rev=447305&r1=447304&r2=447305
==============================================================================
--- webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/Constants.java
(original)
+++ webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/Constants.java
Mon Sep 18 00:30:05 2006
@@ -6,10 +6,14 @@
 
     public static final String P_NS = "http://schemas.xmlsoap.org/ws/2004/09/policy";
     
-    public static final QName POLICY = new QName(P_NS, "Policy");    
+    public static final String P_PREFIX = "wsp";
+    
+    public static final QName POLICY = new QName(P_NS, "Policy", P_PREFIX);    
     
     public final static String SP_NS = "http://schemas.xmlsoap.org/ws/2005/07/securitypolicy";
     
+    public final static String SP_PREFIX = "sp";
+    
     public final static String ATTR_INCLUDE_TOKEN = "IncludeToken";
 
     public final static String INCLUDE_NEVER = Constants.SP_NS
@@ -157,6 +161,19 @@
 
     public final static String STRT10 = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#STR-Transform";
     
+    ////////////////////////////////////////////////////////////////////////
+    
+    public static final String INCLUSIVE_C14N = "InclusiveC14N";
+    
+    public static final String SOAP_NORMALIZATION_10 = "SoapNormalization10";
+    
+    public static final String STR_TRANSFORM_10 = "STRTransform10";
+    
+    public static final String XPATH10 = "XPath10";
+    
+    public static final String XPATH_FILTER20 = "XPathFilter20"; 
+    
+    ///////////////////////////////////////////////////////////////////////
     
     
     
@@ -164,9 +181,18 @@
     
     public static final QName TRANSPORT_BINDING = new QName(SP_NS, "TransportBinding");
     
-    public static final QName ALGORITHM_SUITE = new QName(SP_NS, "AlgorithmSuite");
+    public static final QName ALGORITHM_SUITE = new QName(SP_NS, "AlgorithmSuite", Constants.SP_PREFIX);
         
-    public static final QName LAYOUT = new QName(SP_NS, "Layout");
+    public static final QName LAYOUT = new QName(SP_NS, "Layout", SP_PREFIX);
+    
+    /////////////////////
+    
+    public static final QName STRICT = new QName(Constants.SP_NS, "Strict");
+    public static final QName LAX = new QName(Constants.SP_NS, "Lax");
+    public static final QName LAXTSFIRST = new QName(Constants.SP_NS, "LaxTsFirst");
+    public static final QName LAXTSLAST = new QName(Constants.SP_NS,"LaxTsLast");
+    
+    //////////////////
     
     public static final QName INCLUDE_TIMESTAMP = new QName(SP_NS, "IncludeTimestamp");
     

Modified: webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/builders/LayoutBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/builders/LayoutBuilder.java?view=diff&rev=447305&r1=447304&r2=447305
==============================================================================
--- webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/builders/LayoutBuilder.java
(original)
+++ webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/builders/LayoutBuilder.java
Mon Sep 18 00:30:05 2006
@@ -31,10 +31,7 @@
 
 public class LayoutBuilder implements AssertionBuilder {
     
-    private static final QName STRICT = new QName(Constants.SP_NS, "Strict");
-    private static final QName LAX = new QName(Constants.SP_NS, "Lax");
-    private static final QName LAXTSFIRST = new QName(Constants.SP_NS, "LaxTsFirst");
-    private static final QName LAXTSLAST = new QName(Constants.SP_NS,"LaxTsLast");
+    
 
     public Assertion build(OMElement element, AssertionBuilderFactory factory) throws IllegalArgumentException
{
         Layout layout = new Layout();
@@ -60,13 +57,13 @@
             Assertion assertion = (Assertion) iterator.next();
             QName qname = assertion.getName();
             
-            if (STRICT.equals(qname)) {
+            if (Constants.STRICT.equals(qname)) {
                 parent.setValue(Constants.LAYOUT_STRICT);
-            } else if (LAX.equals(qname)) {
+            } else if (Constants.LAX.equals(qname)) {
                 parent.setValue(Constants.LAYOUT_LAX);
-            } else if (LAXTSFIRST.equals(qname)) {
+            } else if (Constants.LAXTSFIRST.equals(qname)) {
                 parent.setValue(Constants.LAYOUT_LAX_TIMESTAMP_FIRST);
-            } else if (LAXTSLAST.equals(qname)) {
+            } else if (Constants.LAXTSLAST.equals(qname)) {
                 parent.setValue(Constants.LAYOUT_LAX_TIMESTAMP_LAST);
             }
             

Modified: webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/builders/TransportTokenBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/builders/TransportTokenBuilder.java?view=diff&rev=447305&r1=447304&r2=447305
==============================================================================
--- webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/builders/TransportTokenBuilder.java
(original)
+++ webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/builders/TransportTokenBuilder.java
Mon Sep 18 00:30:05 2006
@@ -25,8 +25,8 @@
 import org.apache.neethi.AssertionBuilderFactory;
 import org.apache.neethi.Policy;
 import org.apache.neethi.PolicyEngine;
-import org.apache.neethi.XmlPrimtiveAssertion;
 import org.apache.neethi.builders.AssertionBuilder;
+import org.apache.neethi.builders.xml.XmlPrimtiveAssertion;
 import org.apache.ws.secpolicy.Constants;
 import org.apache.ws.secpolicy.model.HttpsToken;
 import org.apache.ws.secpolicy.model.TransportToken;

Modified: webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/model/AbstractSecurityAssertion.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/model/AbstractSecurityAssertion.java?view=diff&rev=447305&r1=447304&r2=447305
==============================================================================
--- webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/model/AbstractSecurityAssertion.java
(original)
+++ webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/model/AbstractSecurityAssertion.java
Mon Sep 18 00:30:05 2006
@@ -16,6 +16,7 @@
 package org.apache.ws.secpolicy.model;
 
 import org.apache.neethi.Assertion;
+import org.apache.neethi.Constants;
 import org.apache.neethi.PolicyComponent;
 
 public abstract class AbstractSecurityAssertion implements Assertion{
@@ -33,7 +34,7 @@
     }
 
     public short getType() {
-        return Assertion.ASSERTION;
+        return Constants.TYPE_ASSERTION;
     }    
     
     public boolean equal(PolicyComponent policyComponent) {

Modified: webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/model/AlgorithmSuite.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/model/AlgorithmSuite.java?view=diff&rev=447305&r1=447304&r2=447305
==============================================================================
--- webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/model/AlgorithmSuite.java
(original)
+++ webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/model/AlgorithmSuite.java
Mon Sep 18 00:30:05 2006
@@ -15,21 +15,18 @@
  */
 package org.apache.ws.secpolicy.model;
 
-import java.util.Iterator;
-
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
-import org.apache.neethi.All;
-import org.apache.neethi.ExactlyOne;
-import org.apache.neethi.Policy;
 import org.apache.neethi.PolicyComponent;
 import org.apache.ws.secpolicy.Constants;
 import org.apache.ws.secpolicy.WSSPolicyException;
 
 public class AlgorithmSuite extends AbstractConfigurableSecurityAssertion {
 
+    private String algoSuiteString;
+
     private String symmetricSignature = Constants.HMAC_SHA1;
 
     private String asymmetricSignature = Constants.RSA_SHA1;
@@ -87,6 +84,9 @@
      * @see Constants#ALGO_SUITE_TRIPLE_DES_SHA256_RSA15
      */
     public void setAlgorithmSuite(String algoSuite) {
+        setAlgoSuiteString(algoSuite);
+        this.algoSuiteString = algoSuite;
+
         // TODO: Optimize this :-)
         if (Constants.ALGO_SUITE_BASIC256.equals(algoSuite)) {
             this.digest = Constants.SHA1;
@@ -374,6 +374,14 @@
         xPath = path;
     }
 
+    private void setAlgoSuiteString(String algoSuiteString) {
+        this.algoSuiteString = algoSuiteString;
+    }
+
+    private String getAlgoSuiteString() {
+        return algoSuiteString;
+    }
+
     public QName getName() {
         return Constants.ALGORITHM_SUITE;
     }
@@ -384,6 +392,61 @@
     }
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
-        throw new UnsupportedOperationException();
+
+        String localName = Constants.ALGORITHM_SUITE.getLocalPart();
+        String namespaceURI = Constants.ALGORITHM_SUITE.getNamespaceURI();
+
+        String prefix = writer.getPrefix(Constants.ALGORITHM_SUITE
+                .getNamespaceURI());
+
+        if (prefix == null) {
+            prefix = Constants.ALGORITHM_SUITE.getPrefix();
+            writer.setPrefix(prefix, namespaceURI);
+        }
+
+        writer.writeStartElement(prefix, localName, namespaceURI);
+        writer.writeNamespace(prefix, namespaceURI);
+
+        // <wsp:Policy>
+        writer.writeStartElement(Constants.POLICY.getPrefix(), Constants.POLICY
+                .getLocalPart(), Constants.POLICY.getNamespaceURI());
+        
+        //
+        writer.writeStartElement(prefix, getAlgoSuiteString(), namespaceURI);
+        writer.writeEndElement();
+
+        if (Constants.C14N.equals(getInclusiveC14n())) {
+            writer.writeStartElement(prefix, Constants.INCLUSIVE_C14N, prefix);
+            writer.writeEndElement();
+        }
+
+        if (Constants.SNT.equals(getSoapNormalization())) {
+            writer.writeStartElement(prefix, Constants.SOAP_NORMALIZATION_10,
+                    namespaceURI);
+            writer.writeEndElement();
+        }
+
+        if (Constants.STRT10.equals(getStrTransform())) {
+            writer.writeStartElement(prefix, Constants.STR_TRANSFORM_10,
+                    namespaceURI);
+            writer.writeEndElement();
+        }
+
+        if (Constants.XPATH.equals(getXPath())) {
+            writer.writeStartElement(prefix, Constants.XPATH10, namespaceURI);
+            writer.writeEndElement();
+        }
+
+        if (Constants.XPATH20.equals(getXPath())) {
+            writer.writeStartElement(prefix, Constants.XPATH_FILTER20,
+                    namespaceURI);
+            writer.writeEndElement();
+        }
+        
+        // </wsp:Policy>
+        writer.writeEndElement();
+        
+        // </sp:AlgorithmSuite>
+        writer.writeEndElement();
     }
 }

Modified: webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/model/Layout.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/model/Layout.java?view=diff&rev=447305&r1=447304&r2=447305
==============================================================================
--- webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/model/Layout.java
(original)
+++ webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/model/Layout.java
Mon Sep 18 00:30:05 2006
@@ -23,10 +23,10 @@
 import org.apache.neethi.PolicyComponent;
 import org.apache.ws.secpolicy.Constants;
 
-public class Layout extends AbstractSecurityAssertion  {
-   
+public class Layout extends AbstractSecurityAssertion {
+
     private String value = Constants.LAYOUT_LAX;
-    
+
     /**
      * @return Returns the value.
      */
@@ -35,19 +35,21 @@
     }
 
     /**
-     * @param value The value to set.
+     * @param value
+     *            The value to set.
      */
     public void setValue(String value) {
-        if(Constants.LAYOUT_LAX.equals(value) ||
-                Constants.LAYOUT_STRICT.equals(value) ||
-                Constants.LAYOUT_LAX_TIMESTAMP_FIRST.equals(value) ||
-                Constants.LAYOUT_LAX_TIMESTAMP_LAST.equals(value)) {
-                 this.value = value;
-             } else {
-//                 throw new WSSPolicyException("Incorrect layout value : " + value);
-             }
+        if (Constants.LAYOUT_LAX.equals(value)
+                || Constants.LAYOUT_STRICT.equals(value)
+                || Constants.LAYOUT_LAX_TIMESTAMP_FIRST.equals(value)
+                || Constants.LAYOUT_LAX_TIMESTAMP_LAST.equals(value)) {
+            this.value = value;
+        } else {
+            // throw new WSSPolicyException("Incorrect layout value : " +
+            // value);
+        }
     }
-    
+
     public QName getName() {
         return Constants.LAYOUT;
     }
@@ -57,6 +59,44 @@
     }
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
-        throw new UnsupportedOperationException();
+
+        String localName = Constants.LAYOUT.getLocalPart();
+        String namespaceURI = Constants.LAYOUT.getNamespaceURI();
+
+        String prefix = writer.getPrefix(namespaceURI);
+
+        if (prefix == null) {
+            prefix = Constants.LAYOUT.getPrefix();
+            writer.setPrefix(prefix, namespaceURI);
+        }
+
+        // <sp:Layout>
+        writer.writeStartElement(prefix, localName, namespaceURI);
+
+        // <wsp:Policy>
+        writer.writeStartElement(Constants.POLICY.getPrefix(), Constants.POLICY
+                .getLocalPart(), Constants.POLICY.getNamespaceURI());
+
+        // .. <sp:Strict /> | <sp:Lax /> | <sp:LaxTsFirst /> | <sp:LaxTsLast
/> ..
+        if (Constants.LAYOUT_STRICT.equals(value)) {
+            writer.writeStartElement(prefix, Constants.STRICT.getLocalPart(), namespaceURI);
+            
+        } else if (Constants.LAYOUT_LAX.equals(value)) {
+            writer.writeStartElement(prefix, Constants.LAX.getLocalPart(), namespaceURI);
+            
+        } else if (Constants.LAYOUT_LAX_TIMESTAMP_FIRST.equals(value)) {
+            writer.writeStartElement(prefix, Constants.LAXTSFIRST.getLocalPart(), namespaceURI);
+            
+        } else if (Constants.LAYOUT_LAX_TIMESTAMP_LAST.equals(value)) {
+            writer.writeStartElement(prefix, Constants.LAXTSLAST.getLocalPart(), namespaceURI);
+        }
+        
+        writer.writeEndElement();
+        
+        // </wsp:Policy>
+        writer.writeEndElement();
+        
+        // </sp:Layout>
+        writer.writeEndElement();
     }
 }

Modified: webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/model/SupportingToken.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/model/SupportingToken.java?view=diff&rev=447305&r1=447304&r2=447305
==============================================================================
--- webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/model/SupportingToken.java
(original)
+++ webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/model/SupportingToken.java
Mon Sep 18 00:30:05 2006
@@ -187,7 +187,7 @@
     }
 
     public short getType() {
-        return Assertion.ASSERTION;
+        return org.apache.neethi.Constants.TYPE_ASSERTION;
     }
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {

Modified: webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/model/TransportToken.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/model/TransportToken.java?view=diff&rev=447305&r1=447304&r2=447305
==============================================================================
--- webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/model/TransportToken.java
(original)
+++ webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/model/TransportToken.java
Mon Sep 18 00:30:05 2006
@@ -23,7 +23,6 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
-import org.apache.neethi.Assertion;
 import org.apache.neethi.PolicyComponent;
 import org.apache.ws.secpolicy.Constants;
 
@@ -76,7 +75,7 @@
     }
 
     public short getType() {
-        return Assertion.ASSERTION;
+        return org.apache.neethi.Constants.TYPE_ASSERTION;
     }
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {

Modified: webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/model/Trust10.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/model/Trust10.java?view=diff&rev=447305&r1=447304&r2=447305
==============================================================================
--- webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/model/Trust10.java
(original)
+++ webservices/axis2/trunk/java/modules/secpolicy/src/org/apache/ws/secpolicy/model/Trust10.java
Mon Sep 18 00:30:05 2006
@@ -20,7 +20,6 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
-import org.apache.neethi.Assertion;
 import org.apache.neethi.PolicyComponent;
 import org.apache.ws.secpolicy.Constants;
 
@@ -129,11 +128,8 @@
         throw new UnsupportedOperationException("TODO Sanka");
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.neethi.PolicyComponent#getType()
-     */
     public short getType() {
-        return Assertion.ASSERTION;
+        return org.apache.neethi.Constants.TYPE_ASSERTION;
     }
 
 }

Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/Rampart.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/Rampart.java?view=diff&rev=447305&r1=447304&r2=447305
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/Rampart.java (original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/Rampart.java Mon
Sep 18 00:30:05 2006
@@ -26,11 +26,12 @@
 import org.apache.axis2.modules.Module;
 import org.apache.axis2.modules.ModulePolicyExtension;
 import org.apache.axis2.modules.PolicyExtension;
+import org.apache.neethi.Policy;
 import org.apache.rampart.util.HandlerParameterDecoder;
 import org.apache.rampart.handler.WSSHandlerConstants;
 import org.apache.rampart.handler.config.InflowConfiguration;
 import org.apache.rampart.handler.config.OutflowConfiguration;
-import org.apache.ws.policy.Policy;
+
 import org.apache.ws.security.policy1.WSS4JConfig;
 import org.apache.ws.security.policy1.WSS4JConfigBuilder;
 import org.apache.ws.security.policy1.extension.WSSCodegenPolicyExtension;
@@ -45,68 +46,72 @@
     }
 
     public void engageNotify(AxisDescription axisDescription) throws AxisFault {
+        
+        // TODO do the appropriate based on the Neethi2 policy object ..        
         Policy policy = axisDescription.getPolicyInclude().getEffectivePolicy();
-        if (axisDescription instanceof AxisOperation && policy != null) {
-            try {
-                WSSPolicyProcessor wssPolicyProcessor = new WSSPolicyProcessor();
-                wssPolicyProcessor.setup();
-                wssPolicyProcessor.processPolicy((Policy)policy.normalize(axisDescription.getPolicyInclude().getPolicyRegistry()));
-
-                //create server side config
-                WSS4JConfig serverConfig = WSS4JConfigBuilder
-                        .build(wssPolicyProcessor.getRootPED()
-                                .getTopLevelPEDs());
-
-                InflowConfiguration policyInflowConfig = serverConfig
-                        .getInflowConfiguration();
-
-                Parameter infp = calcuateCurrentInflowConfiguration(policyInflowConfig,axisDescription).getProperty();
-                
-                if (infp != null) {
-                    infp.setName(WSSHandlerConstants.INFLOW_SECURITY_SERVER);
-                    axisDescription.addParameter(infp);                    
-                }
-                                
-                OutflowConfiguration policyOutflowConfig = serverConfig.getOutflowConfiguration();
-                Parameter outfp = calcuateCurrentOutflowConfiguration(policyOutflowConfig,axisDescription).getProperty();
-                
-                if (outfp != null) {
-                    outfp.setName(WSSHandlerConstants.OUTFLOW_SECURITY_SERVER);
-                    axisDescription.addParameter(outfp);                    
-                }
-                
-                
-                
-                //create client side config
-                wssPolicyProcessor = new WSSPolicyProcessor();
-                wssPolicyProcessor.setup();
-                wssPolicyProcessor.processPolicy(policy);
-                
-                WSS4JConfig clientConfig = WSS4JConfigBuilder
-                .build(wssPolicyProcessor.getRootPED()
-                        .getTopLevelPEDs(), isServerSide(axisDescription));
-
-                policyInflowConfig = clientConfig.getInflowConfiguration();
-
-                infp = calcuateCurrentInflowConfiguration(policyInflowConfig,axisDescription).getProperty();
-                
-                if (infp != null) {
-                    infp.setName(WSSHandlerConstants.INFLOW_SECURITY_CLIENT);
-                    axisDescription.addParameter(infp);
-                }
         
-                 policyOutflowConfig = clientConfig.getOutflowConfiguration();
-                 outfp = calcuateCurrentOutflowConfiguration(policyOutflowConfig, axisDescription).getProperty();
-                 
-                 if (outfp != null) {
-                     outfp.setName(WSSHandlerConstants.OUTFLOW_SECURITY_CLIENT);
-                     axisDescription.addParameter(outfp);
-                 }
-                 
-            } catch (Exception e) {
-                throw new AxisFault(e.getMessage(), e);
-            }
-        }
+        
+//        if (axisDescription instanceof AxisOperation && policy != null) {
+//            try {
+//                WSSPolicyProcessor wssPolicyProcessor = new WSSPolicyProcessor();
+//                wssPolicyProcessor.setup();
+//                wssPolicyProcessor.processPolicy((Policy)policy.normalize(axisDescription.getPolicyInclude().getPolicyRegistry()));
+//
+//                //create server side config
+//                WSS4JConfig serverConfig = WSS4JConfigBuilder
+//                        .build(wssPolicyProcessor.getRootPED()
+//                                .getTopLevelPEDs());
+//
+//                InflowConfiguration policyInflowConfig = serverConfig
+//                        .getInflowConfiguration();
+//
+//                Parameter infp = calcuateCurrentInflowConfiguration(policyInflowConfig,axisDescription).getProperty();
+//                
+//                if (infp != null) {
+//                    infp.setName(WSSHandlerConstants.INFLOW_SECURITY_SERVER);
+//                    axisDescription.addParameter(infp);                    
+//                }
+//                                
+//                OutflowConfiguration policyOutflowConfig = serverConfig.getOutflowConfiguration();
+//                Parameter outfp = calcuateCurrentOutflowConfiguration(policyOutflowConfig,axisDescription).getProperty();
+//                
+//                if (outfp != null) {
+//                    outfp.setName(WSSHandlerConstants.OUTFLOW_SECURITY_SERVER);
+//                    axisDescription.addParameter(outfp);                    
+//                }
+//                
+//                
+//                
+//                //create client side config
+//                wssPolicyProcessor = new WSSPolicyProcessor();
+//                wssPolicyProcessor.setup();
+//                wssPolicyProcessor.processPolicy(policy);
+//                
+//                WSS4JConfig clientConfig = WSS4JConfigBuilder
+//                .build(wssPolicyProcessor.getRootPED()
+//                        .getTopLevelPEDs(), isServerSide(axisDescription));
+//
+//                policyInflowConfig = clientConfig.getInflowConfiguration();
+//
+//                infp = calcuateCurrentInflowConfiguration(policyInflowConfig,axisDescription).getProperty();
+//                
+//                if (infp != null) {
+//                    infp.setName(WSSHandlerConstants.INFLOW_SECURITY_CLIENT);
+//                    axisDescription.addParameter(infp);
+//                }
+//        
+//                 policyOutflowConfig = clientConfig.getOutflowConfiguration();
+//                 outfp = calcuateCurrentOutflowConfiguration(policyOutflowConfig, axisDescription).getProperty();
+//                 
+//                 if (outfp != null) {
+//                     outfp.setName(WSSHandlerConstants.OUTFLOW_SECURITY_CLIENT);
+//                     axisDescription.addParameter(outfp);
+//                 }
+//                 
+//            } catch (Exception e) {
+//                throw new AxisFault(e.getMessage(), e);
+//            }
+//        }
     }
 
     public void shutdown(ConfigurationContext configurationContext) throws AxisFault {

Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/policy/model/CryptoConfig.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/policy/model/CryptoConfig.java?view=diff&rev=447305&r1=447304&r2=447305
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/policy/model/CryptoConfig.java
(original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/policy/model/CryptoConfig.java
Mon Sep 18 00:30:05 2006
@@ -17,6 +17,7 @@
 package org.apache.rampart.policy.model;
 
 import org.apache.neethi.Assertion;
+import org.apache.neethi.Constants;
 import org.apache.neethi.PolicyComponent;
 
 import javax.xml.namespace.QName;
@@ -84,6 +85,6 @@
     }
 
     public short getType() {
-        return Assertion.ASSERTION;
+        return Constants.TYPE_ASSERTION;
     }
 }

Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/policy/model/RampartConfig.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/policy/model/RampartConfig.java?view=diff&rev=447305&r1=447304&r2=447305
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/policy/model/RampartConfig.java
(original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/policy/model/RampartConfig.java
Mon Sep 18 00:30:05 2006
@@ -17,6 +17,7 @@
 package org.apache.rampart.policy.model;
 
 import org.apache.neethi.Assertion;
+import org.apache.neethi.Constants;
 import org.apache.neethi.Policy;
 import org.apache.neethi.PolicyComponent;
 
@@ -177,7 +178,7 @@
     }
 
     public short getType() {
-        return Assertion.ASSERTION;
+        return Constants.TYPE_ASSERTION;
     }
 
     /**

Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy1/extension/WSSCodegenPolicyExtension.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy1/extension/WSSCodegenPolicyExtension.java?view=diff&rev=447305&r1=447304&r2=447305
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy1/extension/WSSCodegenPolicyExtension.java
(original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy1/extension/WSSCodegenPolicyExtension.java
Mon Sep 18 00:30:05 2006
@@ -15,59 +15,57 @@
  */
 package org.apache.ws.security.policy1.extension;
 
+import java.util.List;
+
 import javax.xml.namespace.QName;
 
 import org.apache.axis2.modules.PolicyExtension;
-import org.apache.rampart.handler.config.OutflowConfiguration;
-import org.apache.ws.policy.Policy;
-import org.apache.ws.security.policy1.WSS4JConfig;
-import org.apache.ws.security.policy1.WSS4JConfigBuilder;
-import org.apache.ws.security.policy1.model.RootPolicyEngineData;
-import org.apache.ws.security.policy1.parser.WSSPolicyProcessor;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
 public class WSSCodegenPolicyExtension implements PolicyExtension {
 
     public void addMethodsToStub(Document document, Element element,
-            QName methodName, Policy policy) {
-        try {
-            WSSPolicyProcessor processor = new WSSPolicyProcessor();
-            processor.setup();
-            
-            if (!policy.isNormalized()) {
-                policy = (Policy) policy.normalize();
-            }
-            
-            processor.processPolicy(policy);
-                
-            RootPolicyEngineData data = processor.getRootPED();
-            
-            WSS4JConfig wss4jConfig = WSS4JConfigBuilder.build(data.getTopLevelPEDs(), false);
-            OutflowConfiguration outflowConfiguration = wss4jConfig.getOutflowConfiguration();
-            
-            Element secElement = document.createElement("security-codegen-policy-extensions");
-            
-            String actionItems = outflowConfiguration.getActionItems();
-            
-            if (actionItems != null) {
-                String[] actions = actionItems.split(" ");
-                
-                Element child;
-                String localname;
-                for (int i = 0; i < actions.length; i++) {
-                    localname = actions[i].toLowerCase() + "-action";
-                    child = document.createElement(localname);
-                    secElement.appendChild(child);
-                }
-            }
-            
-            element.appendChild(secElement);
-            
-        } catch (Exception nsme) {
-            throw new RuntimeException("error in WSSPolicyExtension " , nsme);
-            
-        }
+            QName methodName, List assertions) {
+        
+        // FIXME 
+//        try {
+//            WSSPolicyProcessor processor = new WSSPolicyProcessor();
+//            processor.setup();
+//            
+//            if (!policy.isNormalized()) {
+//                policy = (Policy) policy.normalize();
+//            }
+//            
+//            processor.processPolicy(policy);
+//                
+//            RootPolicyEngineData data = processor.getRootPED();
+//            
+//            WSS4JConfig wss4jConfig = WSS4JConfigBuilder.build(data.getTopLevelPEDs(),
false);
+//            OutflowConfiguration outflowConfiguration = wss4jConfig.getOutflowConfiguration();
+//            
+//            Element secElement = document.createElement("security-codegen-policy-extensions");
+//            
+//            String actionItems = outflowConfiguration.getActionItems();
+//            
+//            if (actionItems != null) {
+//                String[] actions = actionItems.split(" ");
+//                
+//                Element child;
+//                String localname;
+//                for (int i = 0; i < actions.length; i++) {
+//                    localname = actions[i].toLowerCase() + "-action";
+//                    child = document.createElement(localname);
+//                    secElement.appendChild(child);
+//                }
+//            }
+//            
+//            element.appendChild(secElement);
+//            
+//        } catch (Exception nsme) {
+//            throw new RuntimeException("error in WSSPolicyExtension " , nsme);
+//            
+//        }
     }
 
 }

Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy1/model/AbstractSecurityAssertion.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy1/model/AbstractSecurityAssertion.java?view=diff&rev=447305&r1=447304&r2=447305
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy1/model/AbstractSecurityAssertion.java
(original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/ws/security/policy1/model/AbstractSecurityAssertion.java
Mon Sep 18 00:30:05 2006
@@ -16,6 +16,7 @@
 package org.apache.ws.security.policy1.model;
 
 import org.apache.neethi.Assertion;
+import org.apache.neethi.Constants;
 
 public abstract class AbstractSecurityAssertion implements Assertion{
 
@@ -30,7 +31,7 @@
     }
 
     public short getType() {
-        return Assertion.ASSERTION;
+        return Constants.TYPE_ASSERTION;
     }    
 
 }



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


Mime
View raw message