You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ru...@apache.org on 2006/07/17 19:20:27 UTC

svn commit: r422766 - in /webservices/axis2/trunk/java/modules: integration/test/org/apache/rahas/ rahas/src/org/apache/rahas/ rahas/src/org/apache/rahas/impl/ security/src/org/apache/rampart/conversation/ security/src/org/apache/rampart/handler/

Author: ruchithf
Date: Mon Jul 17 10:20:26 2006
New Revision: 422766

URL: http://svn.apache.org/viewvc?rev=422766&view=rev
Log:
Improving  multiple version handling of rahas

Modified:
    webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/TestClient.java
    webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/RahasConstants.java
    webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TokenRequestDispatcher.java
    webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TrustUtil.java
    webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/errors.properties
    webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SAMLTokenIssuer.java
    webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SCTIssuer.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/conversation/ConversationConfiguration.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/conversation/STSRequester.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/conversation/Util.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/handler/WSDoAllSender.java

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenTest.java?rev=422766&r1=422765&r2=422766&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenTest.java Mon Jul 17 10:20:26 2006
@@ -71,20 +71,20 @@
 
         RequestSecurityTokenType rst = new RequestSecurityTokenType();
         try {
-            rst.setRequestType(new URI(org.apache.rahas.RahasConstants.REQ_TYPE_ISSUE));
-            rst.setTokenType(new URI(org.apache.rahas.RahasConstants.TOK_TYPE_SAML_10));
+            rst.setRequestType(new URI(RahasConstants.V_05_02.REQ_TYPE_ISSUE));
+            rst.setTokenType(new URI(RahasConstants.TOK_TYPE_SAML_10));
             rst.setContext(new URI("http://get.optional.attrs.working"));
             
             Axis2Util.useDOOM(false);
             StAXOMBuilder builder = new StAXOMBuilder(new StreamWrapper(rst
-                    .getPullParser(new QName(org.apache.rahas.RahasConstants.WST_NS,
-                            org.apache.rahas.RahasConstants.REQUEST_SECURITY_TOKEN_LN))));
+                    .getPullParser(new QName(RahasConstants.WST_NS_05_02,
+                            RahasConstants.REQUEST_SECURITY_TOKEN_LN))));
 
             OMElement rstElem = builder.getDocumentElement();
 
             rstElem.build();
             
-            OMElement appliesToElem = TrustUtil.createAppliesToElement(rstElem);
+            OMElement appliesToElem = TrustUtil.createAppliesToElement(RahasConstants.VERSION_05_02, rstElem);
             appliesToElem.setText("http://localhost:5555/axis2/services/SecureService");
             
             rstElem = (OMElement)rstElem.detach();
