axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ruchi...@apache.org
Subject svn commit: r395954 - in /webservices/axis2/trunk/java/modules: integration/ integration/test-resources/security/rahas/ integration/test/org/apache/axis2/security/rahas/ security/src/org/apache/axis2/security/ security/src/org/apache/axis2/security/han...
Date Fri, 21 Apr 2006 17:25:56 GMT
Author: ruchithf
Date: Fri Apr 21 10:25:55 2006
New Revision: 395954

URL: http://svn.apache.org/viewcvs?rev=395954&view=rev
Log:
Added a check to the handlers to check whether the module is engaged in in the scope of that
message.
Added one more rahas test to test the the usage of entropy and computed keys ... but this
is not functional propery yet due to axoim issue.
Added some documentation to the testcases.


Added:
    webservices/axis2/trunk/java/modules/integration/test-resources/security/rahas/s3-services.xml
    webservices/axis2/trunk/java/modules/integration/test-resources/security/rahas/s4-services.xml
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/rahas/RahasScenario4Test.java
Modified:
    webservices/axis2/trunk/java/modules/integration/maven.xml
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/rahas/RahasScenario1Test.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/rahas/RahasScenario2Test.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/rahas/RahasScenario3Test.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/WSDoAllReceiver.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/WSDoAllSender.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/handler/WSDoAllHandler.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/handler/WSSHandlerConstants.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/rahas/RahasConfiguration.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/rahas/Receiver.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/rahas/STSRequester.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/rahas/Sender.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/Constants.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TrustUtil.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/impl/SCTIssuer.java

Modified: webservices/axis2/trunk/java/modules/integration/maven.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/maven.xml?rev=395954&r1=395953&r2=395954&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/maven.xml (original)
+++ webservices/axis2/trunk/java/modules/integration/maven.xml Fri Apr 21 10:25:55 2006
@@ -185,8 +185,50 @@
 
             <!-- Rahas Test - 2 :END -->
 
+			<!-- Rahas Test - 3  -->
+
+            <mkdir dir="target/test-resources/rahas_service_repo_3"/>
+            <mkdir dir="target/test-resources/rahas_service_repo_3/conf"/>
+            <mkdir dir="target/test-resources/rahas_service_repo_3/services"/>
+            <mkdir dir="target/test-resources/rahas_service_repo_3/modules"/>
+
+			<copy file="../addressing/target/addressing-${addressing_version}.mar"
+                  tofile="target/test-resources/rahas_service_repo_3/modules/addressing-${addressing_version}.mar"/>
+			<copy file="../security/target/rahas-${rahas_version}.mar"
+                  tofile="target/test-resources/rahas_service_repo_3/modules/rahas-${rahas_version}.mar"/>
+
+			<!-- copy the services.xml and create the aar -->
+			<copy overwrite="yes" file="test-resources/security/rahas/s3-services.xml"
+                  tofile="target/temp-rahas/META-INF/services.xml"/>
+
+		    <jar  overwrite="yes" jarfile="target/test-resources/rahas_service_repo_3/services/Service.aar"
+                 basedir="target/temp-rahas"/>
+
+            <!-- Rahas Test - 3 :END -->
+
+			<!-- Rahas Test - 4  -->
+
+            <mkdir dir="target/test-resources/rahas_service_repo_4"/>
+            <mkdir dir="target/test-resources/rahas_service_repo_4/conf"/>
+            <mkdir dir="target/test-resources/rahas_service_repo_4/services"/>
+            <mkdir dir="target/test-resources/rahas_service_repo_4/modules"/>
+
+			<copy file="../addressing/target/addressing-${addressing_version}.mar"
+                  tofile="target/test-resources/rahas_service_repo_4/modules/addressing-${addressing_version}.mar"/>
+			<copy file="../security/target/rahas-${rahas_version}.mar"
+                  tofile="target/test-resources/rahas_service_repo_4/modules/rahas-${rahas_version}.mar"/>
+
+			<!-- copy the services.xml and create the aar -->
+			<copy overwrite="yes" file="test-resources/security/rahas/s4-services.xml"
+                  tofile="target/temp-rahas/META-INF/services.xml"/>
+
+		    <jar  overwrite="yes" jarfile="target/test-resources/rahas_service_repo_4/services/Service.aar"
+                 basedir="target/temp-rahas"/>
+
+            <!-- Rahas Test - 4 :END -->
+			
 			<!-- clean up temp rahas stuff -->
