You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2017/01/29 15:16:04 UTC

svn commit: r1780804 [5/10] - in /axis/axis2/java/rampart/branches/RAMPART-252: ./ legal/ modules/distribution/ modules/documentation/ modules/documentation/src/site/resources/download/ modules/documentation/src/site/xdoc/ modules/documentation/src/sit...

Propchange: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAML2TokenCertForHoKTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAML2TokenCertForHoKTest.java?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAML2TokenCertForHoKTest.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAML2TokenCertForHoKTest.java Sun Jan 29 15:16:02 2017
@@ -7,7 +7,6 @@ import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.neethi.Policy;
 import org.apache.ws.secpolicy.SP11Constants;
-import org.opensaml.XML;
 
 import javax.xml.namespace.QName;/*
  * Copyright 2004,2005 The Apache Software Foundation.                         

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAML2TokenTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAML2TokenTest.java?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAML2TokenTest.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAML2TokenTest.java Sun Jan 29 15:16:02 2017
@@ -23,7 +23,6 @@ import org.apache.rampart.handler.config
 import org.apache.rampart.handler.config.InflowConfiguration;
 import org.apache.neethi.Policy;
 import org.apache.ws.secpolicy.SP11Constants;
-import org.opensaml.XML;
 
 import javax.xml.namespace.QName;
 public class RahasSAML2TokenTest extends TestClient{

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenAttributeTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenAttributeTest.java?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenAttributeTest.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenAttributeTest.java Sun Jan 29 15:16:02 2017
@@ -9,8 +9,6 @@ import org.apache.neethi.Policy;
 import org.apache.rampart.handler.config.InflowConfiguration;
 import org.apache.rampart.handler.config.OutflowConfiguration;
 import org.apache.ws.secpolicy.SP11Constants;
-import org.apache.ws.secpolicy.SPConstants;
-import org.opensaml.XML;
 
 public class RahasSAMLTokenAttributeTest  extends TestClient{
     
@@ -67,7 +65,7 @@ public class RahasSAMLTokenAttributeTest
                                                              RahasConstants.IssuanceBindingLocalNames.
                                                                      REQUESTED_SECURITY_TOKEN));
         assertNotNull("RequestedSecurityToken missing", rst);
-        OMElement elem = rst.getFirstChildWithName(new QName(XML.SAML_NS, "Assertion"));
+        OMElement elem = rst.getFirstChildWithName(new QName(RahasConstants.SAML_NS, "Assertion"));
         assertNotNull("Missing SAML Assertoin", elem);
     }
 

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenCertForHoKTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenCertForHoKTest.java?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenCertForHoKTest.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenCertForHoKTest.java Sun Jan 29 15:16:02 2017
@@ -19,13 +19,10 @@ package org.apache.rahas;
 import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMFactory;
-import org.apache.rahas.PWCallback;
 import org.apache.neethi.Policy;
 import org.apache.rampart.handler.config.InflowConfiguration;
 import org.apache.rampart.handler.config.OutflowConfiguration;
 import org.apache.ws.secpolicy.SP11Constants;
-import org.apache.ws.secpolicy.SPConstants;
-import org.opensaml.XML;
 
 import javax.xml.namespace.QName;
 
@@ -94,7 +91,7 @@ public class RahasSAMLTokenCertForHoKTes
                                                              RahasConstants.IssuanceBindingLocalNames.
                                                                      REQUESTED_SECURITY_TOKEN));
         assertNotNull("RequestedSecurityToken missing", rst);
-        OMElement elem = rst.getFirstChildWithName(new QName(XML.SAML_NS, "Assertion"));
+        OMElement elem = rst.getFirstChildWithName(new QName(RahasConstants.SAML_NS, "Assertion"));
         assertNotNull("Missing SAML Assertoin", elem);
     }
 
@@ -135,5 +132,4 @@ public class RahasSAMLTokenCertForHoKTes
         return RahasConstants.VERSION_05_02;
     }
 
-
 }

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenCertForHoKV1205Test.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenCertForHoKV1205Test.java?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenCertForHoKV1205Test.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenCertForHoKV1205Test.java Sun Jan 29 15:16:02 2017
@@ -24,9 +24,7 @@ import org.apache.rampart.handler.WSSHan
 import org.apache.rampart.handler.config.InflowConfiguration;
 import org.apache.rampart.handler.config.OutflowConfiguration;
 import org.apache.ws.secpolicy.SP12Constants;
-import org.apache.ws.secpolicy.SPConstants;
 import org.apache.xml.security.encryption.XMLCipher;
-import org.opensaml.XML;
 
 import javax.xml.namespace.QName;
 
@@ -114,7 +112,7 @@ public class RahasSAMLTokenCertForHoKV12
                                                      RahasConstants.IssuanceBindingLocalNames.
                                                              REQUESTED_SECURITY_TOKEN));
         assertNotNull("RequestedSecurityToken missing", rst);
-        OMElement elem = rst.getFirstChildWithName(new QName(XML.SAML_NS, "Assertion"));
+        OMElement elem = rst.getFirstChildWithName(new QName(RahasConstants.SAML_NS, "Assertion"));
         assertNotNull("Missing SAML Assertoin", elem);
 
     }

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenTest.java?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenTest.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenTest.java Sun Jan 29 15:16:02 2017
@@ -19,13 +19,10 @@ package org.apache.rahas;
 import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMFactory;
-import org.apache.rahas.PWCallback;
 import org.apache.neethi.Policy;
 import org.apache.rampart.handler.config.InflowConfiguration;
 import org.apache.rampart.handler.config.OutflowConfiguration;
 import org.apache.ws.secpolicy.SP11Constants;
-import org.apache.ws.secpolicy.SPConstants;
-import org.opensaml.XML;
 
 import javax.xml.namespace.QName;
 
@@ -88,7 +85,7 @@ public class RahasSAMLTokenTest extends
                                                              RahasConstants.IssuanceBindingLocalNames.
                                                                      REQUESTED_SECURITY_TOKEN));
         assertNotNull("RequestedSecurityToken missing", rst);
-        OMElement elem = rst.getFirstChildWithName(new QName(XML.SAML_NS, "Assertion"));
+        OMElement elem = rst.getFirstChildWithName(new QName(RahasConstants.SAML_NS, "Assertion"));
         assertNotNull("Missing SAML Assertoin", elem);
     }
 

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenUTForBearerTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenUTForBearerTest.java?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenUTForBearerTest.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenUTForBearerTest.java Sun Jan 29 15:16:02 2017
@@ -23,10 +23,21 @@ import org.apache.neethi.Policy;
 import org.apache.rampart.handler.config.InflowConfiguration;
 import org.apache.rampart.handler.config.OutflowConfiguration;
 import org.apache.ws.secpolicy.SP11Constants;
-import org.apache.ws.secpolicy.SPConstants;
-import org.opensaml.XML;
+import org.opensaml.Configuration;
+import org.opensaml.saml1.core.Assertion;
+import org.opensaml.saml1.core.AuthenticationStatement;
+import org.opensaml.saml1.core.ConfirmationMethod;
+import org.opensaml.saml1.core.SubjectStatement;
+import org.opensaml.xml.io.Unmarshaller;
+import org.opensaml.xml.io.UnmarshallerFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
 
 import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import java.io.ByteArrayInputStream;
+import java.util.List;
 
 /**
  *
@@ -87,8 +98,23 @@ public class RahasSAMLTokenUTForBearerTe
                                                              RahasConstants.IssuanceBindingLocalNames.
                                                                      REQUESTED_SECURITY_TOKEN));
         assertNotNull("RequestedSecurityToken missing", rst);
-        OMElement elem = rst.getFirstChildWithName(new QName(XML.SAML_NS, "Assertion"));
-        assertNotNull("Missing SAML Assertoin", elem);
+
+        OMElement elem = rst.getFirstChildWithName(new QName(RahasConstants.SAML_NS, "Assertion"));
+        assertNotNull("Missing SAML Assertion", elem);
+
+        Assertion assertion = getAssertionObjectFromOMElement(elem);
+        List<AuthenticationStatement> authStmts = assertion.getAuthenticationStatements();
+        assertNotNull("At least one Authentication Statement should be present in the assertion",
+                   authStmts.get(0));
+
+        SubjectStatement authStmt = authStmts.get(0);
+        List<ConfirmationMethod> subConfirmationMethods = authStmt.getSubject().
+                getSubjectConfirmation().getConfirmationMethods();
+        assertNotNull("At least one Subject Confirmation method should be present in the SAML Subject",
+                   subConfirmationMethods.get(0));
+        assertEquals("Subject Confirmation should be BEARER : urn:oasis:names:tc:SAML:1.0:cm:bearer",
+                         RahasConstants.SAML11_SUBJECT_CONFIRMATION_BEARER,
+                         subConfirmationMethods.get(0).getConfirmationMethod());
     }
 
     /* (non-Javadoc)
@@ -121,4 +147,29 @@ public class RahasSAMLTokenUTForBearerTe
     public int getTrstVersion() {
         return RahasConstants.VERSION_05_02;
     }
+
+    /**
+     * Build the SAML Assertion object from the OMElement for the ease of processing
+     * @param omElement OMElement containing the SAML Assertion
+     * @return Assertion object
+     */
+    private Assertion getAssertionObjectFromOMElement(OMElement omElement){
+        Assertion assertion = null;
+        try {
+            DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+            documentBuilderFactory.setNamespaceAware(true);
+            DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
+            Document document = docBuilder.parse(new ByteArrayInputStream(omElement.toString().getBytes()));
+            Element element = document.getDocumentElement();
+            UnmarshallerFactory unmarshallerFactory = Configuration
+                    .getUnmarshallerFactory();
+            Unmarshaller unmarshaller = unmarshallerFactory
+                    .getUnmarshaller(element);
+            assertion = (org.opensaml.saml1.core.Assertion) unmarshaller
+                    .unmarshall(element);
+        } catch (Exception e){
+            e.printStackTrace();
+        }
+        return  assertion;
+    }
 }

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenUTForBearerV1205Test.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenUTForBearerV1205Test.java?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenUTForBearerV1205Test.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenUTForBearerV1205Test.java Sun Jan 29 15:16:02 2017
@@ -23,8 +23,6 @@ import org.apache.neethi.Policy;
 import org.apache.rampart.handler.config.InflowConfiguration;
 import org.apache.rampart.handler.config.OutflowConfiguration;
 import org.apache.ws.secpolicy.SP12Constants;