@@ -96,7 +96,7 @@
     }
     
     public void validateRsponse(OMElement resp) {
-        OMElement rst = resp.getFirstChildWithName(new QName(RahasConstants.WST_NS, RahasConstants.REQUESTED_SECURITY_TOKEN_LN));
+        OMElement rst = resp.getFirstChildWithName(new QName(RahasConstants.WST_NS_05_02, RahasConstants.REQUESTED_SECURITY_TOKEN_LN));
         assertNotNull("RequestedSecurityToken missing", rst);
         OMElement elem = rst.getFirstChildWithName(new QName(XML.SAML_NS, "Assertion"));
         assertNotNull("Missing SAML Assertoin", elem);

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/TestClient.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/TestClient.java?rev=422766&r1=422765&r2=422766&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/TestClient.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/TestClient.java Mon Jul 17 10:20:26 2006
@@ -63,7 +63,7 @@
             Options options = new Options();
             options.setTo(new EndpointReference("http://127.0.0.1:" + port + "/axis2/services/SecureService"));
             options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-            options.setAction(org.apache.rahas.RahasConstants.RST_ACTON_SCT);
+            options.setAction(org.apache.rahas.RahasConstants.V_05_02.RST_ACTON_SCT);
             
 
 

Modified: webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/RahasConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/RahasConstants.java?rev=422766&r1=422765&r2=422766&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/RahasConstants.java (original)
+++ webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/RahasConstants.java Mon Jul 17 10:20:26 2006
@@ -18,6 +18,9 @@
 
 public class RahasConstants {
     
+    public final static int VERSION_05_02 = 1;
+    public final static int VERSION_05_12 = 2;
+    
     /**
      * WS-Trust 2005 Feb namespace
      */
@@ -32,12 +35,6 @@
     
     public final static String WSP_NS = "http://schemas.xmlsoap.org/ws/2004/09/policy";
     public final static String WSP_PREFIX = "wsp";
-    
-    public static String WST_NS = WST_NS_05_02;
-    
-    public static void setVersion(String ns) {
-        WST_NS = ns;
-    }
 
     //Local names
     public final static String REQUEST_TYPE_LN = "RequestType";
@@ -45,6 +42,7 @@
     public final static String REQUEST_SECURITY_TOKEN_LN = "RequestSecurityToken";
     public static final String REQUESTED_PROOF_TOKEN_LN = "RequestedProofToken";
     public static final String REQUEST_SECURITY_TOKEN_RESPONSE_LN = "RequestSecurityTokenResponse";
+    public static final String REQUEST_SECURITY_TOKEN_RESPONSE_COLLECTION_LN = "RequestSecurityTokenResponseCollection";
     public static final String REQUESTED_SECURITY_TOKEN_LN = "RequestedSecurityToken";
     public final static String BINARY_SECRET_LN = "BinarySecret";
     public final static String REQUESTED_ATTACHED_REFERENCE_LN = "RequestedAttachedReference";
@@ -54,34 +52,66 @@
     public final static String APPLIES_TO_LN = "AppliesTo";
     public final static String LIFETIME_LN = "Lifetime";
     
-    //RequestTypes
-    public final static String REQ_TYPE_ISSUE = WST_NS + "/Issue";
-    public final static String REQ_TYPE_VALIDATE = WST_NS + "/Validate";
-    public final static String REQ_TYPE_RENEW = WST_NS + "/Renew";
-    public final static String REQ_TYPE_CANCEL = WST_NS + "/Cancel";
-
-    //Token types
-    public final static String TOK_TYPE_SCT = "http://schemas.xmlsoap.org/ws/2005/02/sc/sct";
-    public final static String TOK_TYPE_SAML_10="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1";
     
+    public class V_05_02 { 
+        //RequestTypes
+        public final static String REQ_TYPE_ISSUE = WST_NS_05_02 + "/Issue";
+        public final static String REQ_TYPE_VALIDATE = WST_NS_05_02 + "/Validate";
+        public final static String REQ_TYPE_RENEW = WST_NS_05_02 + "/Renew";
+        public final static String REQ_TYPE_CANCEL = WST_NS_05_02 + "/Cancel";
+        
+        //RST actions
+        public final static String RST_ACTON_ISSUE = WST_NS_05_02 + "/RST/Issue";
+        public final static String RST_ACTON_VALIDATE = WST_NS_05_02 + "/RST/Renew";
+        public final static String RST_ACTON_RENEW = WST_NS_05_02 + "/RST/Cancel";
+        public final static String RST_ACTON_CANCEL = WST_NS_05_02 + "/RST/Validate";
+        public final static String RST_ACTON_SCT = WST_NS_05_02 + "/RST/SCT";
+        
+        //RSTR actions
+        public final static String RSTR_ACTON_ISSUE = WST_NS_05_02 + "/RSTR/Issue";
+        public final static String RSTR_ACTON_VALIDATE = WST_NS_05_02 + "/RSTR/Renew";
+        public final static String RSTR_ACTON_RENEW = WST_NS_05_02 + "/RSTR/Cancel";
+        public final static String RSTR_ACTON_CANCEL = WST_NS_05_02 + "/RSTR/Validate";
+        public final static String RSTR_ACTON_SCT = WST_NS_05_02 + "/RSTR/SCT";
+        //Attr values
+        public final static String BIN_SEC_TYPE_NONCE = WST_NS_05_02 + "/Nonce";
+        
+        //Token types
+        public final static String TOK_TYPE_SCT = "http://schemas.xmlsoap.org/ws/2005/02/sc/sct";
+    }
     
-    //RST actions
-    public final static String RST_ACTON_ISSUE = WST_NS + "/RST/Issue";
-    public final static String RST_ACTON_VALIDATE = WST_NS + "/RST/Renew";
-    public final static String RST_ACTON_RENEW = WST_NS + "/RST/Cancel";
-    public final static String RST_ACTON_CANCEL = WST_NS + "/RST/Validate";
-    public final static String RST_ACTON_SCT = WST_NS + "/RST/SCT";
-    
-    //RSTR actions
-    public final static String RSTR_ACTON_ISSUE = WST_NS + "/RSTR/Issue";
-    public final static String RSTR_ACTON_VALIDATE = WST_NS + "/RSTR/Renew";
-    public final static String RSTR_ACTON_RENEW = WST_NS + "/RSTR/Cancel";
-    public final static String RSTR_ACTON_CANCEL = WST_NS + "/RSTR/Validate";
-    public final static String RSTR_ACTON_SCT = WST_NS + "/RSTR/SCT";
+    public class V_05_12 { 
+        //RequestTypes
+        public final static String REQ_TYPE_ISSUE = WST_NS_05_12 + "/Issue";
+        public final static String REQ_TYPE_VALIDATE = WST_NS_05_12 + "/Validate";
+        public final static String REQ_TYPE_RENEW = WST_NS_05_12 + "/Renew";
+        public final static String REQ_TYPE_CANCEL = WST_NS_05_12 + "/Cancel";
+        
+        //RST actions
+        public final static String RST_ACTON_ISSUE = WST_NS_05_12 + "/RST/Issue";
+        public final static String RST_ACTON_VALIDATE = WST_NS_05_12 + "/RST/Renew";
+        public final static String RST_ACTON_RENEW = WST_NS_05_12 + "/RST/Cancel";
+        public final static String RST_ACTON_CANCEL = WST_NS_05_12 + "/RST/Validate";
+        public final static String RST_ACTON_SCT = WST_NS_05_12 + "/RST/SCT";
+        
+        //RSTR actions
+        public final static String RSTR_ACTON_ISSUE = WST_NS_05_12 + "/RSTR/Issue";
+        public final static String RSTR_ACTON_VALIDATE = WST_NS_05_12 + "/RSTR/Renew";
+        public final static String RSTR_ACTON_RENEW = WST_NS_05_12 + "/RSTR/Cancel";
+        public final static String RSTR_ACTON_CANCEL = WST_NS_05_12 + "/RSTR/Validate";
+        public final static String RSTR_ACTON_SCT = WST_NS_05_12 + "/RSTR/SCT";
+        //Attr values
+        public final static String BIN_SEC_TYPE_NONCE = WST_NS_05_12 + "/Nonce";
+        
+        //Token types
+        public final static String TOK_TYPE_SCT = "http://schemas.xmlsoap.org/ws/2005/12/sc/sct";
+    }
     
+    //Token types
+    public final static String TOK_TYPE_SAML_10="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1";
+ 
     //Attrs
     public final static String ATTR_TYPE = "Type";
     
-    //Attr values
-    public final static String BIN_SEC_TYPE_NONCE = WST_NS + "/Nonce";
+
 }

Modified: webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TokenRequestDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TokenRequestDispatcher.java?rev=422766&r1=422765&r2=422766&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TokenRequestDispatcher.java (original)
+++ webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TokenRequestDispatcher.java Mon Jul 17 10:20:26 2006
@@ -13,14 +13,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.rahas;
 
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.databinding.types.URI;
-import org.apache.rahas.types.RequestSecurityTokenType;
 
 import javax.xml.namespace.QName;
 
@@ -51,30 +48,54 @@
     public SOAPEnvelope handle(MessageContext inMsgCtx, MessageContext outMsgCtx)
             throws TrustException {
 
+        //figureout the WS-Trust version and get the RST element
+        int version;
+        String ns;
         
-        RequestSecurityTokenType request = null;
         OMElement rstElem = inMsgCtx.getEnvelope().getBody()
                 .getFirstChildWithName(
-                        new QName(RahasConstants.WST_NS,
+                        new QName(RahasConstants.WST_NS_05_02,
                                 RahasConstants.REQUEST_SECURITY_TOKEN_LN));
-        try {
-            request = RequestSecurityTokenType.Factory.parse(rstElem
-                    .getXMLStreamReader());
-        } catch (Exception e) {
-            e.printStackTrace();
-            throw new TrustException(TrustException.INVALID_REQUEST, 
-                    new String[] { "missing " + RahasConstants.WST_PREFIX + ":"
-                            + RahasConstants.REQUEST_SECURITY_TOKEN_LN }, e);
+        if(rstElem != null) {
+            version = RahasConstants.VERSION_05_02;
+        } else {
+            rstElem = inMsgCtx.getEnvelope().getBody().getFirstChildWithName(
+                    new QName(RahasConstants.WST_NS_05_12,
+                            RahasConstants.REQUEST_SECURITY_TOKEN_LN));
+            if(rstElem != null) {
+                version = RahasConstants.VERSION_05_12;
+            } else {
+                throw new TrustException(TrustException.INVALID_REQUEST);
+            }
         }
         
-        URI reqType = request.getRequestType();
-        URI tokenType = request.getTokenType();
+        ns = TrustUtil.getWSTNamespace(version);
 
-        if (reqType == null
-                || (reqType != null && "".equals(reqType.toString()))) {
+        // Get the req type
+        OMElement reqTypeElem = rstElem.getFirstChildWithName(new QName(ns,
+                RahasConstants.REQUEST_TYPE_LN));
+        String reqType = null;
+
+        if (reqTypeElem == null
+                || (reqTypeElem != null && reqTypeElem.getText() != null && ""
+                        .equals(reqTypeElem.getText().trim()))) {
             throw new TrustException(TrustException.INVALID_REQUEST);
+        } else {
+            reqType = reqTypeElem.getText().trim();
         }
-        if (RahasConstants.REQ_TYPE_ISSUE.equals(reqType.toString())) {
+        
+        // Get the token type
+        OMElement tokTypeElem = rstElem.getFirstChildWithName(new QName(ns,
+                RahasConstants.TOKEN_TYPE_LN));
+        String tokenType = null;
+
+        if (tokTypeElem != null && tokTypeElem.getText() != null
+                && !"".equals(tokTypeElem.getText().trim())) {
+            tokenType = tokTypeElem.getText().trim();
+        }
+        
+        if (RahasConstants.V_05_02.REQ_TYPE_ISSUE.equals(reqType) ||
+                RahasConstants.V_05_12.REQ_TYPE_ISSUE.equals(reqType)) {
             TokenIssuer issuer = null;
             if (tokenType == null
                     || (tokenType != null && "".equals(tokenType.toString()))) {
@@ -90,13 +111,16 @@
                     issuer.getResponseAction(rstElem, inMsgCtx));
             
             return response;
-        } else if(RahasConstants.REQ_TYPE_VALIDATE.equals(reqType.toString())) {
+        } else if(RahasConstants.V_05_02.REQ_TYPE_VALIDATE.equals(reqType) ||
+                RahasConstants.V_05_12.REQ_TYPE_VALIDATE.equals(reqType)) {
             throw new UnsupportedOperationException("TODO: handle " +
                     "validate requests");
-        } else if(RahasConstants.REQ_TYPE_RENEW.equals(reqType.toString())) {
+        } else if(RahasConstants.V_05_02.REQ_TYPE_RENEW.equals(reqType) ||
+                RahasConstants.V_05_12.REQ_TYPE_RENEW.equals(reqType)) {
             throw new UnsupportedOperationException("TODO: handle " +
                     "renew requests");            
-        } else if(RahasConstants.REQ_TYPE_CANCEL.equals(reqType.toString())) {
+        } else if(RahasConstants.V_05_02.REQ_TYPE_CANCEL.equals(reqType) ||
+                RahasConstants.V_05_12.REQ_TYPE_CANCEL.equals(reqType)) {
             throw new UnsupportedOperationException("TODO: handle " +
                     "cancel requests");
         } else {

Modified: webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TrustUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TrustUtil.java?rev=422766&r1=422765&r2=422766&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TrustUtil.java (original)
+++ webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TrustUtil.java Mon Jul 17 10:20:26 2006
@@ -16,7 +16,9 @@
 
 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.axiom.om.impl.dom.DOOMAbstractFactory;
 import org.apache.axiom.soap.SOAP11Constants;
 import org.apache.axiom.soap.SOAPEnvelope;
@@ -53,36 +55,70 @@
     }
     
     public static OMElement createRequestSecurityTokenResponseElement(
-            OMElement parent) {
-        return createOMElement(parent,RahasConstants.WST_NS,
+            int version, 
+            OMElement parent) throws TrustException {
+        String ns = getWSTNamespace(version);
+        return createOMElement(parent, ns,
                 RahasConstants.REQUEST_SECURITY_TOKEN_RESPONSE_LN,
                 RahasConstants.WST_PREFIX);
     }
 
-    public static OMElement createRequestedSecurityTokenElement(OMElement parent) {
-        return createOMElement(parent,RahasConstants.WST_NS,
+    public static OMElement createRequestedSecurityTokenElement(
+            int version, OMElement parent) throws TrustException {
+        String ns = getWSTNamespace(version);
+        return createOMElement(parent, ns,
                 RahasConstants.REQUESTED_SECURITY_TOKEN_LN,
                 RahasConstants.WST_PREFIX);
     }
+    
+    public static OMElement createRequestSecurityTokenElement(
+            int version) throws TrustException {
+        String ns = getWSTNamespace(version);
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+        return fac.createOMElement(RahasConstants.REQUEST_SECURITY_TOKEN_LN, ns, RahasConstants.WST_PREFIX);
+    }
 
-    public static OMElement createRequestedProofTokenElement(OMElement parent) {
-        return createOMElement(parent, RahasConstants.WST_NS,
+    public static OMElement createRequestedProofTokenElement(
+            int version, OMElement parent) throws TrustException {
+        String ns = getWSTNamespace(version);
+        return createOMElement(parent, ns,
                 RahasConstants.REQUESTED_PROOF_TOKEN_LN, RahasConstants.WST_PREFIX);
     }
     
-    public static OMElement createEntropyElement(OMElement parent) {
-        return createOMElement(parent, RahasConstants.WST_NS,
+    public static OMElement createEntropyElement(
+            int version, OMElement parent) throws TrustException {
+        String ns = getWSTNamespace(version);
+        return createOMElement(parent, ns,
                 RahasConstants.ENTROPY_LN, RahasConstants.WST_PREFIX);
     }
     
-    public static OMElement createtTokenTypeElement(OMElement parent) {
-        return createOMElement(parent, RahasConstants.WST_NS,
+    public static OMElement createRequestTypeElement(
+            int version, OMElement parent) throws TrustException {
+        String ns = getWSTNamespace(version);
+        return createOMElement(parent, ns,
+                RahasConstants.REQUEST_TYPE_LN, RahasConstants.WST_PREFIX);
+    }
+    
+    public static OMElement createTokenTypeElement(
+            int version, OMElement parent) throws TrustException {
+        String ns = getWSTNamespace(version);
+        return createOMElement(parent, ns,
                 RahasConstants.TOKEN_TYPE_LN, RahasConstants.WST_PREFIX);
     }
     
-    public static OMElement createBinarySecretElement(OMElement parent,
-            String type) {
-        OMElement elem = createOMElement(parent, RahasConstants.WST_NS,
+    public static OMElement createtTokenTypeElement(
+            int version, OMElement parent) throws TrustException {
+        String ns = getWSTNamespace(version);
+        return createOMElement(parent, ns,
+                RahasConstants.TOKEN_TYPE_LN, RahasConstants.WST_PREFIX);
+    }
+    
+    public static OMElement createBinarySecretElement(
+            int version, 
+            OMElement parent,
+            String type) throws TrustException {
+        String ns = getWSTNamespace(version);
+        OMElement elem = createOMElement(parent, ns,
                 RahasConstants.BINARY_SECRET_LN, RahasConstants.WST_PREFIX);
         if(type != null) {
             elem.addAttribute(elem.getOMFactory().createOMAttribute(
@@ -91,19 +127,23 @@
         return elem;
     }
     
-    public static OMElement createRequestedUnattachedRef(OMElement parent,
-            String refUri, String refValueType) {
-        OMElement elem = createOMElement(parent, RahasConstants.WST_NS,
+    public static OMElement createRequestedUnattachedRef(
+            int version, OMElement parent,
+            String refUri, String refValueType) throws TrustException {
+        String ns = getWSTNamespace(version);
+        OMElement elem = createOMElement(parent, ns,
                             RahasConstants.REQUESTED_UNATTACHED_REFERENCE_LN,
                             RahasConstants.WST_PREFIX);
-        elem.addChild((OMElement) createSecurityTokenReference(
+        elem.addChild((OMElement) createSecurityTokenReference( 
                 ((Element) parent).getOwnerDocument(), refUri, refValueType));
         return elem;
     }
     
-    public static OMElement createRequestedAttachedRef(OMElement parent,
-            String refUri, String refValueType) {
-        OMElement elem = createOMElement(parent, RahasConstants.WST_NS,
+    public static OMElement createRequestedAttachedRef(
+            int version, OMElement parent,
+            String refUri, String refValueType) throws TrustException {
+        String ns = getWSTNamespace(version);
+        OMElement elem = createOMElement(parent, ns,
                             RahasConstants.REQUESTED_ATTACHED_REFERENCE_LN,
                             RahasConstants.WST_PREFIX);
         elem.addChild((OMElement) createSecurityTokenReference(
@@ -111,15 +151,21 @@
         return elem;
     }
     
-    public static OMElement createKeySizeElement(OMElement parent) {
-        return createOMElement(parent, RahasConstants.WST_NS,
+    public static OMElement createKeySizeElement(
+            int version, OMElement parent) throws TrustException {
+        String ns = getWSTNamespace(version);
+        return createOMElement(parent, ns,
                 RahasConstants.KEY_SIZE_LN,
                 RahasConstants.WST_PREFIX);
     }
     
-    public static OMElement createLifetimeElement(OMElement parent,
-            String created, String expires) {
-        OMElement ltElem = createOMElement(parent, RahasConstants.WST_NS,
+    public static OMElement createLifetimeElement(
+            int version, OMElement parent,
+            String created, String expires) throws TrustException {
+        
+        String ns = getWSTNamespace(version);
+        
+        OMElement ltElem = createOMElement(parent, ns,
                 RahasConstants.LIFETIME_LN,
                 RahasConstants.WST_PREFIX);
         
@@ -136,7 +182,8 @@
         return ltElem;
     }
 
-    public static OMElement createAppliesToElement(OMElement parent) {
+    public static OMElement createAppliesToElement(
+            int version, OMElement parent) {
         return createOMElement(parent, RahasConstants.WSP_NS,
                 RahasConstants.APPLIES_TO_LN,
                 RahasConstants.WSP_PREFIX);
@@ -164,6 +211,24 @@
                 parent);
     }
     
+    public static String getWSTNamespace(int version) throws TrustException {
+        switch (version){
+            case RahasConstants.VERSION_05_02:
+                return RahasConstants.WST_NS_05_02;
+            case RahasConstants.VERSION_05_12:
+                return RahasConstants.WST_NS_05_12;
+            default:
+                throw new TrustException("unsupportedWSTVersion");
+        }
+    }
+    
+    public static int getWSTVersion(String ns) {
+        if(RahasConstants.WST_NS_05_02.equals(ns)) {
+            return RahasConstants.VERSION_05_02;
+        } else {
+            return RahasConstants.VERSION_05_12;
+        }
+    }
     
     /**
      * Returns the token store.

Modified: webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/errors.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/errors.properties?rev=422766&r1=422765&r2=422766&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/errors.properties (original)
+++ webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/errors.properties Mon Jul 17 10:20:26 2006
@@ -31,6 +31,7 @@
 errorInBuildingTheEncryptedKeyForPrincipal = Error in building encrypted key for principal : \"{0}\"
 invlidTTL = timeToLive (in milliseconds) must be a positive long value.
 invalidKeysize = Invalid key size
+unsupportedWSTVersion = Unsupported WS-Trust version
 
 #SCTIssuer specific error messages
 sctIssuerCryptoPropertiesMissing = When the tokenType is not \"BinarySecret\" the cryptoProperties MUST be specified

Modified: webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SAMLTokenIssuer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SAMLTokenIssuer.java?rev=422766&r1=422765&r2=422766&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SAMLTokenIssuer.java (original)
+++ webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SAMLTokenIssuer.java Mon Jul 17 10:20:26 2006
@@ -37,8 +37,6 @@
 import org.apache.ws.security.message.WSSecEncryptedKey;
 import org.apache.ws.security.util.Base64;
 import org.apache.ws.security.util.XmlSchemaDateFormat;
-import org.apache.xml.security.encryption.XMLCipher;
-import org.apache.xml.security.encryption.XMLEncryptionException;
 import org.apache.xml.security.signature.XMLSignature;
 import org.apache.xml.security.utils.EncryptionConstants;
 import org.opensaml.SAMLAssertion;
@@ -202,35 +200,37 @@
         SAMLAssertion assertion = this.createAssertion(doc, encryptedKeyElem, 
                 config, crypto, creationTime, expirationTime);
         
+        int version = TrustUtil.getWSTVersion(request.getNamespace().getName());
+        
         OMElement rstrElem = TrustUtil
-                .createRequestSecurityTokenResponseElement(env.getBody());
+                .createRequestSecurityTokenResponseElement(version, env.getBody());
 
-        TrustUtil.createtTokenTypeElement(rstrElem).setText(
+        TrustUtil.createtTokenTypeElement(version, rstrElem).setText(
                 RahasConstants.TOK_TYPE_SAML_10);
 
-        TrustUtil.createKeySizeElement(rstrElem).setText(
-                Integer.toString(getKeySize(request, config)));
+        TrustUtil.createKeySizeElement(version, rstrElem).setText(
+                Integer.toString(getKeySize(request, config, version)));
         
         if (config.addRequestedAttachedRef) {
-            TrustUtil.createRequestedAttachedRef(rstrElem, "#"
+            TrustUtil.createRequestedAttachedRef(version, rstrElem, "#"
                     + assertion.getId(), RahasConstants.TOK_TYPE_SAML_10);
         }
 
         if (config.addRequestedUnattachedRef) {
-            TrustUtil.createRequestedUnattachedRef(rstrElem, assertion.getId(),
-                    RahasConstants.TOK_TYPE_SAML_10);
+            TrustUtil.createRequestedUnattachedRef(version, rstrElem, assertion
+                    .getId(), RahasConstants.TOK_TYPE_SAML_10);
         }
-        
-        //Use GMT time in milliseconds
+
+        // Use GMT time in milliseconds
         DateFormat zulu = new XmlSchemaDateFormat();
-        
-        //Add the Lifetime element
-        TrustUtil.createLifetimeElement(rstrElem, zulu.format(creationTime),
-                zulu.format(expirationTime));
+
+        // Add the Lifetime element
+        TrustUtil.createLifetimeElement(version, rstrElem, zulu
+                .format(creationTime), zulu.format(expirationTime));
         
         //Create the RequestedSecurityToken element and add the SAML token to it
         OMElement reqSecTokenElem = TrustUtil
-                .createRequestedSecurityTokenElement(rstrElem);
+                .createRequestedSecurityTokenElement(version, rstrElem);
         try {
             Node tempNode = assertion.toDOM();
             reqSecTokenElem.addChild((OMNode) ((Element) rstrElem)
@@ -250,8 +250,8 @@
 
         //Add the RequestedProofToken
         OMElement reqProofTokElem = TrustUtil
-                .createRequestedProofTokenElement(rstrElem);
-        OMElement binSecElem = TrustUtil.createBinarySecretElement(
+                .createRequestedProofTokenElement(version, rstrElem);
+        OMElement binSecElem = TrustUtil.createBinarySecretElement(version,
                 reqProofTokElem, null);
         binSecElem.setText(Base64.encode(secret));
         
@@ -267,10 +267,10 @@
      * available in the config. 
      * @return
      */
-    private int getKeySize(OMElement request, SAMLTokenIssuerConfig config)
+    private int getKeySize(OMElement request, SAMLTokenIssuerConfig config, int version)
             throws TrustException {
         OMElement keySizeElem = request.getFirstChildWithName(
-                    new QName(RahasConstants.WST_NS, RahasConstants.KEY_SIZE_LN));
+                    new QName(TrustUtil.getWSTNamespace(version), RahasConstants.KEY_SIZE_LN));
         if (keySizeElem != null) {
             // Try to get the wst:KeySize value
             try {
@@ -380,8 +380,6 @@
             throw new TrustException("samlAssertionCreationError", e);
         }
     }
-    
-    
 
     /*
      * (non-Javadoc)
@@ -391,7 +389,11 @@
      */
     public String getResponseAction(OMElement request, MessageContext inMsgCtx)
             throws TrustException {
-        return RahasConstants.RSTR_ACTON_ISSUE;
+        if(RahasConstants.WST_NS_05_02.equals(request.getNamespace().getName())) {
+            return RahasConstants.V_05_02.RSTR_ACTON_ISSUE;
+        } else {
+            return RahasConstants.V_05_12.RSTR_ACTON_ISSUE;    
+        }
     }
 
     /*

Modified: webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SCTIssuer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SCTIssuer.java?rev=422766&r1=422765&r2=422766&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SCTIssuer.java (original)
+++ webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SCTIssuer.java Mon Jul 17 10:20:26 2006
@@ -129,15 +129,18 @@
                                 .getLocalPart() });
             }
 
+            //Get WST Version
+            int wstVersion = TrustUtil.getWSTVersion(request.getNamespace().getName());
+            
             parseEntropyInfo(inMsgCtx.getEnvelope(), config);
             
             if(ENCRYPTED_KEY.equals(config.proofTokenType)) {
                 SOAPEnvelope responseEnv = this.doEncryptedKey(config,
-                        inMsgCtx, cert);
+                        inMsgCtx, cert, wstVersion);
                 return responseEnv;
             } else if(BINARY_SECRET.equals(config.proofTokenType)) {
                 SOAPEnvelope responseEnv = this.doBinarySecret(config,
-                        inMsgCtx);
+                        inMsgCtx, wstVersion);
                 return responseEnv;
             } else if(COMPUTED_KEY.equals(config.proofTokenType)) {
                 // TODO 
@@ -156,10 +159,10 @@
      * @param config
      */
     private void parseEntropyInfo(SOAPEnvelope envelope, SCTIssuerConfig config) {
-        OMElement elem = envelope.getBody().getFirstChildWithName(new QName(RahasConstants.WST_NS, RahasConstants.REQUEST_SECURITY_TOKEN_LN));
-        if(elem != null) {
-            //TODO get the entropy and keysize info
-        }
+//        OMElement elem = envelope.getBody().getFirstChildWithName(new QName(RahasConstants.WST_NS, RahasConstants.REQUEST_SECURITY_TOKEN_LN));
+//        if(elem != null) {
+//            //TODO get the entropy and keysize info
+//        }
     }
 
     /**
@@ -168,7 +171,7 @@
      * @param cert
      * @return
      */
-    private SOAPEnvelope doBinarySecret(SCTIssuerConfig config, MessageContext msgCtx) throws TrustException {
+    private SOAPEnvelope doBinarySecret(SCTIssuerConfig config, MessageContext msgCtx, int wstVersion) throws TrustException {
         
         SOAPEnvelope env = TrustUtil.createSOAPEnvelope(msgCtx.getEnvelope()
                 .getNamespace().getName());
@@ -177,25 +180,35 @@
         
         SecurityContextToken sct = new SecurityContextToken(doc);
         
-        OMElement rstrElem = TrustUtil.createRequestSecurityTokenResponseElement(env.getBody());
+        OMElement rstrElem = TrustUtil.createRequestSecurityTokenResponseElement(wstVersion, env.getBody());
 
-        OMElement rstElem = TrustUtil.createRequestedSecurityTokenElement(rstrElem);
+        OMElement rstElem = TrustUtil.createRequestedSecurityTokenElement(wstVersion, rstrElem);
         
         rstElem.addChild((OMElement)sct.getElement());
         
         if (config.addRequestedAttachedRef) {
-            TrustUtil.createRequestedAttachedRef(rstrElem, "#" + sct.getID(),
-                    RahasConstants.TOK_TYPE_SCT);
+            if(wstVersion == RahasConstants.VERSION_05_02) {
+                TrustUtil.createRequestedAttachedRef(wstVersion, rstrElem, "#" + sct.getID(),
+                    RahasConstants.V_05_02.TOK_TYPE_SCT);
+            } else {
+                TrustUtil.createRequestedAttachedRef(wstVersion, rstrElem, "#" + sct.getID(),
+                        RahasConstants.V_05_12.TOK_TYPE_SCT);
+            }
         }
 
         if (config.addRequestedUnattachedRef) {
-            TrustUtil.createRequestedUnattachedRef(
-                    rstrElem, sct.getIdentifier(), RahasConstants.TOK_TYPE_SCT);
+            if(wstVersion == RahasConstants.VERSION_05_02) {
+                TrustUtil.createRequestedUnattachedRef(wstVersion, 
+                    rstrElem, sct.getIdentifier(), RahasConstants.V_05_02.TOK_TYPE_SCT);
+            } else {
+                TrustUtil.createRequestedUnattachedRef(wstVersion, 
+                        rstrElem, sct.getIdentifier(), RahasConstants.V_05_12.TOK_TYPE_SCT);
+            }
         }
         
-        OMElement reqProofTok = TrustUtil.createRequestedProofTokenElement(rstrElem);
+        OMElement reqProofTok = TrustUtil.createRequestedProofTokenElement(wstVersion, rstrElem);
         
-        OMElement binSecElem = TrustUtil.createBinarySecretElement(reqProofTok, null);
+        OMElement binSecElem = TrustUtil.createBinarySecretElement(wstVersion, reqProofTok, null);
 
         byte[] secret = this.generateEphemeralKey();
         binSecElem.setText(Base64.encode(secret));
@@ -209,7 +222,7 @@
     }
 
     private SOAPEnvelope doEncryptedKey(SCTIssuerConfig config,
-            MessageContext msgCtx, X509Certificate cert) throws TrustException {
+            MessageContext msgCtx, X509Certificate cert, int wstVersion) throws TrustException {
         
         SOAPEnvelope env = TrustUtil.createSOAPEnvelope(msgCtx.getEnvelope()
                 .getNamespace().getName());
@@ -233,28 +246,38 @@
         SecurityContextToken sct = new SecurityContextToken(doc);
         
         OMElement rstrElem = TrustUtil
-                .createRequestSecurityTokenResponseElement(env.getBody());
+                .createRequestSecurityTokenResponseElement(wstVersion, env.getBody());
 
         OMElement rstElem = TrustUtil
-                .createRequestedSecurityTokenElement(rstrElem);
+                .createRequestedSecurityTokenElement(wstVersion, rstrElem);
         
         rstElem.addChild((OMElement)sct.getElement());
         
         if (config.addRequestedAttachedRef) {
-            TrustUtil.createRequestedAttachedRef(rstrElem, "#" + sct.getID(),
-                    RahasConstants.TOK_TYPE_SCT);
+            if(wstVersion == RahasConstants.VERSION_05_02) {
+                TrustUtil.createRequestedAttachedRef(wstVersion, rstrElem, "#" + sct.getID(),
+                    RahasConstants.V_05_02.TOK_TYPE_SCT);
+            } else {
+                TrustUtil.createRequestedAttachedRef(wstVersion, rstrElem, "#" + sct.getID(),
+                        RahasConstants.V_05_12.TOK_TYPE_SCT);
+            }
         }
 
         if (config.addRequestedUnattachedRef) {
-            TrustUtil.createRequestedUnattachedRef(
-                    rstrElem, sct.getIdentifier(), RahasConstants.TOK_TYPE_SCT);
+            if(wstVersion == RahasConstants.VERSION_05_02) {
+                TrustUtil.createRequestedUnattachedRef(wstVersion, 
+                    rstrElem, sct.getIdentifier(), RahasConstants.V_05_02.TOK_TYPE_SCT);
+            } else {
+                TrustUtil.createRequestedUnattachedRef(wstVersion, 
+                        rstrElem, sct.getIdentifier(), RahasConstants.V_05_12.TOK_TYPE_SCT);
+            }
         }
         
         Element encryptedKeyElem = encrKeyBuilder.getEncryptedKeyElement();
         Element bstElem = encrKeyBuilder.getBinarySecurityTokenElement();
         
         OMElement reqProofTok = TrustUtil
-                .createRequestedProofTokenElement(rstrElem);
+                .createRequestedProofTokenElement(wstVersion, rstrElem);
 
         if(bstElem != null) {
             reqProofTok.addChild((OMElement)bstElem);
@@ -272,7 +295,11 @@
     }
 
     public String getResponseAction(OMElement request, MessageContext inMsgCtx) throws TrustException {
-        return RahasConstants.RSTR_ACTON_SCT;
+        if(RahasConstants.WST_NS_05_02.equals(request.getNamespace().getName())) {
+            return RahasConstants.V_05_02.RSTR_ACTON_SCT;
+        } else {
+            return RahasConstants.V_05_12.RSTR_ACTON_SCT;
+        }
     }
 
     /**

Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/conversation/ConversationConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/conversation/ConversationConfiguration.java?rev=422766&r1=422765&r2=422766&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/conversation/ConversationConfiguration.java (original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/conversation/ConversationConfiguration.java Mon Jul 17 10:20:26 2006
@@ -22,6 +22,7 @@
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.OperationContext;
 import org.apache.axis2.description.Parameter;
+import org.apache.rahas.RahasConstants;
 import org.apache.rahas.SimpleTokenStore;
 import org.apache.rahas.TokenStorage;
 import org.apache.rampart.RampartException;
@@ -142,6 +143,12 @@
     private boolean provideEntropy;
     
     /**
+     * WS-Trust version to use
+     * Default is RahasConstants.VERSION_05_02
+     */
+    private int wstVersion = RahasConstants.VERSION_05_02;
+    
+    /**
      * Builds the configuration from an Axis2 parameter.
      * @param msgCtx
      * @param sender
@@ -663,5 +670,19 @@
      */
     protected void setContextIdentifier(String contextIdentifier) {
         this.contextIdentifier = contextIdentifier;
+    }
+
+    /**
+     * @return Returns the wstVersion.
+     */
+    public int getWstVersion() {
+        return wstVersion;
+    }
+
+    /**
+     * @param wstVersion The wstVersion to set.
+     */
+    public void setWstVersion(int wstVersion) {
+        this.wstVersion = wstVersion;
     }
 }

Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/conversation/STSRequester.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/conversation/STSRequester.java?rev=422766&r1=422765&r2=422766&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/conversation/STSRequester.java (original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/conversation/STSRequester.java Mon Jul 17 10:20:26 2006
@@ -17,25 +17,21 @@
 package org.apache.rampart.conversation;
 
 import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
 import org.apache.axiom.om.impl.dom.DOOMAbstractFactory;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.databinding.types.URI;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.OutInAxisOperation;
 import org.apache.axis2.description.Parameter;
-import org.apache.rampart.RampartException;
-import org.apache.rampart.handler.WSSHandlerConstants;
+import org.apache.axis2.util.Base64;
 import org.apache.rahas.RahasConstants;
 import org.apache.rahas.TrustUtil;
-import org.apache.rahas.types.RequestSecurityTokenType;
+import org.apache.rampart.RampartException;
+import org.apache.rampart.handler.WSSHandlerConstants;
 import org.apache.rampart.util.Axis2Util;
-import org.apache.axis2.util.Base64;
-import org.apache.axis2.util.StreamWrapper;
 import org.apache.ws.security.util.WSSecurityUtil;
 import org.w3c.dom.Element;
 
@@ -54,7 +50,11 @@
         
         Options options = new Options();
         options.setTo(new EndpointReference(config.getStsEPRAddress()));
-        options.setAction(RahasConstants.RST_ACTON_SCT);
+        if(config.getWstVersion() == RahasConstants.VERSION_05_02) {
+            options.setAction(RahasConstants.V_05_02.RST_ACTON_SCT);
+        } else {
+            options.setAction(RahasConstants.V_05_12.RST_ACTON_SCT);
+        }
         
         //Get the security configurations
         Parameter outFlowParam = msgCtx
@@ -78,22 +78,18 @@
         
         client.setOptions(options);
 
-        RequestSecurityTokenType rst = new RequestSecurityTokenType();
-        
         try {
-            rst.setRequestType(new URI(RahasConstants.REQ_TYPE_ISSUE));
-            rst.setTokenType(new URI(RahasConstants.TOK_TYPE_SCT));
-            rst.setContext(new URI("http://get.optional.attrs.working"));
+            OMElement rstElem = TrustUtil.createRequestSecurityTokenElement(config.getWstVersion());
+            OMElement reqTypeElem = TrustUtil.createRequestTypeElement(config.getWstVersion(), rstElem);
+            OMElement tokenTypeElem = TrustUtil.createTokenTypeElement(config.getWstVersion(), rstElem);
             
-            Axis2Util.useDOOM(false);
-            StAXOMBuilder builder = new StAXOMBuilder(new StreamWrapper(rst
-                    .getPullParser(new QName(RahasConstants.WST_NS,
-                            RahasConstants.REQUEST_SECURITY_TOKEN_LN))));
-
-            OMElement rstElem = builder.getDocumentElement();
-            
-            rstElem.build();
-            rstElem = (OMElement)rstElem.detach();
+            if(config.getWstVersion() == RahasConstants.VERSION_05_02) {
+                reqTypeElem.setText(RahasConstants.V_05_02.REQ_TYPE_ISSUE);
+                tokenTypeElem.setText(RahasConstants.V_05_02.TOK_TYPE_SCT);
+            } else {
+                reqTypeElem.setText(RahasConstants.V_05_12.REQ_TYPE_ISSUE);
+                tokenTypeElem.setText(RahasConstants.V_05_12.TOK_TYPE_SCT);
+            }
             
             if(config.isProvideEntropy()) {
                 //TODO Option to get the nonce lenght and  
@@ -102,19 +98,21 @@
                 // Length of nonce in bytes
                 int nonceLength = 16;
 
-                OMElement entropyElem = TrustUtil.createEntropyElement(rstElem);
+                OMElement entropyElem = TrustUtil.createEntropyElement(config.getWstVersion(), rstElem);
                 
                 byte[] nonce = WSSecurityUtil.generateNonce(nonceLength);
-                OMElement elem = TrustUtil.createBinarySecretElement(entropyElem,
-                        RahasConstants.BIN_SEC_TYPE_NONCE);
+                OMElement elem = null;
+                if(config.getWstVersion() == RahasConstants.VERSION_05_02) {
+                    elem = TrustUtil.createBinarySecretElement(config.getWstVersion(), entropyElem, RahasConstants.V_05_02.BIN_SEC_TYPE_NONCE);
+                } else {
+                    elem = TrustUtil.createBinarySecretElement(config.getWstVersion(), entropyElem, RahasConstants.V_05_12.BIN_SEC_TYPE_NONCE);
+                }
                 elem.setText(Base64.encode(nonce));
 
-                TrustUtil.createKeySizeElement(rstElem).setText(
-                        Integer.toString(nonceLength * 8));
+                TrustUtil.createKeySizeElement(config.getWstVersion(), rstElem).setText(Integer.toString(nonceLength * 8));
             }
 
             String str = rstElem.toString();
-            System.out.println(str);
             
             OMElement tempResult = client.sendReceive(rstQn, rstElem);
             Axis2Util.useDOOM(true);

Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/conversation/Util.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/conversation/Util.java?rev=422766&r1=422765&r2=422766&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/conversation/Util.java (original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/conversation/Util.java Mon Jul 17 10:20:26 2006
@@ -77,8 +77,19 @@
     public static void processRSTR(OMElement rstr, ConversationConfiguration config)
             throws Exception {
         // Extract the SecurityContextToken
+        
+        String ns = null;
+        
         OMElement rstElem = rstr.getFirstChildWithName(new QName(
-                RahasConstants.WST_NS, RahasConstants.REQUESTED_SECURITY_TOKEN_LN));
+                RahasConstants.WST_NS_05_02, RahasConstants.REQUESTED_SECURITY_TOKEN_LN));
+        if(rstElem != null) {
+            ns = RahasConstants.WST_NS_05_02;
+        } else {
+            //At this point we certainthe version is the WS-SX version
+            rstElem = rstr.getFirstChildWithName(new QName(
+                    RahasConstants.WST_NS_05_12, RahasConstants.REQUESTED_SECURITY_TOKEN_LN));
+            ns = RahasConstants.WST_NS_05_12;
+        }
         Token token = null;
         if (rstElem != null) {
             OMElement sctElem = rstElem
@@ -97,7 +108,7 @@
 
         // Process RequestedProofToken and extract the secret
         byte[] secret = null;
-        OMElement rpt = rstr.getFirstChildWithName(new QName(RahasConstants.WST_NS_05_02,
+        OMElement rpt = rstr.getFirstChildWithName(new QName(ns,
                 RahasConstants.REQUESTED_PROOF_TOKEN_LN));
         if (rpt != null) {
             OMElement elem = rpt.getFirstElement();

Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/handler/WSDoAllSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/handler/WSDoAllSender.java?rev=422766&r1=422765&r2=422766&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/handler/WSDoAllSender.java (original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/handler/WSDoAllSender.java Mon Jul 17 10:20:26 2006
@@ -147,7 +147,8 @@
      * @throws WSSecurityException
      * @throws AxisFault
      */
-    private void processBasic(MessageContext msgContext, boolean disableDoom, RequestData reqData) throws WSSecurityException, AxisFault {
+    private void processBasic(MessageContext msgContext, boolean disableDoom,
+            RequestData reqData) throws WSSecurityException, AxisFault {
         boolean doDebug = log.isDebugEnabled();
         
         try {
@@ -376,22 +377,24 @@
             header = ((SOAPFactory)env.getOMFactory()).createSOAPHeader(env);
         }
         
-        OMElement rstrElem = TrustUtil.createRequestSecurityTokenResponseElement(header);
+        OMElement rstrElem = TrustUtil.createRequestSecurityTokenResponseElement(config.getWstVersion(), header);
 
-        OMElement rstElem = TrustUtil.createRequestedSecurityTokenElement(rstrElem);
+        OMElement rstElem = TrustUtil.createRequestedSecurityTokenElement(config.getWstVersion(), rstrElem);
         
         rstElem.addChild((OMElement)sct.getElement());
         
-        TrustUtil.createRequestedAttachedRef(rstrElem, "#" + sct.getID(),
-                WSSHandlerConstants.TOK_TYPE_SCT);
+        TrustUtil.createRequestedAttachedRef(config.getWstVersion(), rstrElem,
+                "#" + sct.getID(), WSSHandlerConstants.TOK_TYPE_SCT);
 
-        TrustUtil.createRequestedUnattachedRef(rstrElem, sct.getIdentifier(),
-                WSSHandlerConstants.TOK_TYPE_SCT);
+        TrustUtil
+                .createRequestedUnattachedRef(config.getWstVersion(), rstrElem,
+                        sct.getIdentifier(), WSSHandlerConstants.TOK_TYPE_SCT);
         
         Element encryptedKeyElem = encrKeyBuilder.getEncryptedKeyElement();
         Element bstElem = encrKeyBuilder.getBinarySecurityTokenElement();
         
-        OMElement reqProofTok = TrustUtil.createRequestedProofTokenElement(rstrElem);
+        OMElement reqProofTok = TrustUtil.createRequestedProofTokenElement(
+                config.getWstVersion(), rstrElem);
 
         if(bstElem != null) {
             reqProofTok.addChild((OMElement)bstElem);



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