-			<!--<delete dir="target/temp-rahas"/> -->
+			<delete dir="target/temp-rahas"/>
 
 		
 			<mkdir dir="target/test-resources/samples/modules"/>

Added: webservices/axis2/trunk/java/modules/integration/test-resources/security/rahas/s3-services.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test-resources/security/rahas/s3-services.xml?rev=395954&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test-resources/security/rahas/s3-services.xml
(added)
+++ webservices/axis2/trunk/java/modules/integration/test-resources/security/rahas/s3-services.xml
Fri Apr 21 10:25:55 2006
@@ -0,0 +1,45 @@
+<service name="SecureService">
+
+	<module ref="rahas"/>
+
+	<parameter locked="false" name="ServiceClass">org.apache.axis2.security.rahas.Service</parameter>
+
+	<operation name="echo">
+		<messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+		<actionMapping>urn:echo</actionMapping>
+	</operation>    
+
+    <parameter name="sct-issuer-config">
+		<sct-issuer-config>
+			<proofToken>EncryptedKey</proofToken>
+			<cryptoProperties>sctIssuer.properties</cryptoProperties>
+			<addRequestedAttachedRef />
+		</sct-issuer-config>
+    </parameter>
+    
+    <parameter xmlns="" name="rahas-configuration">
+		<rahas-configuration xmlns="">
+			<scope xmlns="">service</scope>
+			<passwordCallbackClass xmlns="">org.apache.axis2.security.rahas.PWCallback</passwordCallbackClass>
+			<cryptoProperties xmlns="">sctIssuer.properties</cryptoProperties>
+		</rahas-configuration>
+    </parameter>
+
+    <parameter name="InflowSecurity">
+      <action>
+        <items>Timestamp Signature</items>
+        <signaturePropFile>sctIssuer.properties</signaturePropFile>
+      </action>
+    </parameter>
+
+    <parameter name="OutflowSecurity">
+      <action>
+        <items>Timestamp Signature Encrypt</items>
+        <encryptionUser>useReqSigCert</encryptionUser>
+        <user>sts</user>
+        <signaturePropFile xmlns="">sctIssuer.properties</signaturePropFile>
+	<passwordCallbackClass xmlns="">org.apache.axis2.security.rahas.PWCallback</passwordCallbackClass>
+      </action>
+    </parameter>
+    
+</service>

