You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ru...@apache.org on 2006/09/07 11:56:08 UTC

svn commit: r441040 - in /webservices/axis2/trunk/java/modules/rahas: project.xml src/org/apache/rahas/client/STSClient.java

Author: ruchithf
Date: Thu Sep  7 02:56:07 2006
New Revision: 441040

URL: http://svn.apache.org/viewvc?view=rev&rev=441040
Log:
- updated STS client to not to pick up algo suite from the service policy
- removed some unnecessary dependencies
- added debug statements to STS client


Modified:
    webservices/axis2/trunk/java/modules/rahas/project.xml
    webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/client/STSClient.java

Modified: webservices/axis2/trunk/java/modules/rahas/project.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rahas/project.xml?view=diff&rev=441040&r1=441039&r2=441040
==============================================================================
--- webservices/axis2/trunk/java/modules/rahas/project.xml (original)
+++ webservices/axis2/trunk/java/modules/rahas/project.xml Thu Sep  7 02:56:07 2006
@@ -41,18 +41,6 @@
             <artifactId>axiom-dom</artifactId>
             <version>${axiom.version}</version>
         </dependency>
-        <dependency>
-            <groupId>axis2</groupId>
-            <artifactId>axis2-java2wsdl</artifactId>
-            <version>${pom.currentVersion}</version>
-        </dependency>
-
-
-                <dependency>
-            <groupId>axis2</groupId>
-            <artifactId>axis2-codegen</artifactId>
-            <version>${pom.currentVersion}</version>
-        </dependency>
 
         <dependency>
             <groupId>axis2</groupId>
@@ -61,32 +49,13 @@
         </dependency>
         <dependency>
             <groupId>axis2</groupId>
-            <artifactId>axis2-adb</artifactId>
-            <version>${pom.currentVersion}</version>
-        </dependency>         
-        <dependency>
-            <groupId>axis2</groupId>
-            <artifactId>axis2-jibx</artifactId>
-            <version>${pom.currentVersion}</version>
-        </dependency>         
-       <dependency>
-            <groupId>axis2</groupId>
-            <artifactId>axis2-xmlbeans</artifactId>
-            <version>${pom.currentVersion}</version>
-        </dependency>        
-		<dependency>
-            <groupId>axis2</groupId>
             <artifactId>axis2-secpolicy</artifactId>
             <version>${pom.currentVersion}</version>
         </dependency>
-        <!-- external JARs -->
         <dependency>
-            <groupId>wsdl4j</groupId>
-            <artifactId>wsdl4j</artifactId>
-            <version>${wsdl4j.version}</version>
-            <properties>
-                <module>true</module>
-            </properties>
+            <groupId>axis2</groupId>
+            <artifactId>axis2-adb</artifactId>
+            <version>${pom.currentVersion}</version>
         </dependency>
         <dependency>
             <groupId>commons-logging</groupId>
@@ -169,14 +138,6 @@
             </properties>
         </dependency>
         <dependency>
-            <groupId>xmlbeans</groupId>
-            <artifactId>xbean</artifactId>
-            <version>${xbean.version}</version>
-            <properties>
-                <module>true</module>
-            </properties>
-        </dependency>
-        <dependency>
             <groupId>xml-apis</groupId>
             <artifactId>xml-apis</artifactId>
             <version>${xml_apis.version}</version>
