axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ruchi...@apache.org
Subject svn commit: r390111 - in /webservices/axis2/trunk/java/modules: addressing/src/org/apache/axis2/handlers/addressing/ security/src/META-INF/ security/src/org/apache/axis2/security/rahas/
Date Thu, 30 Mar 2006 12:46:31 GMT
Author: ruchithf
Date: Thu Mar 30 04:46:27 2006
New Revision: 390111

URL: http://svn.apache.org/viewcvs?rev=390111&view=rev
Log:
- Updated the Addressing handlers to use the existing om factory
- Updating Rahas to do the STS call and obtain a SCT and use that SCT to secure the request
message


Modified:
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java
    webservices/axis2/trunk/java/modules/security/src/META-INF/rahas-module.xml
    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

Modified: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java?rev=390111&r1=390110&r2=390111&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
(original)
+++ webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
Thu Mar 30 04:46:27 2006
@@ -16,14 +16,10 @@
 
 package org.apache.axis2.handlers.addressing;
 
-import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.soap.SOAP12Constants;
-import org.apache.axiom.soap.SOAPFactory;
-import org.apache.axiom.soap.SOAPFaultReason;
-import org.apache.axiom.soap.SOAPFaultText;
 import org.apache.axiom.soap.SOAPHeader;
 import org.apache.axiom.soap.SOAPHeaderBlock;
 import org.apache.axis2.AxisFault;
@@ -33,10 +29,10 @@
 import org.apache.axis2.addressing.RelatesTo;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.util.Utils;
 
 import javax.xml.namespace.QName;