Added: webservices/axis2/trunk/java/modules/integration/test-resources/security/rahas/s4-services.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test-resources/security/rahas/s4-services.xml?rev=395954&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test-resources/security/rahas/s4-services.xml
(added)
+++ webservices/axis2/trunk/java/modules/integration/test-resources/security/rahas/s4-services.xml
Fri Apr 21 10:25:55 2006
@@ -0,0 +1,45 @@
+<service name="SecureService">
+
+	<module ref="rahas"/>
+
+	<parameter locked="false" name="ServiceClass">org.apache.axis2.security.rahas.Service</parameter>
+
+	<operation name="echo">
+		<messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+		<actionMapping>urn:echo</actionMapping>
+	</operation>    
+
+    <parameter name="sct-issuer-config">
+		<sct-issuer-config>
+			<proofToken>EncryptedKey</proofToken>
+			<cryptoProperties>sctIssuer.properties</cryptoProperties>
+			<addRequestedAttachedRef />
+		</sct-issuer-config>
+    </parameter>
+    
+    <parameter xmlns="" name="rahas-configuration">
+		<rahas-configuration xmlns="">
+			<scope xmlns="">service</scope>
+			<passwordCallbackClass xmlns="">org.apache.axis2.security.rahas.PWCallback</passwordCallbackClass>
+			<cryptoProperties xmlns="">sctIssuer.properties</cryptoProperties>
+		</rahas-configuration>
+    </parameter>
+
+    <parameter name="InflowSecurity">
+      <action>
+        <items>Timestamp Signature</items>
+        <signaturePropFile>sctIssuer.properties</signaturePropFile>
+      </action>
+    </parameter>
+
+    <parameter name="OutflowSecurity">
+      <action>
+        <items>Timestamp Signature Encrypt</items>
+        <encryptionUser>useReqSigCert</encryptionUser>
+        <user>sts</user>
+        <signaturePropFile xmlns="">sctIssuer.properties</signaturePropFile>
+	<passwordCallbackClass xmlns="">org.apache.axis2.security.rahas.PWCallback</passwordCallbackClass>
+      </action>
+    </parameter>
+    
+</service>

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/rahas/RahasScenario1Test.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/rahas/RahasScenario1Test.java?rev=395954&r1=395953&r2=395954&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/rahas/RahasScenario1Test.java
(original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/rahas/RahasScenario1Test.java
Fri Apr 21 10:25:55 2006
@@ -21,6 +21,8 @@
 import org.apache.axis2.security.handler.config.OutflowConfiguration;
 
 /**
+ * The RequestedProofToken is an EncryptedKey
+ * which holds the secret of security context.
  * 
  * @author Ruchith Fernando (ruchith.fernando@gmail.com)
  */

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/rahas/RahasScenario2Test.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/rahas/RahasScenario2Test.java?rev=395954&r1=395953&r2=395954&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/rahas/RahasScenario2Test.java
(original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/rahas/RahasScenario2Test.java
Fri Apr 21 10:25:55 2006
@@ -16,6 +16,12 @@
 
 package org.apache.axis2.security.rahas;
 
+/**
+ * The RSTR will hold a  RequestedProofToken with a base64 encoded 
+ * secret held in a BinarySecret element.
+ *
+ * @author Ruchith Fernando (ruchith.fernando@gmail.com)
+ */
 public class RahasScenario2Test extends RahasScenario1Test {
 
     public RahasScenario2Test(String name) {

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/rahas/RahasScenario3Test.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/rahas/RahasScenario3Test.java?rev=395954&r1=395953&r2=395954&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/rahas/RahasScenario3Test.java
(original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/rahas/RahasScenario3Test.java
Fri Apr 21 10:25:55 2006
@@ -20,6 +20,15 @@
 import org.apache.axis2.security.handler.config.InflowConfiguration;
 import org.apache.axis2.security.handler.config.OutflowConfiguration;
 
+/**
+ * This tests security context establishment when there's no STS involved.
+ * Note that we are not setting the STS endpoint address in the rahas config.
+ * 
+ * The client side rahas outflow handler will create the RSTR with the SCT
+ * and RPT with a secret in a EncryptedKey and will send it over to the service.
+ *
+ * @author Ruchith Fernando (ruchith.fernando@gmail.com)
+ */
 public class RahasScenario3Test extends TestClient {
 
     public RahasScenario3Test(String name) {
@@ -46,7 +55,7 @@
     }
 
     public String getServiceRepo() {
-        return "rahas_service_repo_1";
+        return "rahas_service_repo_3";
     }
 
 }

Added: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/rahas/RahasScenario4Test.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/rahas/RahasScenario4Test.java?rev=395954&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/rahas/RahasScenario4Test.java
(added)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/security/rahas/RahasScenario4Test.java
Fri Apr 21 10:25:55 2006
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+package org.apache.axis2.security.rahas;
+
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.security.handler.config.InflowConfiguration;
+import org.apache.axis2.security.handler.config.OutflowConfiguration;
+
+/**
+ * This tests the use computed keys when the requester provides entropy
+ *
+ * @author Ruchith Fernando (ruchith.fernando@gmail.com)
+ */
+public class RahasScenario4Test extends TestClient {
+
+    public RahasScenario4Test(String name) {
+        super(name);
+        // TODO Auto-generated constructor stub
+    }
+
+    public Parameter getClientRahasConfiguration() {
+        RahasConfiguration config = new RahasConfiguration();
+
+        config.setCryptoPropertiesFile("sec.properties");
+        config.setScope(RahasConfiguration.SCOPE_SERVICE);
+        config.setPasswordCallbackClass(PWCallback.class.getName());
+        config.setProvideEntropy(true);
+        config.setStsEPRAddress("http://localhost:" + port + "/axis2/services/Service");
+
+        return config.getParameter();
+    }
+
+    public OutflowConfiguration getClientOutflowConfiguration() {
+        OutflowConfiguration ofc = new OutflowConfiguration();
+
+        ofc.setActionItems("Timestamp Signature");
+        ofc.setUser("alice");
+        ofc.setSignaturePropFile("sec.properties");
+        ofc.setPasswordCallbackClass(PWCallback.class.getName());
+        return ofc;
+    }
+
+    public InflowConfiguration getClientInflowConfiguration() {
+        InflowConfiguration ifc = new InflowConfiguration();
+
+        ifc.setActionItems("Timestamp Signature Encrypt");
+        ifc.setPasswordCallbackClass(PWCallback.class.getName());
+        ifc.setSignaturePropFile("sec.properties");
+        
+        return ifc;
+    }
+
+    public String getServiceRepo() {
+        return "rahas_service_repo_4";
+    }
+
+
+}

Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/WSDoAllReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/WSDoAllReceiver.java?rev=395954&r1=395953&r2=395954&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/WSDoAllReceiver.java
(original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/WSDoAllReceiver.java
Fri Apr 21 10:25:55 2006
@@ -22,13 +22,13 @@
 import org.apache.axiom.soap.SOAPHeaderBlock;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
-import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.OperationContext;
 import org.apache.axis2.security.handler.WSDoAllHandler;
 import org.apache.axis2.security.handler.WSSHandlerConstants;
 import org.apache.axis2.security.util.Axis2Util;
 import org.apache.axis2.security.util.HandlerParameterDecoder;
+import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.ws.security.SOAPConstants;
@@ -43,6 +43,7 @@
 import org.w3c.dom.Document;
 
 import javax.security.auth.callback.CallbackHandler;
+
 import java.security.cert.X509Certificate;
 import java.util.Iterator;
 import java.util.Vector;
@@ -53,13 +54,12 @@
     
     protected static Log log = LogFactory.getLog(WSDoAllReceiver.class.getName());
     
-    
     public WSDoAllReceiver() {
         super();
         inHandler = true;
     }
     
-    public void invoke(MessageContext msgContext) throws AxisFault {
+    public void processMessage(MessageContext msgContext) throws AxisFault {
         
         boolean doDebug = log.isDebugEnabled();
         
@@ -76,6 +76,7 @@
         }
         
         try {
+                        
             //populate the properties
             try {
                 HandlerParameterDecoder.processParameters(msgContext,true);
@@ -175,7 +176,6 @@
                 wsResult = secEngine.processSecurityHeader(doc, actor,
                         cbHandler, reqData.getSigCrypto(), reqData.getDecCrypto());
             } catch (WSSecurityException ex) {
-                ex.printStackTrace();
                 throw new AxisFault(
                         "WSDoAllReceiver: security processing failed", ex);
             }

Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/WSDoAllSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/WSDoAllSender.java?rev=395954&r1=395953&r2=395954&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/WSDoAllSender.java
(original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/WSDoAllSender.java
Fri Apr 21 10:25:55 2006
@@ -20,7 +20,6 @@
 import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
-import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.OperationContext;
 import org.apache.axis2.security.handler.WSDoAllHandler;
@@ -28,6 +27,7 @@
 import org.apache.axis2.security.util.Axis2Util;
 import org.apache.axis2.security.util.HandlerParameterDecoder;
 import org.apache.axis2.security.util.MessageOptimizer;
+import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.ws.security.WSConstants;
@@ -56,7 +56,8 @@
         inHandler = false;
     }
     
-    public void invoke(MessageContext msgContext) throws AxisFault {
+    
+    public void processMessage(MessageContext msgContext) throws AxisFault {
         
         String disableDoomValue = (String)msgContext.getProperty(WSSHandlerConstants.DISABLE_DOOM);
         boolean disableDoom = disableDoomValue != null && Constants.VALUE_TRUE.equalsIgnoreCase(disableDoomValue);

Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/handler/WSDoAllHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/handler/WSDoAllHandler.java?rev=395954&r1=395953&r2=395954&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/handler/WSDoAllHandler.java
(original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/handler/WSDoAllHandler.java
Fri Apr 21 10:25:55 2006
@@ -70,6 +70,19 @@
         handlerDesc = EMPTY_HANDLER_METADATA;
     }
 
+    public abstract void processMessage(MessageContext msgContext) throws AxisFault;
+    
+    /* (non-Javadoc)
+     * @see org.apache.axis2.engine.Handler#invoke(org.apache.axis2.context.MessageContext)
+     */
+    public void invoke(MessageContext msgContext) throws AxisFault {
+        //If the security module is not engaged for this service
+        //do not do any processing
+        if(msgContext.isEngaged(new QName(WSSHandlerConstants.SECURITY_MODULE_NAME))) {
+            this.processMessage(msgContext);
+        }
+    }
+    
     /**
      * Method getName.
      *

Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/handler/WSSHandlerConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/handler/WSSHandlerConstants.java?rev=395954&r1=395953&r2=395954&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/handler/WSSHandlerConstants.java
(original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/handler/WSSHandlerConstants.java
Fri Apr 21 10:25:55 2006
@@ -22,6 +22,11 @@
 public interface WSSHandlerConstants {
 
     /**
+     * Name of the .mar file
+     */
+    public final static String SECURITY_MODULE_NAME = "security";
+    
+    /**
      * Inflow security parameter
      */
     public static final String INFLOW_SECURITY = "InflowSecurity";

Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/rahas/RahasConfiguration.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/rahas/RahasConfiguration.java?rev=395954&r1=395953&r2=395954&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/rahas/RahasConfiguration.java
(original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/rahas/RahasConfiguration.java
Fri Apr 21 10:25:55 2006
@@ -67,6 +67,8 @@
     
     public final static QName PW_CALLBACK_CLASS = new QName(
             WSHandlerConstants.PW_CALLBACK_CLASS);
+
+    private static final QName PROVIDE_ENTROPY = new QName("provideEntropy");
     
     private String scope = SCOPE_SERVICE;
     
@@ -135,6 +137,8 @@
     
     private String encryptionUser;
     
+    private boolean provideEntropy;
+    
     public static RahasConfiguration load(MessageContext msgCtx, boolean sender)
             throws Exception {
         Parameter param = msgCtx.getParameter(RAHAS_CONFIG);
@@ -175,12 +179,16 @@
                 config.encryptionUser = getStringValue(confElem
                         .getFirstChildWithName(ENCRYPTION_USER));
                 
+                config.provideEntropy = confElem
+                        .getFirstChildWithName(PROVIDE_ENTROPY) != null;
+                
                 //Get the action<->ctx-identifier map
                 config.contextMap = (Hashtable) msgCtx
                         .getProperty(RahasHandlerConstants.CONTEXT_MAP_KEY);
 
                 //Convert the Envelop to DOOM
-                config.doc = Axis2Util.getDocumentFromSOAPEnvelope(msgCtx.getEnvelope(),
false);
+                config.doc = Axis2Util.getDocumentFromSOAPEnvelope(msgCtx
+                        .getEnvelope(), false);
                 
                 //Token store
                 config.tokenStore = (TokenStorage) msgCtx
@@ -311,6 +319,9 @@
             tempElem.setText(this.encryptionUser);
             elem.addChild(tempElem);
         }
+        if(this.provideEntropy) {
+            factory.createOMElement(PROVIDE_ENTROPY, elem);
+        }
         return elem;
     }
     
@@ -452,12 +463,6 @@
         return tokenStoreClass;
     }
 
-    /**
-     * @return Returns the contextIdentifier.
-     */
-    protected String getContextIdentifier() {
-        return contextIdentifier;
-    }
 
     /**
      * @return Returns the cryptoProperties.
@@ -474,13 +479,6 @@
     }
 
     /**
-     * @return Returns the msgCtx.
-     */
-    protected MessageContext getMsgCtx() {
-        return msgCtx;
-    }
-
-    /**
      * @param tokenStoreClass The tokenStoreClass to set.
      */
     public void setTokenStoreClass(String tokenStoreClass) {
@@ -551,6 +549,41 @@
     }
 
     /**
+     * @param passwordCallbackClass The passwordCallbackClass to set.
+     */
+    public void setPasswordCallbackClass(String passwordCallbackClass) {
+        this.passwordCallbackClass = passwordCallbackClass;
+    }
+
+    /**
+     * @return Returns the encryptionUser.
+     */
+    public String getEncryptionUser() {
+        return encryptionUser;
+    }
+
+    /**
+     * @param encryptionUser The encryptionUser to set.
+     */
+    public void setEncryptionUser(String encryptionUser) {
+        this.encryptionUser = encryptionUser;
+    }
+
+    /**
+     * @return Returns the provideEntropy.
+     */
+    public boolean isProvideEntropy() {
+        return provideEntropy;
+    }
+
+    /**
+     * @param provideEntropy The provideEntropy to set.
+     */
+    public void setProvideEntropy(boolean provideEntropy) {
+        this.provideEntropy = provideEntropy;
+    }
+
+    /**
      * @return Returns the crypto.
      */
     protected Crypto getCrypto() {
@@ -579,24 +612,16 @@
     }
 
     /**
-     * @param passwordCallbackClass The passwordCallbackClass to set.
-     */
-    public void setPasswordCallbackClass(String passwordCallbackClass) {
-        this.passwordCallbackClass = passwordCallbackClass;
-    }
-
-    /**
-     * @return Returns the encryptionUser.
+     * @return Returns the msgCtx.
      */
-    public String getEncryptionUser() {
-        return encryptionUser;
+    protected MessageContext getMsgCtx() {
+        return msgCtx;
     }
-
+    
     /**
-     * @param encryptionUser The encryptionUser to set.
+     * @return Returns the contextIdentifier.
      */
-    public void setEncryptionUser(String encryptionUser) {
-        this.encryptionUser = encryptionUser;
+    protected String getContextIdentifier() {
+        return contextIdentifier;
     }
-    
 }

Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/rahas/Receiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/rahas/Receiver.java?rev=395954&r1=395953&r2=395954&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/rahas/Receiver.java
(original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/rahas/Receiver.java
Fri Apr 21 10:25:55 2006
@@ -51,7 +51,7 @@
                             .getWSAAction())) {
                 WSDoAllReceiver secReceiver = new WSDoAllReceiver();
                 secReceiver.init(this.handlerDescription);
-                secReceiver.invoke(msgContext);
+                secReceiver.processMessage(msgContext);
                 return;
             }
             

Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/rahas/STSRequester.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/rahas/STSRequester.java?rev=395954&r1=395953&r2=395954&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/rahas/STSRequester.java
(original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/rahas/STSRequester.java
Fri Apr 21 10:25:55 2006
@@ -84,7 +84,34 @@
                     .getPullParser(new QName(Constants.WST_NS,
                             Constants.REQUEST_SECURITY_TOKEN_LN))));
 
-            OMElement tempResult = client.sendReceive(rstQn, builder.getDocumentElement());
+            OMElement rstElem = builder.getDocumentElement();
+            
+            rstElem.build();
+            rstElem = (OMElement)rstElem.detach();
+            
+
+//            if(config.isProvideEntropy()) {
+//                //TODO Option to get the nonce lenght and  
+//                //keysize from the the configuration
+//                
+//                // Length of nonce in bytes
+//                int nonceLength = 16;
+//
+//                OMElement entropyElem = TrustUtil.createEntropyElement(rstElem);
+//                
+//                byte[] nonce = WSSecurityUtil.generateNonce(nonceLength);
+//                OMElement elem = TrustUtil.createBinarySecretElement(entropyElem,
+//                        Constants.BIN_SEC_TYPE_NONCE);
+//                elem.setText(Base64.encode(nonce));
+//
+//                TrustUtil.createKeySizeElement(rstElem).setText(
+//                        Integer.toString(nonceLength * 8));
+//            }
+
+            String str = rstElem.toString();
+            System.out.println(str);
+            
+            OMElement tempResult = client.sendReceive(rstQn, rstElem);
             Axis2Util.useDOOM(true);
             OMElement tempelem = Axis2Util.toDOOM(DOOMAbstractFactory.getOMFactory(), tempResult);
             OMElement elem = (OMElement)config.getDocument().importNode((Element)tempelem,
true);

Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/rahas/Sender.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/rahas/Sender.java?rev=395954&r1=395953&r2=395954&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/rahas/Sender.java
(original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/rahas/Sender.java
Fri Apr 21 10:25:55 2006
@@ -62,7 +62,7 @@
                     Constants.RSTR_ACTON_SCT.equals(msgContext.getWSAAction())) {
                 WSDoAllSender secSender = new WSDoAllSender();
                 secSender.init(this.handlerDescription);
-                secSender.invoke(msgContext);
+                secSender.processMessage(msgContext);
                 return;
             }
             

Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/Constants.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/Constants.java?rev=395954&r1=395953&r2=395954&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/Constants.java
(original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/Constants.java
Fri Apr 21 10:25:55 2006
@@ -30,6 +30,8 @@
     public final static String BINARY_SECRET = "BinarySecret";
     public final static String REQUESTED_ATTACHED_REFERENCE = "RequestedAttachedReference";
     public final static String REQUESTED_UNATTACHED_REFERENCE = "RequestedUnattachedReference";
+    public final static String KEY_SIZE = "KeySize";
+    public final static String ENTROPY = "Entropy";
     
     //RequestTypes
     public final static String REQ_TYPE_ISSUE = "http://schemas.xmlsoap.org/ws/2005/02/trust/Issue";
@@ -53,4 +55,10 @@
     public final static String RSTR_ACTON_RENEW = "http://schemas.xmlsoap.org/ws/2005/02/trust/RSTR/Cancel";
     public final static String RSTR_ACTON_CANCEL = "http://schemas.xmlsoap.org/ws/2005/02/trust/RSTR/Validate";
     public final static String RSTR_ACTON_SCT = "http://schemas.xmlsoap.org/ws/2005/02/trust/RSTR/SCT";
+    
+    //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/security/src/org/apache/axis2/security/trust/TrustUtil.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TrustUtil.java?rev=395954&r1=395953&r2=395954&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TrustUtil.java
(original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TrustUtil.java
Fri Apr 21 10:25:55 2006
@@ -65,9 +65,20 @@
                 Constants.REQUESTED_PROOF_TOKEN_LN, Constants.WST_PREFIX);
     }
     
-    public static OMElement createBinarySecretElement(OMElement parent) {
+    public static OMElement createEntropyElement(OMElement parent) {
         return createOMElement(parent, Constants.WST_NS,
+                Constants.ENTROPY, Constants.WST_PREFIX);
+    }
+    
+    public static OMElement createBinarySecretElement(OMElement parent,
+            String type) {
+        OMElement elem = createOMElement(parent, Constants.WST_NS,
                 Constants.BINARY_SECRET, Constants.WST_PREFIX);
+        if(type != null) {
+            elem.addAttribute(elem.getOMFactory().createOMAttribute(
+                    Constants.ATTR_TYPE, null, type));
+        }
+        return elem;
     }
     
     public static OMElement createRequestedUnattachedRef(OMElement parent,
@@ -88,6 +99,12 @@
         elem.addChild((OMElement) createSecurityTokenReference(
                 ((Element) parent).getOwnerDocument(), refUri, refValueType));
         return elem;
+    }
+    
+    public static OMElement createKeySizeElement(OMElement parent) {
+        return createOMElement(parent, Constants.WST_NS,
+                Constants.KEY_SIZE,
+                Constants.WST_PREFIX);
     }
     
     private static OMElement createOMElement(OMElement parent, String ns,

Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/impl/SCTIssuer.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/impl/SCTIssuer.java?rev=395954&r1=395953&r2=395954&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/impl/SCTIssuer.java
(original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/impl/SCTIssuer.java
Fri Apr 21 10:25:55 2006
@@ -183,7 +183,7 @@
         
         OMElement reqProofTok = TrustUtil.createRequestedProofTokenElement(rstrElem);
         
-        OMElement binSecElem = TrustUtil.createBinarySecretElement(reqProofTok);
+        OMElement binSecElem = TrustUtil.createBinarySecretElement(reqProofTok, null);
 
         byte[] secret = this.generateEphemeralKey();
         binSecElem.setText(Base64.encode(secret));



Mime
View raw message