-import org.apache.ws.secpolicy.SPConstants;
-import org.opensaml.XML;
 
 import javax.xml.namespace.QName;
 
@@ -90,7 +88,7 @@ public class RahasSAMLTokenUTForBearerV1
                                                              RahasConstants.IssuanceBindingLocalNames.
                                                                      REQUESTED_SECURITY_TOKEN));
         assertNotNull("RequestedSecurityToken missing", rst);
-        OMElement elem = rst.getFirstChildWithName(new QName(XML.SAML_NS, "Assertion"));
+        OMElement elem = rst.getFirstChildWithName(new QName(RahasConstants.SAML_NS, "Assertion"));
         assertNotNull("Missing SAML Assertoin", elem);
     }
 

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenUTForHoKTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenUTForHoKTest.java?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenUTForHoKTest.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenUTForHoKTest.java Sun Jan 29 15:16:02 2017
@@ -23,8 +23,6 @@ import org.apache.neethi.Policy;
 import org.apache.rampart.handler.config.InflowConfiguration;
 import org.apache.rampart.handler.config.OutflowConfiguration;
 import org.apache.ws.secpolicy.SP11Constants;
-import org.apache.ws.secpolicy.SPConstants;
-import org.opensaml.XML;
 
 import javax.xml.namespace.QName;
 
@@ -83,7 +81,7 @@ public class RahasSAMLTokenUTForHoKTest
                                                              RahasConstants.IssuanceBindingLocalNames.
                                                                      REQUESTED_SECURITY_TOKEN));
         assertNotNull("RequestedSecurityToken missing", rst);
-        OMElement elem = rst.getFirstChildWithName(new QName(XML.SAML_NS, "Assertion"));
+        OMElement elem = rst.getFirstChildWithName(new QName(RahasConstants.SAML_NS, "Assertion"));
         assertNotNull("Missing SAML Assertoin", elem);
     }
 

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenUTForHoKV1205Test.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenUTForHoKV1205Test.java?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenUTForHoKV1205Test.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenUTForHoKV1205Test.java Sun Jan 29 15:16:02 2017
@@ -26,10 +26,8 @@ import org.apache.neethi.Policy;
 import org.apache.rampart.handler.config.InflowConfiguration;
 import org.apache.rampart.handler.config.OutflowConfiguration;
 import org.apache.ws.secpolicy.SP12Constants;
-import org.apache.ws.secpolicy.SPConstants;
 import org.apache.ws.security.WSConstants;
 import org.apache.ws.security.util.WSSecurityUtil;
-import org.opensaml.XML;
 
 public class RahasSAMLTokenUTForHoKV1205Test extends TestClient {
 
@@ -105,7 +103,7 @@ public class RahasSAMLTokenUTForHoKV1205
                                                                      REQUESTED_SECURITY_TOKEN));
         assertNotNull("RequestedSecurityToken missing", rst);
         
-        OMElement elem = rst.getFirstChildWithName(new QName(XML.SAML_NS, "Assertion"));
+        OMElement elem = rst.getFirstChildWithName(new QName(RahasConstants.SAML_NS, "Assertion"));
         assertNotNull("Missing SAML Assertoin", elem);
         
         //Uncomment for inteorp - START

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenV1205Test.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenV1205Test.java?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenV1205Test.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/RahasSAMLTokenV1205Test.java Sun Jan 29 15:16:02 2017
@@ -20,12 +20,9 @@ import org.apache.axiom.om.OMAbstractFac
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMFactory;
 import org.apache.neethi.Policy;
-import org.apache.rahas.PWCallback;
 import org.apache.rampart.handler.config.InflowConfiguration;
 import org.apache.rampart.handler.config.OutflowConfiguration;
 import org.apache.ws.secpolicy.SP12Constants;
-import org.apache.ws.secpolicy.SPConstants;
-import org.opensaml.XML;
 
 import javax.xml.namespace.QName;
 
@@ -92,7 +89,7 @@ public class RahasSAMLTokenV1205Test ext
                                                              RahasConstants.IssuanceBindingLocalNames.
                                                                      REQUESTED_SECURITY_TOKEN));
         assertNotNull("RequestedSecurityToken missing", rst);
-        OMElement elem = rst.getFirstChildWithName(new QName(XML.SAML_NS, "Assertion"));
+        OMElement elem = rst.getFirstChildWithName(new QName(RahasConstants.SAML_NS, "Assertion"));
         assertNotNull("Missing SAML Assertoin", elem);
     }
 

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/SAMLDataProvider.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/SAMLDataProvider.java?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/SAMLDataProvider.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rahas/SAMLDataProvider.java Sun Jan 29 15:16:02 2017
@@ -1,30 +1,32 @@
 package org.apache.rahas;
 