@@ -204,6 +165,14 @@
             <groupId>backport-util-concurrent</groupId>
             <artifactId>backport-util-concurrent</artifactId>
             <version>${backport_util_concurrent.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+		<dependency>
+            <groupId>wsdl4j</groupId>
+            <artifactId>wsdl4j</artifactId>
+            <version>${wsdl4j.version}</version>
             <properties>
                 <module>true</module>
             </properties>

Modified: webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/client/STSClient.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/client/STSClient.java?view=diff&rev=441040&r1=441039&r2=441040
==============================================================================
--- webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/client/STSClient.java (original)
+++ webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/client/STSClient.java Thu Sep  7 02:56:07 2006
@@ -29,6 +29,8 @@
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.OutInAxisOperation;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.neethi.Assertion;
 import org.apache.neethi.Policy;
 import org.apache.rahas.RahasConstants;
@@ -60,6 +62,8 @@
 
 public class STSClient {
 
+    private static Log log = LogFactory.getLog(STSClient.class);
+    
     private String action;
     
     private OMElement rstTemplate;
@@ -70,7 +74,6 @@
     
     private Trust10 trust10;
     
-//    /get the algo suite from the issuer's policy ... not service policy
     private AlgorithmSuite algorithmSuite;
     
     private byte[] requestorEntropy;
@@ -311,30 +314,41 @@
         //Get the policy assertions
         //Assumption: there's only one alternative
         
-        List issuerAssertions = (List)issuerPolicy.getAlternatives().next();
-        
-        for (Iterator iter = issuerAssertions.iterator(); iter.hasNext();) {
-            Assertion tempAssertion = (Assertion) iter.next();
-            //find the AlgorithmSuite assertion
-            if(tempAssertion instanceof Binding) {
-                this.algorithmSuite = ((Binding) tempAssertion)
-                            .getAlgorithmSuite();    
+        if(issuerPolicy != null) {
+            log.debug("Processing Issuer policy");
+            
+            List issuerAssertions = (List)issuerPolicy.getAlternatives().next();
+            
+            for (Iterator iter = issuerAssertions.iterator(); iter.hasNext();) {
+                Assertion tempAssertion = (Assertion) iter.next();
+                //find the AlgorithmSuite assertion
+                if(tempAssertion instanceof Binding) {
+                    
+                    log.debug("Extracting algo suite from issuer " +
+                            "policy binding");
+                    
+                    this.algorithmSuite = ((Binding) tempAssertion)
+                                .getAlgorithmSuite();    
+                }
             }
         }
 
-        List assertions = (List)servicePolicy.getAlternatives().next();
-        
-        for (Iterator iter = assertions.iterator(); iter.hasNext();) {
-            Assertion tempAssertion = (Assertion) iter.next();
-            //find the Trust10 assertion
-            if(tempAssertion instanceof Trust10) {
-                this.trust10 = (Trust10) tempAssertion;
-            } else if(tempAssertion instanceof Binding) {
-                this.algorithmSuite = ((Binding) tempAssertion)
-                            .getAlgorithmSuite();    
+        if(servicePolicy != null) {
+            
+            log.debug("Processing service policy to find Trust10 assertion");
+            
+            List assertions = (List)servicePolicy.getAlternatives().next();
+            
+            for (Iterator iter = assertions.iterator(); iter.hasNext();) {
+                Assertion tempAssertion = (Assertion) iter.next();
+                //find the Trust10 assertion
+                if(tempAssertion instanceof Trust10) {
+                    log.debug("Extracting Trust10 assertion from " +
+                            "service policy");
+                    this.trust10 = (Trust10) tempAssertion;
+                }
             }
         }
-        
     }
     
     /**
@@ -345,6 +359,10 @@
      */
     private OMElement createRequest(String requestType,
             String appliesTo) throws TrustException {
+        
+        log.debug("Creating request with request type: " + requestType + 
+                " and applies to: " + appliesTo);
+        
         OMElement rst = TrustUtil.createRequestSecurityTokenElement(version);
 
         TrustUtil.createRequestTypeElement(this.version, rst, requestType);
@@ -353,6 +371,9 @@
         
         //Copy over the elements from the template
         if(this.rstTemplate != null) {
+            
+            log.debug("Using RSTTemplate: " + this.rstTemplate.toString());
+            
             Iterator templateChildren = rstTemplate.getChildElements();
             while (templateChildren.hasNext()) {
                 OMNode child = (OMNode) templateChildren.next();
@@ -363,10 +384,12 @@
                         && ((OMElement) child).getQName().equals(
                                 new QName(TrustUtil.getWSTNamespace(this.version),
                                         RahasConstants.KEY_SIZE_LN))) {
+                    log.debug("Extracting key size from the RSTTemplate: ");
                     OMElement childElem = (OMElement)child;
                     this.keySize = (childElem.getText() != null && !""
                             .equals(childElem.getText())) ? 
                                     Integer.parseInt(childElem.getText()) : -1;
+                    log.debug("Key size from RSTTemplate: " + this.keySize);
                 }
             }
         }
@@ -374,7 +397,13 @@
         try {
             // Handle entropy
             if (this.trust10 != null) {
+                
+                log.debug("Processing Trust10 assertion");
+                
                 if (this.trust10.isRequireClientEntropy()) {
+                    
+                    log.debug("Requires client entropy");
+                    
                     // setup requestor entropy
                     OMElement ent = TrustUtil
                             .createEntropyElement(this.version, rst);
@@ -386,6 +415,9 @@
                                     .getMaximumSymmetricKeyLength());
                     binSec.setText(Base64.encode(this.requestorEntropy));
 
+                    log.debug("Clien entropy : "
+                            + Base64.encode(this.requestorEntropy));
+                    
                     // Add the ComputedKey element
                     TrustUtil.createComputedKeyAlgorithm(this.version, rst,
                             RahasConstants.COMPUTED_KEY_PSHA1);
@@ -393,7 +425,7 @@
                 }
             }
         } catch (Exception e) {
-            throw new TrustException("errorSettingUpRequestorEntropy");
+            throw new TrustException("errorSettingUpRequestorEntropy", e);
         }
 
         return rst;



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