+
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -192,16 +188,6 @@
 
 
     protected abstract void extractToEprReferenceParameters(EndpointReference toEPR, SOAPHeader
header);
-
-    private void handleNoServiceGroupContextIDCase(MessageContext msgContext) {
-        SOAPFactory soapFac = msgContext.isSOAP11() ? OMAbstractFactory.getSOAP11Factory()
: OMAbstractFactory.getSOAP12Factory();
-        SOAPFaultReason soapFaultReason = soapFac.createSOAPFaultReason(null);
-        SOAPFaultText soapFaultText = soapFac.createSOAPFaultText(soapFaultReason);
-        soapFaultText.setLang("en");
-        soapFaultText.setText(Messages.getMessage("serviceGroupIDNotFound"));
-
-        msgContext.setProperty(SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME, soapFaultReason);
-    }
 
 
     private void extractRelatesToInformation(SOAPHeaderBlock soapHeaderBlock, String addressingNamespace,
Options messageContextOptions) {

Modified: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java?rev=390111&r1=390110&r2=390111&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java
(original)
+++ webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java
Thu Mar 30 04:46:27 2006
@@ -16,7 +16,6 @@
 
 package org.apache.axis2.handlers.addressing;
 
-import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMNamespace;
@@ -51,6 +50,8 @@
 
     public void invoke(MessageContext msgContext) throws AxisFault {
 
+        SOAPFactory factory = (SOAPFactory)msgContext.getEnvelope().getOMFactory();
+        
         OMNamespace addressingNamespaceObject;
 
         // it should be able to disable addressing by some one.
@@ -90,7 +91,7 @@
         if (addressingNamespace == null || "".equals(addressingNamespace)) {
             addressingNamespace = Final.WSA_NAMESPACE;
         }
-        addressingNamespaceObject = OMAbstractFactory.getOMFactory().createOMNamespace(
+        addressingNamespaceObject = factory.createOMNamespace(
                 addressingNamespace, WSA_DEFAULT_PREFIX);
         anonymousURI = addressingNamespace.equals(Final.WSA_NAMESPACE) ? Final.WSA_ANONYMOUS_URL
: Submission.WSA_ANONYMOUS_URL;
 
@@ -101,8 +102,8 @@
 
         // if there is no soap header in the envelope being processed, add one.
         if (soapHeader == null) {
-            SOAPFactory soapFac = msgContext.isSOAP11() ? OMAbstractFactory.getSOAP11Factory()
: OMAbstractFactory.getSOAP12Factory();
-            soapHeader = soapFac.createSOAPHeader(envelope);
+//            SOAPFactory soapFac = msgContext.isSOAP11() ? OMAbstractFactory.getSOAP11Factory()
: OMAbstractFactory.getSOAP12Factory();
+            soapHeader = factory.createSOAPHeader(envelope);
         }
 
         // by this time, we definitely have some addressing information to be sent. This
is because,
@@ -163,7 +164,7 @@
             if (faultyHeaderQName != null && !"".equals(faultyHeaderQName)) {
                 // add to header
                 SOAPHeaderBlock faultDetail = envelope.getHeader().addHeaderBlock(Final.FAULT_HEADER_DETAIL,
addressingNamespaceObject);
-                OMElement probHeaderQName = OMAbstractFactory.getOMFactory().createOMElement(Final.FAULT_HEADER_PROB_HEADER_QNAME,
addressingNamespaceObject, faultDetail);
+                OMElement probHeaderQName = envelope.getOMFactory().createOMElement(Final.FAULT_HEADER_PROB_HEADER_QNAME,
addressingNamespaceObject, faultDetail);
                 probHeaderQName.setText(faultyHeaderQName);
 
                 String messageID = (String) faultInfo.get(AddressingConstants.WSA_RELATES_TO);
@@ -175,7 +176,7 @@
                 // add to header
                 SOAPFault fault = envelope.getBody().getFault();
                 if (fault != null && fault.getDetail() != null) {
-                    OMElement probHeaderQName2 = OMAbstractFactory.getOMFactory().createOMElement(Final.FAULT_HEADER_PROB_HEADER_QNAME,
addressingNamespaceObject, fault.getDetail());
+                    OMElement probHeaderQName2 = envelope.getOMFactory().createOMElement(Final.FAULT_HEADER_PROB_HEADER_QNAME,
addressingNamespaceObject, fault.getDetail());
                     probHeaderQName2.setText(faultyHeaderQName);
                 }
 
@@ -290,7 +291,7 @@
             SOAPHeaderBlock soapHeaderBlock =
                     soapEnvelope.getHeader().addHeaderBlock(type, addressingNamespaceObject);
             soapHeaderBlock.addChild(
-                    OMAbstractFactory.getOMFactory().createText(value));
+                    soapEnvelope.getOMFactory().createText(value));
             return soapHeaderBlock;
         }
         return null;
@@ -310,7 +311,7 @@
         // add epr address
         String address = epr.getAddress();
         if (!"".equals(address) && address != null) {
-            OMElement addressElement = OMAbstractFactory.getOMFactory().createOMElement(EPR_ADDRESS,
addressingNamespaceObject, soapHeaderBlock);
+            OMElement addressElement = envelope.getOMFactory().createOMElement(EPR_ADDRESS,
addressingNamespaceObject, soapHeaderBlock);
             addressElement.setText(address);
         }
 
@@ -318,7 +319,7 @@
         Map referenceParameters = epr.getAllReferenceParameters();
         if (referenceParameters != null) {
             OMElement reference =
-                    OMAbstractFactory.getOMFactory().createOMElement(
+                    envelope.getOMFactory().createOMElement(
                             EPR_REFERENCE_PARAMETERS,
                             addressingNamespaceObject, soapHeaderBlock);
             processReferenceInformation(referenceParameters, reference);
@@ -337,7 +338,7 @@
         ArrayList metaDataList = epr.getMetaData();
         if (metaDataList != null) {
             OMElement metadata =
-                    OMAbstractFactory.getOMFactory().createOMElement(
+                    envelope.getOMFactory().createOMElement(
                             Final.WSA_METADATA,
                             addressingNamespaceObject, soapHeaderBlock);
             for (int i = 0; i < metaDataList.size(); i++) {

Modified: webservices/axis2/trunk/java/modules/security/src/META-INF/rahas-module.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/META-INF/rahas-module.xml?rev=390111&r1=390110&r2=390111&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/META-INF/rahas-module.xml (original)
+++ webservices/axis2/trunk/java/modules/security/src/META-INF/rahas-module.xml Thu Mar 30
04:46:27 2006
@@ -24,10 +24,17 @@
 		<actionMapping>http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Validate</actionMapping>
 
 		<parameter name="token-dispatcher-configuration">
-			<issuer class="org.apache.axis2.security.trust.impl.SCTIssuer" default="true">
-				<configuration-param>sct-issuer-config</configuration-param>
-				<tokenType>http://schemas.xmlsoap.org/ws/2005/02/sc/sct</tokenType>
-			</issuer>
+			<token-dispatcher-configuration>
+				<issuer class="org.apache.axis2.security.trust.impl.SCTIssuer" default="true">
+					<configuration>
+						<sct-issuer-config>
+							<proofToken>EncryptedKey</proofToken>
+							<cryptoProperties>sctIssuer.properties</cryptoProperties>
+						</sct-issuer-config>
+					</configuration>
+					<tokenType>http://schemas.xmlsoap.org/ws/2005/02/sc/sct</tokenType>
+				</issuer>
+			</token-dispatcher-configuration>
 		</parameter>
 
      </operation>

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=390111&r1=390110&r2=390111&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
Thu Mar 30 04:46:27 2006
@@ -23,6 +23,7 @@
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.OperationContext;
 import org.apache.axis2.description.Parameter;
+import org.apache.axis2.security.trust.SimpleTokenStore;
 import org.apache.axis2.security.trust.TokenStorage;
 import org.apache.axis2.security.util.Axis2Util;
 import org.apache.ws.security.WSSecurityException;
@@ -378,11 +379,15 @@
      * @return Returns the tokenStore.
      */
     protected TokenStorage getTokenStore() throws Exception {
-        if(this.tokenStore == null && this.tokenStoreClass != null) {
-            this.tokenStore = (TokenStorage) Class
-                    .forName(this.tokenStoreClass).newInstance();
-            this.msgCtx.getConfigurationContext().setProperty(
-                    RahasHandlerConstants.TOKEN_STORE_KEY, this.tokenStore);
+        if(this.tokenStore == null) {
+            if(this.tokenStoreClass != null) {
+                 this.tokenStore = (TokenStorage) Class
+                        .forName(this.tokenStoreClass).newInstance();
+                this.msgCtx.getConfigurationContext().setProperty(
+                        RahasHandlerConstants.TOKEN_STORE_KEY, this.tokenStore);
+            } else {
+                this.tokenStore = new SimpleTokenStore();
+            }
         }
         return tokenStore;
     }

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=390111&r1=390110&r2=390111&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
Thu Mar 30 04:46:27 2006
@@ -21,6 +21,8 @@
 import org.apache.axis2.description.HandlerDescription;
 import org.apache.axis2.description.Parameter;
 import org.apache.axis2.engine.Handler;
+import org.apache.axis2.security.WSDoAllReceiver;
+import org.apache.axis2.security.trust.Constants;
 
 import javax.xml.namespace.QName;
 
@@ -35,8 +37,13 @@
     private HandlerDescription handlerDescription;
     
     public void invoke(MessageContext msgContext) throws AxisFault {
-        // TODO TODO
-        throw new UnsupportedOperationException("TODO");
+        if(Constants.RST_ACTON_SCT.equals(msgContext.getWSAAction()) ||
+                Constants.RSTR_ACTON_SCT.equals(msgContext.getWSAAction())) {
+            WSDoAllReceiver secReceiver = new WSDoAllReceiver();
+            secReceiver.init(this.handlerDescription);
+            secReceiver.invoke(msgContext);
+            return;
+        }
     }
     
     public void cleanup() throws AxisFault {

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=390111&r1=390110&r2=390111&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
Thu Mar 30 04:46:27 2006
@@ -19,6 +19,7 @@
 import org.apache.axiom.om.OMDocument;
 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;
@@ -93,8 +94,8 @@
             
             OMElement tempResult = client.sendReceive(rstQn, builder.getDocumentElement());
             
-            OMElement elem = Axis2Util.toDOOM(((OMDocument) config.getDocument())
-                    .getOMFactory(), tempResult);
+            OMElement tempelem = Axis2Util.toDOOM(DOOMAbstractFactory.getOMFactory(), tempResult);
+            OMElement elem = (OMElement)config.getDocument().importNode((Element)tempelem,
true);
             processRSTR(elem, config);
             
         } catch (Exception e) {
@@ -114,6 +115,8 @@
             if(sctElem != null) {
                 SecurityContextToken sct = new SecurityContextToken((Element)sctElem);
                 token = new Token(sct.getIdentifier(), sctElem);
+                config.setSecurityContextToken(sct);
+                config.setContextIdentifier(sct.getIdentifier());
             } else {
                 throw new RahasException("sctMissingInResponse");
             }

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=390111&r1=390110&r2=390111&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
Thu Mar 30 04:46:27 2006
@@ -17,6 +17,7 @@
 package org.apache.axis2.security.rahas;
 
 import org.apache.axiom.om.impl.dom.jaxp.DocumentBuilderFactoryImpl;
+import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.HandlerDescription;
@@ -45,8 +46,8 @@
     public void invoke(MessageContext msgContext) throws AxisFault {
         
         try {
-            System.out.println(msgContext.getWSAAction());
-            if(Constants.RST_ACTON_SCT.equals(msgContext.getWSAAction())) {
+            if(Constants.RST_ACTON_SCT.equals(msgContext.getWSAAction()) ||
+                    Constants.RSTR_ACTON_SCT.equals(msgContext.getWSAAction())) {
                 WSDoAllSender secSender = new WSDoAllSender();
                 secSender.init(this.handlerDescription);
                 secSender.invoke(msgContext);
@@ -62,6 +63,9 @@
                 if(sts != null) { 
                   //Use a security token service
                   STSRequester.issueRequest(config);
+                  this.constructMessage(config);
+                  msgContext.setEnvelope((SOAPEnvelope) config.getDocument()
+                            .getDocumentElement());
                 } else {
                     //Create a token
                 }
@@ -76,6 +80,7 @@
             
             
         } catch (Exception e) {
+            e.printStackTrace();
             if(e instanceof RahasException) {
                 RahasException re = (RahasException)e;
                 throw new AxisFault(re.getFaultString(), re.getFaultCode());



Mime
View raw message