-import java.util.Arrays;
-
-import org.apache.rahas.impl.util.SAMLAttributeCallback;
-import org.apache.rahas.impl.util.SAMLCallback;
-import org.apache.rahas.impl.util.SAMLCallbackHandler;
-import org.apache.rahas.impl.util.SAMLNameIdentifierCallback;
-import org.opensaml.SAMLAttribute;
-import org.opensaml.SAMLException;
-import org.opensaml.SAMLNameIdentifier;
+import org.apache.rahas.impl.util.*;
+import org.opensaml.common.SAMLException;
+import org.opensaml.saml1.core.Attribute;
+import org.opensaml.saml1.core.NameIdentifier;
 
 public class SAMLDataProvider implements SAMLCallbackHandler{
 	
-	public void handle(SAMLCallback callback) throws SAMLException{
+	public void handle(SAMLCallback callback) throws SAMLException {
 		
 		if(callback.getCallbackType() == SAMLCallback.ATTR_CALLBACK){
 			SAMLAttributeCallback cb = (SAMLAttributeCallback)callback;
-			SAMLAttribute attribute = new SAMLAttribute("Name",
-                     "https://rahas.apache.org/saml/attrns", null, -1, Arrays
-                             .asList(new String[] { "Custom/Rahas" }));
-			cb.addAttributes(attribute);
+
+            try {
+                Attribute attribute = SAMLUtils.createAttribute("Name", "https://rahas.apache.org/saml/attrns", "Custom/Rahas");
+                cb.addAttributes(attribute);
+            } catch (TrustException e) {
+                throw new SAMLException("Error creating attribute", e);
+            }
+
 		}else if(callback.getCallbackType() == SAMLCallback.NAME_IDENTIFIER_CALLBACK){
 			SAMLNameIdentifierCallback cb = (SAMLNameIdentifierCallback)callback;
-			SAMLNameIdentifier nameId = new SAMLNameIdentifier(
-            		"David", null, SAMLNameIdentifier.FORMAT_EMAIL);
-			cb.setNameId(nameId);
+            try {
+                NameIdentifier nameId = SAMLUtils.createNamedIdentifier("David", NameIdentifier.EMAIL);
+                cb.setNameId(nameId);
+            } catch (TrustException e) {
+                throw new SAMLException("Error creating name identifier", e);
+            }
 		}
 		
 	}

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rampart/RampartTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rampart/RampartTest.java?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rampart/RampartTest.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/java/org/apache/rampart/RampartTest.java Sun Jan 29 15:16:02 2017
@@ -16,32 +16,44 @@
 
 package org.apache.rampart;
 
+import junit.framework.TestCase;
 import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.axis2.Constants;
+import org.apache.axiom.om.util.AXIOMUtil;
+import org.apache.axiom.soap.SOAPHeaderBlock;
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.integration.UtilServer;
 import org.apache.neethi.Policy;
 import org.apache.neethi.PolicyEngine;
-import org.apache.ws.security.handler.WSHandlerConstants;
 
-import junit.framework.TestCase;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
 
 
 public class RampartTest extends TestCase {
 
     public final static int PORT = UtilServer.TESTING_PORT;
 
+    private static ResourceBundle resources;
+
+    static {
+        try {
+            resources = ResourceBundle.getBundle("org.apache.rampart.errors");
+        } catch (MissingResourceException e) {
+            throw new RuntimeException(e.getMessage());
+        }
+    }
+
     public RampartTest(String name) {
         super(name);
     }
@@ -55,29 +67,36 @@ public class RampartTest extends TestCas
         UtilServer.stop();
     }
 
-    
+    private ServiceClient getServiceClientInstance() throws AxisFault {
+
+        String repository = Constants.TESTING_PATH + "rampart_client_repo";
+
+        ConfigurationContext configContext = ConfigurationContextFactory.
+                createConfigurationContextFromFileSystem(repository, null);
+        ServiceClient serviceClient = new ServiceClient(configContext, null);
+
+
+        serviceClient.engageModule("addressing");
+        serviceClient.engageModule("rampart");
+
+        return serviceClient;
+
+    }
+
     public void testWithPolicy() {
         try {
 
-            String repo = Constants.TESTING_PATH + "rampart_client_repo";
-    
-            ConfigurationContext configContext = ConfigurationContextFactory.
-                        createConfigurationContextFromFileSystem(repo, null);
-            ServiceClient serviceClient = new ServiceClient(configContext, null);
-            
-
-            serviceClient.engageModule("addressing");
-            serviceClient.engageModule("rampart");
+            ServiceClient serviceClient = getServiceClientInstance();
 
             //TODO : figure this out !!
-            boolean basic256Supported = true;
+            boolean basic256Supported = false;
             
             if(basic256Supported) {
                 System.out.println("\nWARNING: We are using key sizes from JCE " +
                         "Unlimited Strength Jurisdiction Policy !!!");
             }
             
-            for (int i = 1; i <= 30; i++) { //<-The number of tests we have
+            for (int i = 1; i <= 34; i++) { //<-The number of tests we have
                 if(!basic256Supported && (i == 3 || i == 4 || i == 5)) {
                     //Skip the Basic256 tests
                     continue;
@@ -106,19 +125,45 @@ public class RampartTest extends TestCas
                 context.setProperty(RampartMessageData.KEY_RAMPART_POLICY, 
                         loadPolicy("/rampart/policy/" + i + ".xml"));
                 serviceClient.setOptions(options);
-
-                // Invoking the serive in the TestCase-28 should fail. So handling it differently..
-                if (i == 28) {
+                
+                if (i == 31) {
+                    OMNamespace omNamespace = OMAbstractFactory.getOMFactory().createOMNamespace(
+                            "http://sample.com", "myNs");
+                    SOAPHeaderBlock header = OMAbstractFactory.getSOAP12Factory()
+                            .createSOAPHeaderBlock("VitalHeader", omNamespace);
+                    header.addChild(AXIOMUtil.stringToOM("<foo>This is a sample Header</foo>"));
+                    serviceClient.addHeader(header);
+                }
+                
+                // Invoking the service in the TestCase-28 should fail. So handling it differently..
+                if (i == 28 || i == 34) {
                     try {
+
                         //Blocking invocation
                         serviceClient.sendReceive(getOMElement());
-                        fail("Service Should throw an error..");
+
+                        String message = "";
+
+                        if (i == 34) {
+                            message = "Test case 34 should fail. We are running the service in symmetric binding mode " +
+                                      "and client in asymmetric binding mode. Therefore test case 34 should fail.";
+                        }
+
+                        fail("Service Should throw an error - " + message);
 
                     } catch (AxisFault axisFault) {
-                        assertEquals("Expected encrypted part missing", axisFault.getMessage());
+
+                        if (i == 28) {
+                            assertEquals(resources.getString("encryptionMissing"), axisFault.getMessage());
+                        } else if (i == 34) {
+                            // TODO this is failing in build server
+                            // Need to find the exact cause
+                            //assertEquals(resources.getString("invalidSignatureAlgo"), axisFault.getMessage());
+                            System.out.println(axisFault.getMessage());
+                        }
+
                     }
                 }
-
                 else{
                     //Blocking invocation
                     serviceClient.sendReceive(getEchoElement());
@@ -160,9 +205,9 @@ public class RampartTest extends TestCas
             }
 
             
-            for (int i = 1; i <= 3; i++) { //<-The number of tests we have
+            for (int i = 1; i <= 6; i++) { //<-The number of tests we have
                 
-                if (i == 2 || i == 3) {
+                if (i == 3 || i == 6) {
                     continue; // Can't test Transport binding scenarios with Simple HTTP Server
                 }
 
@@ -170,6 +215,10 @@ public class RampartTest extends TestCas
                 System.out.println("Testing WS-SecConv: custom scenario " + i);
                 options.setAction("urn:echo");
                 options.setTo(new EndpointReference("http://127.0.0.1:" + PORT + "/axis2/services/SecureServiceSC" + i));
+
+                //Create a new service client instance for each secure conversation scenario
+                serviceClient = getServiceClientInstance();
+
                 serviceClient.getServiceContext().setProperty(RampartMessageData.KEY_RAMPART_POLICY, loadPolicy("/rampart/policy/sc-" + i + ".xml"));
                 serviceClient.setOptions(options);
 
@@ -185,6 +234,8 @@ public class RampartTest extends TestCas
                 serviceClient.sendReceive(getEchoElement());
                 options.setProperty(RampartMessageData.CANCEL_REQUEST, Constants.VALUE_TRUE);
                 serviceClient.sendReceive(getEchoElement());
+                serviceClient.cleanupTransport();
+
             }
 
         } catch (Exception e) {

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/resources/rampart/policy/16.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/resources/rampart/policy/16.xml?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/resources/rampart/policy/16.xml (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/resources/rampart/policy/16.xml Sun Jan 29 15:16:02 2017
@@ -37,10 +37,10 @@
            </wsp:Policy>
          </sp:AsymmetricBinding>
          <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
-           <sp:Policy>
+           <wsp:Policy>
              <sp:MustSupportRefKeyIdentifier/>
              <sp:MustSupportRefIssuerSerial/>
-           </sp:Policy>
+           </wsp:Policy>
          </sp:Wss10>
          <sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
            <wsp:Policy/>

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/resources/rampart/policy/3.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/resources/rampart/policy/3.xml?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/resources/rampart/policy/3.xml (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/resources/rampart/policy/3.xml Sun Jan 29 15:16:02 2017
@@ -23,7 +23,7 @@
 					</sp:RecipientToken>
 					<sp:AlgorithmSuite>
 						<wsp:Policy>
-							<sp:Basic128/>
+							<sp:Basic256Sha256/>
 						</wsp:Policy>
 					</sp:AlgorithmSuite>
 					<sp:Layout>

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/resources/rampart/policy/30.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/resources/rampart/policy/30.xml?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/resources/rampart/policy/30.xml (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/resources/rampart/policy/30.xml Sun Jan 29 15:16:02 2017
@@ -40,10 +40,10 @@
                 </wsp:Policy>
             </sp:AsymmetricBinding>
             <sp:Wss10>
-                <sp:Policy>
+                <wsp:Policy>
                     <sp:MustSupportRefKeyIdentifier/>
                     <sp:MustSupportRefIssuerSerial/>
-                </sp:Policy>
+                </wsp:Policy>
             </sp:Wss10>
             <sp:EncryptedElements>
                 <sp:XPath xmlns:example1="http://example1.org/example1">//example1:Text</sp:XPath>

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/resources/rampart/services-16.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/resources/rampart/services-16.xml?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/resources/rampart/services-16.xml (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/resources/rampart/services-16.xml Sun Jan 29 15:16:02 2017
@@ -54,10 +54,10 @@
            </wsp:Policy>
          </sp:AsymmetricBinding>
          <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
-           <sp:Policy>
+           <wsp:Policy>
              <sp:MustSupportRefKeyIdentifier/>
              <sp:MustSupportRefIssuerSerial/>
-           </sp:Policy>
+           </wsp:Policy>
          </sp:Wss10>
          <sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
            <wsp:Policy/>

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/resources/rampart/services-3.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/resources/rampart/services-3.xml?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/resources/rampart/services-3.xml (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/resources/rampart/services-3.xml Sun Jan 29 15:16:02 2017
@@ -40,7 +40,7 @@
 						</sp:RecipientToken>
 						<sp:AlgorithmSuite>
 							<wsp:Policy>
-								<sp:Basic128/>
+								<sp:Basic256Sha256/>
 							</wsp:Policy>
 						</sp:AlgorithmSuite>
 						<sp:Layout>

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/resources/rampart/services-30.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/resources/rampart/services-30.xml?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/resources/rampart/services-30.xml (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-integration/src/test/resources/rampart/services-30.xml Sun Jan 29 15:16:02 2017
@@ -52,10 +52,10 @@
                     </wsp:Policy>
                 </sp:AsymmetricBinding>
                 <sp:Wss10>
-                    <sp:Policy>
+                    <wsp:Policy>
                         <sp:MustSupportRefKeyIdentifier/>
                         <sp:MustSupportRefIssuerSerial/>
-                    </sp:Policy>
+                    </wsp:Policy>
                 </sp:Wss10>
                 <sp:EncryptedElements>
                     <sp:XPath xmlns:example1="http://example1.org/example1">//example1:Text</sp:XPath>

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-mar/module.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-mar/module.xml?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-mar/module.xml (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-mar/module.xml Sun Jan 29 15:16:02 2017
@@ -28,6 +28,9 @@
     </OutFlow>
     
     <OutFaultFlow>
+        <handler name="SecurityOutHandler" class="org.apache.rampart.handler.WSDoAllSender">
+            <order phase="Security"/>
+        </handler>
         <handler name="PolicyBasedSecurityOutHandler" class="org.apache.rampart.handler.RampartSender">
             <order phase="Security" phaseLast="true"/>
         </handler>
@@ -37,6 +40,9 @@
         <handler name="PolicyBasedSecurityInHandler" class="org.apache.rampart.handler.RampartReceiver">
             <order phase="Security" phaseFirst="true"/>
         </handler>
+        <handler name="SecurityInHandler" class="org.apache.rampart.handler.WSDoAllReceiver">
+            <order phase="Security"/>
+        </handler>
     </InFaultFlow>
     
     <supported-policy-namespaces namespaces="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"/>

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-mar/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-mar/pom.xml?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-mar/pom.xml (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-mar/pom.xml Sun Jan 29 15:16:02 2017
@@ -1,134 +1,108 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <parent>
-        <groupId>org.apache.rampart</groupId>
-        <artifactId>rampart-project</artifactId>
-        <version>SNAPSHOT</version>
-        <relativePath>../../pom.xml</relativePath>
-    </parent>
-
-    <modelVersion>4.0.0</modelVersion>
-    <groupId>org.apache.rampart</groupId>
-    <artifactId>rampart</artifactId>
-    <packaging>mar</packaging>
-    <version>${rampart.mar.version}</version>
-    <!-- TODO need to remove this-->
-    <name>Rampart - Mar</name>
-
-    <scm>
-        <connection>scm:svn:https://svn.apache.org/repos/asf/webservices/rampart/trunk/java</connection>
-        <developerConnection>
-            scm:svn:https://svn.apache.org/repos/asf/webservices/rampart/trunk/java
-        </developerConnection>
-        <url>https://svn.apache.org/repos/asf/webservices/rampart/trunk/java</url>
-    </scm>
-
-    <build>
-        <sourceDirectory>src/main/java</sourceDirectory>
-        <resources>
-            <resource>
-                <directory>src/main/java</directory>
-            </resource>
-        </resources>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <configuration>
-                    <source>1.5</source>
-                    <target>1.5</target>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.axis2</groupId>
-                <artifactId>axis2-mar-maven-plugin</artifactId>
-                <version>1.2</version>
-                <extensions>true</extensions>
-                <configuration>
-                    <includeDependencies>false</includeDependencies>
-                    <moduleXmlFile>module.xml</moduleXmlFile>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>build-helper-maven-plugin</artifactId>
-                <version>1.0</version>
-                <executions>
-                    <execution>
-                        <id>aar</id>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>attach-artifact</goal>
-                        </goals>
-                        <configuration>
-                            <artifacts>
-                                <artifact>
-                                    <file>target/${pom.artifactId}-${pom.version}.mar</file>
-                                    <type>jar</type>
-                                </artifact>
-                            </artifacts>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.rampart</groupId>
-            <artifactId>rampart-policy</artifactId>
-            <version>${pom.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.rampart</groupId>
-            <artifactId>rampart-trust</artifactId>
-            <version>${pom.version}</version>
-        </dependency>
-    </dependencies>
-
-    <pluginRepositories>
-        <pluginRepository>
-            <id>apache-m2</id>
-            <name>Apache M2 Repository</name>
-            <url>http://people.apache.org/repo/m2-ibiblio-rsync-repository</url>
-            <layout>default</layout>
-            <snapshots>
-                <enabled>false</enabled>
-                <updatePolicy>daily</updatePolicy>
-                <checksumPolicy>ignore</checksumPolicy>
-            </snapshots>
-            <releases>
-                <enabled>true</enabled>
-            </releases>
-        </pluginRepository>
-        <pluginRepository>
-            <id>apache-snapshots</id>
-            <name>Apache Snapshots Repository</name>
-            <url>http://people.apache.org/repo/m2-snapshot-repository</url>
-            <layout>default</layout>
-            <snapshots>
-                <enabled>true</enabled>
-                <updatePolicy>daily</updatePolicy>
-                <checksumPolicy>ignore</checksumPolicy>
-            </snapshots>
-            <releases>
-                <enabled>false</enabled>
-            </releases>
-        </pluginRepository>
-    </pluginRepositories>
-    <distributionManagement>
-        <repository>
-            <id>apache-repo</id>
-            <name>Maven Central Repository</name>
-            <url>scpexe://people.apache.org//www/people.apache.org/repo/m2-ibiblio-rsync-repository</url>
-        </repository>
-        <snapshotRepository>
-            <id>apache-snapshots</id>
-            <name>Apache Development Repository</name>
-            <url>scpexe://people.apache.org//www/people.apache.org/repo/m2-snapshot-repository</url>
-            <uniqueVersion>false</uniqueVersion>
-        </snapshotRepository>
-    </distributionManagement>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <groupId>org.apache.rampart</groupId>
+        <artifactId>rampart-project</artifactId>
+        <version>1.7.0-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.apache.rampart</groupId>
+    <artifactId>rampart</artifactId>
+    <packaging>mar</packaging>
+    <name>Rampart - Mar</name>
+
+    <scm>
+		<connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/rampart/trunk</connection>
+        <developerConnection>
+            scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/rampart/trunk
+        </developerConnection>
+		<url>http://svn.apache.org/viewvc/axis/axis2/java/rampart/trunk</url>
+    </scm>
+
+    <build>
+        <sourceDirectory>src/main/java</sourceDirectory>
+        <resources>
+            <resource>
+                <directory>src/main/java</directory>
+            </resource>
+        </resources>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.5</source>
+                    <target>1.5</target>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.axis2</groupId>
+                <artifactId>axis2-mar-maven-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <includeDependencies>false</includeDependencies>
+                    <moduleXmlFile>module.xml</moduleXmlFile>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <version>1.0</version>
+                <executions>
+                    <execution>
+                        <id>aar</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>attach-artifact</goal>
+                        </goals>
+                        <configuration>
+                            <artifacts>
+                                <artifact>
+                                    <file>target/${project.artifactId}-${project.version}.mar</file>
+                                    <type>jar</type>
+                                </artifact>
+                            </artifacts>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.rampart</groupId>
+            <artifactId>rampart-policy</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.rampart</groupId>
+            <artifactId>rampart-trust</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+
+</project>

Propchange: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-mar/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/pom.xml?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/pom.xml (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/pom.xml Sun Jan 29 15:16:02 2017
@@ -1,11 +1,31 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
     <parent>
         <groupId>org.apache.rampart</groupId>
         <artifactId>rampart-project</artifactId>
-        <version>SNAPSHOT</version>
+        <version>1.7.0-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
 
@@ -41,9 +61,10 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-site-plugin</artifactId>
+                <version>2.0-beta-5</version>
                 <configuration>
                     <templateDirectory>${basedir}</templateDirectory>
-                    <menu ref="parent"/>
+                    <menu ref="parent" />
                 </configuration>
             </plugin>
         </plugins>

Propchange: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/META-INF/services/org.apache.neethi.builders.AssertionBuilder
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/META-INF/services/org.apache.neethi.builders.AssertionBuilder?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/META-INF/services/org.apache.neethi.builders.AssertionBuilder (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/META-INF/services/org.apache.neethi.builders.AssertionBuilder Sun Jan 29 15:16:02 2017
@@ -44,4 +44,5 @@ org.apache.ws.secpolicy12.builders.Secur
 org.apache.ws.secpolicy12.builders.SymmetricBindingBuilder
 org.apache.ws.secpolicy12.builders.IssuedTokenBuilder
 org.apache.ws.secpolicy12.builders.RequiredElementsBuilder
-org.apache.ws.secpolicy12.builders.ContentEncryptedElementsBuilder
\ No newline at end of file
+org.apache.ws.secpolicy12.builders.ContentEncryptedElementsBuilder
+org.apache.ws.secpolicy12.builders.HttpsTokenBuilder
\ No newline at end of file

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/SPConstants.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/SPConstants.java?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/SPConstants.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/SPConstants.java Sun Jan 29 15:16:02 2017
@@ -240,6 +240,12 @@ public class SPConstants {
     public final static String HMAC_SHA1 = "http://www.w3.org/2000/09/xmldsig#hmac-sha1";
 
     public final static String RSA_SHA1 = "http://www.w3.org/2000/09/xmldsig#rsa-sha1";
+    
+    public final static String RSA_SHA256 = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256";
+    
+    public final static String RSA_SHA384 = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha384";
+    
+    public final static String RSA_SHA512 = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha512";
 
     public final static String SHA1 = "http://www.w3.org/2000/09/xmldsig#sha1";
 

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/AbstractSecurityAssertion.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/AbstractSecurityAssertion.java?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/AbstractSecurityAssertion.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/AbstractSecurityAssertion.java Sun Jan 29 15:16:02 2017
@@ -15,6 +15,10 @@
  */
 package org.apache.ws.secpolicy.model;
 
+import javax.xml.namespace.QName;
+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.SP12Constants;
@@ -24,6 +28,7 @@ import org.apache.ws.secpolicy.SP12Const
 public abstract class AbstractSecurityAssertion implements Assertion {
 
     private boolean isOptional;
+    private boolean isIgnorable;
     
     private boolean normalized = true; 
     
@@ -36,6 +41,13 @@ public abstract class AbstractSecurityAs
     public void setOptional(boolean isOptional) {
         this.isOptional = isOptional;
     }
+    public boolean isIgnorable() {
+        return isIgnorable;
+    }
+    
+    public void setIgnorable(boolean isIgnorable) {
+        this.isIgnorable = isIgnorable;
+    }
 
     public short getType() {
         return org.apache.neethi.Constants.TYPE_ASSERTION;
@@ -69,5 +81,41 @@ public abstract class AbstractSecurityAs
         return version;
     }
     
-    
+    protected static void writeStartElement(XMLStreamWriter writer, String defaultPrefix, String localPart, String uri) throws XMLStreamException {
+        String prefix = writer.getPrefix(uri);
+        if (prefix != null) {
+            writer.writeStartElement(prefix, localPart, uri);
+        } else {
+            prefix = defaultPrefix;
+            writer.writeStartElement(prefix, localPart, uri);
+            writer.writeNamespace(prefix, uri);
+            writer.setPrefix(prefix, uri);
+        }
+    }
+
+    protected static void writeStartElement(XMLStreamWriter writer, QName name) throws XMLStreamException {
+        writeStartElement(writer, name.getPrefix(), name.getLocalPart(), name.getNamespaceURI());
+    }
+
+    protected static void writeEmptyElement(XMLStreamWriter writer, String defaultPrefix, String localPart, String uri) throws XMLStreamException {
+        String prefix = writer.getPrefix(uri);
+        if (prefix != null) {
+            writer.writeEmptyElement(prefix, localPart, uri);
+        } else {
+            prefix = defaultPrefix;
+            writer.writeStartElement(prefix, localPart, uri);
+            writer.writeNamespace(prefix, uri);
+            writer.writeEndElement();
+        }
+    }
+
+    protected static void writeAttribute(XMLStreamWriter writer, String defaultPrefix, String uri, String localPart, String value) throws XMLStreamException {
+        String prefix = writer.getPrefix(uri);
+        if (prefix == null) {
+            prefix = defaultPrefix;
+            writer.writeNamespace(prefix, uri);
+            writer.setPrefix(prefix, uri);
+        }
+        writer.writeAttribute(prefix, uri, localPart, value);
+    }
 }

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/AlgorithmSuite.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/AlgorithmSuite.java?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/AlgorithmSuite.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/AlgorithmSuite.java Sun Jan 29 15:16:02 2017
@@ -289,6 +289,11 @@ public class AlgorithmSuite extends Abst
      * @return Returns the asymmetricSignature.
      */
     public String getAsymmetricSignature() {
+    	if(this.digest == SPConstants.SHA256) {
+    		return SPConstants.RSA_SHA256;
+    	} else if(this.digest == SPConstants.SHA512) {
+    		return SPConstants.RSA_SHA512;
+    	}
         return asymmetricSignature;
     }
 
@@ -452,53 +457,36 @@ public class AlgorithmSuite extends Abst
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
 
+        String prefix = getName().getPrefix();
         String localName = getName().getLocalPart();
         String namespaceURI = getName().getNamespaceURI();
 
-        String prefix = writer.getPrefix(namespaceURI);
-
-        if (prefix == null) {
-            prefix = getName().getPrefix();
-            writer.setPrefix(prefix, namespaceURI);
-        }
-
-        writer.writeStartElement(prefix, localName, namespaceURI);
-        writer.writeNamespace(prefix, namespaceURI);
+        writeStartElement(writer, prefix, localName, namespaceURI);
 
         // <wsp:Policy>
-        writer.writeStartElement(SPConstants.POLICY.getPrefix(), SPConstants.POLICY
-                .getLocalPart(), SPConstants.POLICY.getNamespaceURI());
+        writeStartElement(writer, SPConstants.POLICY);
         
         //
-        writer.writeStartElement(prefix, getAlgoSuiteString(), namespaceURI);
-        writer.writeEndElement();
+        writeEmptyElement(writer, prefix, getAlgoSuiteString(), namespaceURI);
 
         if (SPConstants.C14N.equals(getInclusiveC14n())) {
-            writer.writeStartElement(prefix, SPConstants.INCLUSIVE_C14N, namespaceURI);
-            writer.writeEndElement();
+            writeEmptyElement(writer, prefix, SPConstants.INCLUSIVE_C14N, namespaceURI);
         }
 
         if (SPConstants.SNT.equals(getSoapNormalization())) {
-            writer.writeStartElement(prefix, SPConstants.SOAP_NORMALIZATION_10,
-                    namespaceURI);
-            writer.writeEndElement();
+            writeEmptyElement(writer, prefix, SPConstants.SOAP_NORMALIZATION_10, namespaceURI);
         }
 
         if (SPConstants.STRT10.equals(getStrTransform())) {
-            writer.writeStartElement(prefix, SPConstants.STR_TRANSFORM_10,
-                    namespaceURI);
-            writer.writeEndElement();
+            writeEmptyElement(writer, prefix, SPConstants.STR_TRANSFORM_10, namespaceURI);
         }
 
         if (SPConstants.XPATH.equals(getXPath())) {
-            writer.writeStartElement(prefix, SPConstants.XPATH10, namespaceURI);
-            writer.writeEndElement();
+            writeEmptyElement(writer, prefix, SPConstants.XPATH10, namespaceURI);
         }
 
         if (SPConstants.XPATH20.equals(getXPath())) {
-            writer.writeStartElement(prefix, SPConstants.XPATH_FILTER20,
-                    namespaceURI);
-            writer.writeEndElement();
+            writeEmptyElement(writer, prefix, SPConstants.XPATH_FILTER20, namespaceURI);
         }
         
         // </wsp:Policy>

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/AsymmetricBinding.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/AsymmetricBinding.java?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/AsymmetricBinding.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/AsymmetricBinding.java Sun Jan 29 15:16:02 2017
@@ -123,29 +123,15 @@ public class AsymmetricBinding extends S
     }
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
+        String prefix = getName().getPrefix();
         String localname = getName().getLocalPart();
         String namespaceURI = getName().getNamespaceURI();
 
-        String prefix = writer.getPrefix(namespaceURI);
-        
-        if (prefix == null) {
-            prefix = getName().getPrefix();
-            writer.setPrefix(prefix, namespaceURI);
-        }
-
         // <sp:AsymmetricBinding>
-        writer.writeStartElement(prefix, localname, namespaceURI);
-        writer.writeNamespace(prefix, namespaceURI);
-
-        String pPrefix = writer.getPrefix(SPConstants.POLICY.getNamespaceURI());
-        if (pPrefix == null) {
-            pPrefix = SPConstants.POLICY.getPrefix();
-            writer.setPrefix(pPrefix, SPConstants.POLICY.getNamespaceURI());
-        }
+        writeStartElement(writer, prefix, localname, namespaceURI);
 
         // <wsp:Policy>
-        writer.writeStartElement(pPrefix, SPConstants.POLICY.getLocalPart(),
-                SPConstants.POLICY.getNamespaceURI());
+        writeStartElement(writer, SPConstants.POLICY);
 
         if (initiatorToken == null) {
             throw new RuntimeException("InitiatorToken is not set");
@@ -180,40 +166,30 @@ public class AsymmetricBinding extends S
         }
 
         if (isIncludeTimestamp()) {
-            // <sp:IncludeTimestamp>
-            writer.writeStartElement(prefix, SPConstants.INCLUDE_TIMESTAMP,
-                    namespaceURI);
-            writer.writeEndElement();
-            // </sp:IncludeTimestamp>
+            // <sp:IncludeTimestamp />
+            writeEmptyElement(writer, prefix, SPConstants.INCLUDE_TIMESTAMP, namespaceURI);
         }
 
         if (SPConstants.ENCRYPT_BEFORE_SIGNING.equals(getProtectionOrder())) {
             // <sp:EncryptBeforeSign />
-            writer.writeStartElement(prefix, SPConstants.ENCRYPT_BEFORE_SIGNING,
-                    namespaceURI);
-            writer.writeEndElement();
+            writeEmptyElement(writer, prefix, SPConstants.ENCRYPT_BEFORE_SIGNING, namespaceURI);
         }
 
         if (isSignatureProtection()) {
             // <sp:EncryptSignature />
             // FIXME move the String constants to a QName
-            writer.writeStartElement(prefix, SPConstants.ENCRYPT_SIGNATURE,
-                    namespaceURI);
-            writer.writeEndElement();
+            writeEmptyElement(writer, prefix, SPConstants.ENCRYPT_SIGNATURE, namespaceURI);
         }
 
         if (isTokenProtection()) {
             // <sp:ProtectTokens />
-            writer.writeStartElement(prefix, SPConstants.PROTECT_TOKENS,
-                    namespaceURI);
-            writer.writeEndElement();
+            writeEmptyElement(writer, prefix, SPConstants.PROTECT_TOKENS, namespaceURI);
         }
 
         if (isEntireHeadersAndBodySignatures()) {
             // <sp:OnlySignEntireHeaderAndBody />
-            writer.writeStartElement(prefix,
-                    SPConstants.ONLY_SIGN_ENTIRE_HEADERS_AND_BODY, namespaceURI);
-            writer.writeEndElement();
+            writeEmptyElement(writer, prefix, SPConstants.ONLY_SIGN_ENTIRE_HEADERS_AND_BODY,
+                    namespaceURI);
         }
 
         // </wsp:Policy>

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/ContentEncryptedElements.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/ContentEncryptedElements.java?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/ContentEncryptedElements.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/ContentEncryptedElements.java Sun Jan 29 15:16:02 2017
@@ -77,32 +77,15 @@ public class ContentEncryptedElements ex
         
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
 
+        String prefix = getName().getPrefix();
         String localName = getName().getLocalPart();
         String namespaceURI = getName().getNamespaceURI();
 
-        String prefix;
-        String writerPrefix = writer.getPrefix(namespaceURI);
-
-        if (writerPrefix == null) {
-            prefix = getName().getPrefix();
-            writer.setPrefix(prefix, namespaceURI);
-        } else {
-            prefix = writerPrefix;
-        }
-
         //  <sp:ContentEncryptedElements>
-        writer.writeStartElement(prefix, localName, namespaceURI);
+        writeStartElement(writer, prefix, localName, namespaceURI);
         
-        // xmlns:sp=".."
-        writer.writeNamespace(prefix, namespaceURI);
-
-        if (writerPrefix == null) {
-            // xmlns:sp=".."
-            writer.writeNamespace(prefix, namespaceURI);
-        }
-
         if (xPathVersion != null) {
-            writer.writeAttribute(prefix, namespaceURI, SPConstants.XPATH_VERSION, xPathVersion);
+            writeAttribute(writer, prefix, namespaceURI, SPConstants.XPATH_VERSION, xPathVersion);
         }
 
         String xpathExpression;
@@ -111,7 +94,7 @@ public class ContentEncryptedElements ex
                 .hasNext();) {
             xpathExpression = (String) iterator.next();
             // <sp:XPath ..>
-            writer.writeStartElement(prefix, SPConstants.XPATH_EXPR, namespaceURI);
+            writeStartElement(writer, prefix, SPConstants.XPATH_EXPR, namespaceURI);
             writer.writeCharacters(xpathExpression);
             writer.writeEndElement();
         }

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/EncryptionToken.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/EncryptionToken.java?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/EncryptionToken.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/EncryptionToken.java Sun Jan 29 15:16:02 2017
@@ -60,49 +60,11 @@ public class EncryptionToken extends Abs
     }
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
-        String localname = getName().getLocalPart();
-        String namespaceURI = getName().getNamespaceURI();
-        String prefix;
-        
-        String writerPrefix = writer.getPrefix(namespaceURI);
-        
-        if (writerPrefix == null) {
-            prefix = getName().getPrefix();
-            writer.setPrefix(prefix, namespaceURI);
-        } else {
-            prefix = writerPrefix;
-        }
-        
         // <sp:EncryptionToken>
-        writer.writeStartElement(prefix, localname, namespaceURI);
-        
-        if (writerPrefix == null) {
-            // xmlns:sp=".."
-            writer.writeNamespace(prefix, namespaceURI);
-        }
-        
-        
-        String wspNamespaceURI = SPConstants.POLICY.getNamespaceURI();
-        
-        String wspPrefix;
-        
-        String wspWriterPrefix = writer.getPrefix(wspNamespaceURI);
-        
-        if (wspWriterPrefix == null) {
-            wspPrefix = SPConstants.POLICY.getPrefix();
-            writer.setPrefix(wspPrefix, wspNamespaceURI);
-            
-        } else {
-            wspPrefix = wspWriterPrefix;
-        }
+        writeStartElement(writer, getName());
         
         // <wsp:Policy>
-        writer.writeStartElement(wspPrefix, SPConstants.POLICY.getLocalPart(), wspNamespaceURI);
-        
-        if (wspWriterPrefix == null) {
-            // xmlns:wsp=".."
-            writer.writeNamespace(wspPrefix, wspNamespaceURI);
-        }
+        writeStartElement(writer, SPConstants.POLICY);
         
         if (encryptionToken == null) {
             throw new RuntimeException("EncryptionToken is not set");

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/HttpsToken.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/HttpsToken.java?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/HttpsToken.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/HttpsToken.java Sun Jan 29 15:16:02 2017
@@ -93,17 +93,12 @@ public class HttpsToken extends Token {
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
 
+        String prefix = getName().getPrefix();
         String localname = getName().getLocalPart();
         String namespaceURI = getName().getNamespaceURI();
 
-        String prefix = writer.getPrefix(namespaceURI);
-        if (prefix == null) {
-            prefix = getName().getPrefix();
-            writer.setPrefix(prefix, namespaceURI);
-        }
-
         // <sp:HttpsToken
-        writer.writeStartElement(prefix, localname, namespaceURI);
+        writeStartElement(writer, prefix, localname, namespaceURI);
 
 
         if (version == SPConstants.SP_V12) {
@@ -112,7 +107,7 @@ public class HttpsToken extends Token {
                 isHttpBasicAuthentication() ||
                 isHttpDigestAuthentication()) {
                 // <wsp:Policy>
-                writer.writeStartElement(SPConstants.POLICY.getPrefix(), SPConstants.POLICY.getLocalPart(), SPConstants.POLICY.getNamespaceURI());
+                writeStartElement(writer, SPConstants.POLICY);
                 
                 /*
                  *  The ws policy 1.2 specification states that only one of those should be present, although
@@ -120,14 +115,11 @@ public class HttpsToken extends Token {
                  * a http user/pwd authentication. Nevertheless stick to the specification.
                  */
                 if(isHttpBasicAuthentication()) {
-                    writer.writeStartElement(prefix, SPConstants.HTTP_BASIC_AUTHENTICATION.getLocalPart(), namespaceURI);
-                    writer.writeEndElement();
+                    writeEmptyElement(writer, prefix, SPConstants.HTTP_BASIC_AUTHENTICATION.getLocalPart(), namespaceURI);
                 } else if(isHttpDigestAuthentication()) {
-                    writer.writeStartElement(prefix, SPConstants.HTTP_DIGEST_AUTHENTICATION.getLocalPart(), namespaceURI);
-                    writer.writeEndElement();
+                    writeEmptyElement(writer, prefix, SPConstants.HTTP_DIGEST_AUTHENTICATION.getLocalPart(), namespaceURI);
                 } else if(isRequireClientCertificate()) {
-                    writer.writeStartElement(prefix, SPConstants.REQUIRE_CLIENT_CERTIFICATE.getLocalPart(), namespaceURI);
-                    writer.writeEndElement();
+                    writeEmptyElement(writer, prefix, SPConstants.REQUIRE_CLIENT_CERTIFICATE.getLocalPart(), namespaceURI);
                 }
                 // </wsp:Policy>
                 writer.writeEndElement();

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/InitiatorToken.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/InitiatorToken.java?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/InitiatorToken.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/InitiatorToken.java Sun Jan 29 15:16:02 2017
@@ -65,27 +65,11 @@ public class InitiatorToken extends Abst
     }
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
-        String localName = getName().getLocalPart();
-        String namespaceURI = getName().getNamespaceURI();
-
-        String prefix = writer.getPrefix(namespaceURI);
-
-        if (prefix == null) {
-            prefix = getName().getPrefix();
-            writer.setPrefix(prefix, namespaceURI);
-        }
-        
         // <sp:InitiatorToken>
-        writer.writeStartElement(prefix, localName, namespaceURI);
-        
-        String pPrefix = writer.getPrefix(SPConstants.POLICY.getNamespaceURI());
-        if (pPrefix == null) {
-            pPrefix = SPConstants.POLICY.getPrefix();
-            writer.setPrefix(pPrefix, SPConstants.POLICY.getNamespaceURI());
-        }
+        writeStartElement(writer, getName());
         
         // <wsp:Policy>
-        writer.writeStartElement(pPrefix, SPConstants.POLICY.getLocalPart(), SPConstants.POLICY.getNamespaceURI());
+        writeStartElement(writer, SPConstants.POLICY);
 
         Token token = getInitiatorToken();
         if (token == null) {

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/IssuedToken.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/IssuedToken.java?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/IssuedToken.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/IssuedToken.java Sun Jan 29 15:16:02 2017
@@ -113,26 +113,12 @@ public class IssuedToken extends Token {
     }
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
+        String prefix = getName().getPrefix();
         String localname = getName().getLocalPart();
         String namespaceURI = getName().getNamespaceURI();
 
-        String prefix;
-        String writerPrefix = writer.getPrefix(namespaceURI);
-
-        if (writerPrefix == null) {
-            prefix = getName().getPrefix();
-            writer.setPrefix(prefix, namespaceURI);
-
-        } else {
-            prefix = writerPrefix;
-        }
-
         // <sp:IssuedToken>
-        writer.writeStartElement(prefix, localname, namespaceURI);
-
-        if (writerPrefix == null) {
-            writer.writeNamespace(prefix, namespaceURI);
-        }
+        writeStartElement(writer, prefix, localname, namespaceURI);
 
         String inclusion;
         
@@ -143,12 +129,12 @@ public class IssuedToken extends Token {
         }
         
         if (inclusion != null) {
-            writer.writeAttribute(prefix, namespaceURI,
+            writeAttribute(writer, prefix, namespaceURI,
                     SPConstants.ATTR_INCLUDE_TOKEN, inclusion);
         }
 
         if (issuerEpr != null) {
-            writer.writeStartElement(prefix, SPConstants.ISSUER,
+            writeStartElement(writer, prefix, SPConstants.ISSUER,
                     namespaceURI);
             issuerEpr.serialize(writer);
             writer.writeEndElement();
@@ -160,47 +146,27 @@ public class IssuedToken extends Token {
 
         }
 
-        String policyLocalName = SPConstants.POLICY.getLocalPart();
-        String policyNamespaceURI = SPConstants.POLICY.getNamespaceURI();
-
-        String wspPrefix;
-
-        String wspWriterPrefix = writer.getPrefix(policyNamespaceURI);
-
-        if (wspWriterPrefix == null) {
-            wspPrefix = SPConstants.POLICY.getPrefix();
-            writer.setPrefix(wspPrefix, policyNamespaceURI);
-        } else {
-            wspPrefix = wspWriterPrefix;
-        }
-
         if (isRequireExternalReference() || isRequireInternalReference() ||
                 this.isDerivedKeys()) {
 
             // <wsp:Policy>
-            writer.writeStartElement(wspPrefix, policyLocalName,
-                    policyNamespaceURI);
-
-            if (wspWriterPrefix == null) {
-                // xmlns:wsp=".."
-                writer.writeNamespace(wspPrefix, policyNamespaceURI);
-            }
+            writeStartElement(writer, SPConstants.POLICY);
 
             if (isRequireExternalReference()) {
                 // <sp:RequireExternalReference />
-                writer.writeEmptyElement(prefix, SPConstants.REQUIRE_EXTERNAL_REFERNCE,
+                writeEmptyElement(writer, prefix, SPConstants.REQUIRE_EXTERNAL_REFERNCE,
                         namespaceURI);
             }
 
             if (isRequireInternalReference()) {
                 // <sp:RequireInternalReference />
-                writer.writeEmptyElement(prefix, SPConstants.REQUIRE_INTERNAL_REFERNCE,
+                writeEmptyElement(writer, prefix, SPConstants.REQUIRE_INTERNAL_REFERNCE,
                         namespaceURI);
             }
 
             if (this.isDerivedKeys()) {
                 // <sp:RequireDerivedKeys />
-                writer.writeEmptyElement(prefix, SPConstants.REQUIRE_DERIVED_KEYS,
+                writeEmptyElement(writer, prefix, SPConstants.REQUIRE_DERIVED_KEYS,
                         namespaceURI);
             }
             

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/Layout.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/Layout.java?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/Layout.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/Layout.java Sun Jan 29 15:16:02 2017
@@ -70,39 +70,30 @@ public class Layout extends AbstractSecu
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
 
+        String prefix = getName().getPrefix();
         String localName = getName().getLocalPart();
         String namespaceURI = getName().getNamespaceURI();
 
-        String prefix = writer.getPrefix(namespaceURI);
-
-        if (prefix == null) {
-            prefix = getName().getPrefix();
-            writer.setPrefix(prefix, namespaceURI);
-        }
-
         // <sp:Layout>
-        writer.writeStartElement(prefix, localName, namespaceURI);
+        writeStartElement(writer, prefix, localName, namespaceURI);
 
         // <wsp:Policy>
-        writer.writeStartElement(SPConstants.POLICY.getPrefix(), SPConstants.POLICY
-                .getLocalPart(), SPConstants.POLICY.getNamespaceURI());
+        writeStartElement(writer, SPConstants.POLICY);
 
         // .. <sp:Strict /> | <sp:Lax /> | <sp:LaxTsFirst /> | <sp:LaxTsLast /> ..
         if (SPConstants.LAYOUT_STRICT.equals(value)) {
-            writer.writeStartElement(prefix, SPConstants.LAYOUT_STRICT, namespaceURI);
+            writeEmptyElement(writer, prefix, SPConstants.LAYOUT_STRICT, namespaceURI);
             
         } else if (SPConstants.LAYOUT_LAX.equals(value)) {
-            writer.writeStartElement(prefix, SPConstants.LAYOUT_LAX, namespaceURI);
+            writeEmptyElement(writer, prefix, SPConstants.LAYOUT_LAX, namespaceURI);
             
         } else if (SPConstants.LAYOUT_LAX_TIMESTAMP_FIRST.equals(value)) {
-            writer.writeStartElement(prefix, SPConstants.LAYOUT_LAX_TIMESTAMP_FIRST, namespaceURI);
+            writeEmptyElement(writer, prefix, SPConstants.LAYOUT_LAX_TIMESTAMP_FIRST, namespaceURI);
             
         } else if (SPConstants.LAYOUT_LAX_TIMESTAMP_LAST.equals(value)) {
-            writer.writeStartElement(prefix, SPConstants.LAYOUT_LAX_TIMESTAMP_LAST, namespaceURI);
+            writeEmptyElement(writer, prefix, SPConstants.LAYOUT_LAX_TIMESTAMP_LAST, namespaceURI);
         }
         
-        writer.writeEndElement();
-        
         // </wsp:Policy>
         writer.writeEndElement();
         

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/ProtectionToken.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/ProtectionToken.java?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/ProtectionToken.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/ProtectionToken.java Sun Jan 29 15:16:02 2017
@@ -68,49 +68,11 @@ public class ProtectionToken extends Abs
     }
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
-        String localname = getName().getLocalPart();
-        String namespaceURI = getName().getNamespaceURI();
-        
-        String prefix;
-        
-        String writerPrefix = writer.getPrefix(namespaceURI);
-        if (writerPrefix == null) {
-            prefix = getName().getPrefix();
-            writer.setPrefix(prefix, namespaceURI);
-            
-        } else {
-            prefix = writerPrefix;
-        }
-        
         // <sp:ProtectionToken>
-        writer.writeStartElement(prefix, localname, namespaceURI);
-        
-        if (writerPrefix == null) {
-            // xmlns:sp=".."
-            writer.writeNamespace(prefix, namespaceURI);
-        }
-        
-        String policyLocalName = SPConstants.POLICY.getLocalPart();
-        String policyNamespaceURI = SPConstants.POLICY.getNamespaceURI();
-        
-        String wspPrefix;
-        
-        String wspWriterPrefix = writer.getPrefix(policyNamespaceURI);
-        
-        if (wspWriterPrefix == null) {
-            wspPrefix = SPConstants.POLICY.getPrefix();
-            writer.setPrefix(wspPrefix, policyNamespaceURI);
-        } else {
-            wspPrefix = wspWriterPrefix;
-        }
+        writeStartElement(writer, getName());
         
         // <wsp:Policy>
-        writer.writeStartElement(wspPrefix, policyLocalName, policyNamespaceURI);
-        
-        if (wspWriterPrefix == null) {
-            // xmlns:wsp=".."
-            writer.writeNamespace(wspPrefix, policyNamespaceURI);
-        }
+        writeStartElement(writer, SPConstants.POLICY);
         
         if (protectionToken == null) {
             throw new RuntimeException("ProtectionToken is not set");

Modified: axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/RecipientToken.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/RecipientToken.java?rev=1780804&r1=1780803&r2=1780804&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/RecipientToken.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-252/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/RecipientToken.java Sun Jan 29 15:16:02 2017
@@ -67,27 +67,11 @@ public class RecipientToken extends Abst
     }
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
-        String localName = getName().getLocalPart();
-        String namespaceURI = getName().getNamespaceURI();
-
-        String prefix = writer.getPrefix(namespaceURI);
-
-        if (prefix == null) {
-            prefix = getName().getPrefix();
-            writer.setPrefix(prefix, namespaceURI);
-        }
-        
         // <sp:RecipientToken>
-        writer.writeStartElement(prefix, localName, namespaceURI);
-        
-        String pPrefix = writer.getPrefix(SPConstants.POLICY.getNamespaceURI());
-        if (pPrefix == null) {
-            pPrefix = SPConstants.POLICY.getPrefix();
-            writer.setPrefix(pPrefix, SPConstants.POLICY.getNamespaceURI());
-        }
+        writeStartElement(writer, getName());
         
         // <wsp:Policy>
-        writer.writeStartElement(pPrefix, SPConstants.POLICY.getLocalPart(), SPConstants.POLICY.getNamespaceURI());
+        writeStartElement(writer, SPConstants.POLICY);
 
         Token token = getReceipientToken();
         if (token == null) {