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

svn commit: r1780760 - in /axis/axis2/java/rampart/branches/RAMPART-426/modules: rampart-core/src/main/java/org/apache/rampart/ rampart-core/src/main/java/org/apache/rampart/policy/builders/ rampart-core/src/main/java/org/apache/rampart/policy/model/ r...

Author: veithen
Date: Sun Jan 29 01:03:30 2017
New Revision: 1780760

URL: http://svn.apache.org/viewvc?rev=1780760&view=rev
Log:
Some cleanup.

Modified:
    axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-core/src/main/java/org/apache/rampart/RampartEngine.java
    axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-core/src/main/java/org/apache/rampart/RampartMessageData.java
    axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-core/src/main/java/org/apache/rampart/policy/builders/RampartConfigBuilder.java
    axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-core/src/main/java/org/apache/rampart/policy/model/RampartConfig.java
    axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-integration/pom.xml
    axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-tests/src/test/java/org/apache/rampart/AsymmetricBindingBuilderTest.java
    axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-tests/src/test/java/org/apache/rampart/RampartEngineTest.java

Modified: axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-core/src/main/java/org/apache/rampart/RampartEngine.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-core/src/main/java/org/apache/rampart/RampartEngine.java?rev=1780760&r1=1780759&r2=1780760&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-core/src/main/java/org/apache/rampart/RampartEngine.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-core/src/main/java/org/apache/rampart/RampartEngine.java Sun Jan 29 01:03:30 2017
@@ -292,7 +292,7 @@ public class RampartEngine {
                 //get the sec context id from the req msg ctx 
 		
 		//Store username in MessageContext property
-		
+
         for (int j = 0; j < results.size(); j++) {
             WSSecurityEngineResult wser = (WSSecurityEngineResult) results.get(j);
             final Integer actInt =
@@ -378,7 +378,6 @@ public class RampartEngine {
 
         }
 
-
 		SOAPEnvelope env = Axis2Util.getSOAPEnvelopeFromDOMDocument(rmd.getDocument(), true);
 
 		if(dotDebug){

Modified: axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-core/src/main/java/org/apache/rampart/RampartMessageData.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-core/src/main/java/org/apache/rampart/RampartMessageData.java?rev=1780760&r1=1780759&r2=1780760&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-core/src/main/java/org/apache/rampart/RampartMessageData.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-core/src/main/java/org/apache/rampart/RampartMessageData.java Sun Jan 29 01:03:30 2017
@@ -16,10 +16,6 @@
 
 package org.apache.rampart;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axis2.AxisFault;
@@ -64,6 +60,10 @@ import org.apache.ws.security.util.Loade
 import org.apache.ws.security.util.WSSecurityUtil;
 import org.w3c.dom.Document;
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
 public class RampartMessageData {
     
     /**
@@ -374,17 +374,14 @@ public class RampartMessageData {
             
             // set 'actor' of the WSSecHeader with the value from the rampart config 
             if (this.sender && this.policyData != null) {
-            	
-            	this.secHeader = new WSSecHeader();
-            	
-            	RampartConfig rampartConfig = this.policyData.getRampartConfig();
-            	if(null != rampartConfig){
-            		String actor = rampartConfig.getOutboundActor();
-            		if(null != actor){
-            			this.secHeader = new WSSecHeader(actor,true);
-            		}
-            	}
-                
+                this.secHeader = new WSSecHeader();
+                RampartConfig rampartConfig = this.policyData.getRampartConfig();
+                if(null != rampartConfig){
+                    String actor = rampartConfig.getOutboundActor();
+                    if(null != actor){
+                        this.secHeader = new WSSecHeader(actor,true);
+                    }
+                }
                 secHeader.insertSecurityHeader(this.document);
             }
             

Modified: axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-core/src/main/java/org/apache/rampart/policy/builders/RampartConfigBuilder.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-core/src/main/java/org/apache/rampart/policy/builders/RampartConfigBuilder.java?rev=1780760&r1=1780759&r2=1780760&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-core/src/main/java/org/apache/rampart/policy/builders/RampartConfigBuilder.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-core/src/main/java/org/apache/rampart/policy/builders/RampartConfigBuilder.java Sun Jan 29 01:03:30 2017
@@ -49,15 +49,15 @@ public class RampartConfigBuilder implem
         }
                 
         childElement = element.getFirstChildWithName(new QName(RampartConfig.NS,
-        		RampartConfig.INBOUND_ACTOR_LN));
+                RampartConfig.INBOUND_ACTOR_LN));
         if (childElement != null) {
-        	rampartConfig.setInboundActor(childElement.getText().trim());
+            rampartConfig.setInboundActor(childElement.getText().trim());
         }
         
         childElement = element.getFirstChildWithName(new QName(RampartConfig.NS,
-        		RampartConfig.OUTBOUND_ACTOR_LN));
+                RampartConfig.OUTBOUND_ACTOR_LN));
         if (childElement != null) {
-        	rampartConfig.setOutboundActor(childElement.getText().trim());
+            rampartConfig.setOutboundActor(childElement.getText().trim());
         }
 
         childElement = element.getFirstChildWithName(new QName(

Modified: axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-core/src/main/java/org/apache/rampart/policy/model/RampartConfig.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-core/src/main/java/org/apache/rampart/policy/model/RampartConfig.java?rev=1780760&r1=1780759&r2=1780760&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-core/src/main/java/org/apache/rampart/policy/model/RampartConfig.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-core/src/main/java/org/apache/rampart/policy/model/RampartConfig.java Sun Jan 29 01:03:30 2017
@@ -159,7 +159,7 @@ public class RampartConfig implements As
     private String nonceLifeTime = Integer.toString(DEFAULT_NONCE_LIFE_TIME);
     
     private SSLConfig sslConfig;
-
+    
     private KerberosConfig kerberosConfig;
     
     private String inboundActor;
@@ -322,15 +322,15 @@ public class RampartConfig implements As
         }
         
         if (getInboundActor() != null) {
-        	writer.writeStartElement(NS, INBOUND_ACTOR_LN);
-        	writer.writeCharacters(getInboundActor());
-        	writer.writeEndElement();
+            writer.writeStartElement(NS, INBOUND_ACTOR_LN);
+            writer.writeCharacters(getInboundActor());
+            writer.writeEndElement();
         }
         
         if (getOutboundActor() != null) {
-        	writer.writeStartElement(NS, OUTBOUND_ACTOR_LN);
-        	writer.writeCharacters(getOutboundActor());
-        	writer.writeEndElement();
+            writer.writeStartElement(NS, OUTBOUND_ACTOR_LN);
+            writer.writeCharacters(getOutboundActor());
+            writer.writeEndElement();
         }
         
         if (getUserCertAlias() != null) {
@@ -528,42 +528,42 @@ public class RampartConfig implements As
         this.timeStampStrict = Boolean.valueOf(timeStampStrict);
     }
     
-	/**	  
-	 * @return the inbound actor's URI
-	 * 
-	 */
-	public String getInboundActor() {
-		return inboundActor;
-	}
-
-	/**
-	 * Sets the SOAP 1.1 actor or SOAP 1.2 role identifying the incoming SOAP Security header to process.
-	 * If set, Rampart will expect a SOAP security header with a matching actor/role and fail if
-	 * such is not available in the request. If not set (<code>null</code>), Rampart will process the first
-	 * SOAP security header found.
-	 *  
-	 * @param the inbound actor URI to set
-	 */
-	public void setInboundActor(String inboundActorUri) {
-		this.inboundActor = inboundActorUri;
-	}	
-	
-	/**	  
-	 * @return the outbound actor's URI
-	 * 
-	 */
-	public String getOutboundActor() {
-		return outboundActor;
-	}
-
-	/**	
-	 * Sets the SOAP 1.1 actor or SOAP 1.2 role to set in the outgoing SOAP Security header.
-	 * If not set (<code>null</code>), no SOAP actor/role attribute will be set in the SOAP security header.
- 
-	 * @param the outbound actor URI to set
-	 */
-	public void setOutboundActor(String outboundActorUri) {
-		this.outboundActor = outboundActorUri;
-	}
+    /**
+     * @return the inbound actor's URI
+     * 
+     */
+    public String getInboundActor() {
+        return inboundActor;
+    }
+
+    /**
+     * Sets the SOAP 1.1 actor or SOAP 1.2 role identifying the incoming SOAP Security header to process.
+     * If set, Rampart will expect a SOAP security header with a matching actor/role and fail if
+     * such is not available in the request. If not set (<code>null</code>), Rampart will process the first
+     * SOAP security header found.
+     *  
+     * @param the inbound actor URI to set
+     */
+    public void setInboundActor(String inboundActorUri) {
+        this.inboundActor = inboundActorUri;
+    }
+    
+    /**
+     * @return the outbound actor's URI
+     * 
+     */
+    public String getOutboundActor() {
+        return outboundActor;
+    }
+
+    /**
+     * Sets the SOAP 1.1 actor or SOAP 1.2 role to set in the outgoing SOAP Security header.
+     * If not set (<code>null</code>), no SOAP actor/role attribute will be set in the SOAP security header.
+     *
+     * @param the outbound actor URI to set
+     */
+    public void setOutboundActor(String outboundActorUri) {
+        this.outboundActor = outboundActorUri;
+    }
     
 }

Modified: axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-integration/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-integration/pom.xml?rev=1780760&r1=1780759&r2=1780760&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-integration/pom.xml (original)
+++ axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-integration/pom.xml Sun Jan 29 01:03:30 2017
@@ -289,7 +289,7 @@
                                 <copy overwrite="yes" file="src/test/resources/rampart/services-37.xml" tofile="target/temp-ramp/META-INF/services.xml" />
                                 <jar jarfile="target/test-resources/rampart_service_repo/services/SecureService37.aar" basedir="target/temp-ramp" />
 
-								<!-- Service 38 -->
+                                <!-- Service 38 -->
                                 <copy overwrite="yes" file="src/test/resources/rampart/services-38.xml" tofile="target/temp-ramp/META-INF/services.xml" />
                                 <jar jarfile="target/test-resources/rampart_service_repo/services/SecureService38.aar" basedir="target/temp-ramp" />
                                 

Modified: axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-tests/src/test/java/org/apache/rampart/AsymmetricBindingBuilderTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-tests/src/test/java/org/apache/rampart/AsymmetricBindingBuilderTest.java?rev=1780760&r1=1780759&r2=1780760&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-tests/src/test/java/org/apache/rampart/AsymmetricBindingBuilderTest.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-tests/src/test/java/org/apache/rampart/AsymmetricBindingBuilderTest.java Sun Jan 29 01:03:30 2017
@@ -16,16 +16,16 @@
 
 package org.apache.rampart;
 
-import java.util.ArrayList;
-
-import javax.xml.namespace.QName;
-
 import org.apache.axiom.om.OMElement;
 import org.apache.axis2.context.MessageContext;
 import org.apache.neethi.Policy;
 import org.apache.ws.security.WSConstants;
 import org.apache.ws.security.conversation.ConversationConstants;
 
+import javax.xml.namespace.QName;
+
+import java.util.ArrayList;
+
 public class AsymmetricBindingBuilderTest extends MessageBuilderTestBase {
     
     public void testAsymmBinding() throws Exception {

Modified: axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-tests/src/test/java/org/apache/rampart/RampartEngineTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-tests/src/test/java/org/apache/rampart/RampartEngineTest.java?rev=1780760&r1=1780759&r2=1780760&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-tests/src/test/java/org/apache/rampart/RampartEngineTest.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-tests/src/test/java/org/apache/rampart/RampartEngineTest.java Sun Jan 29 01:03:30 2017
@@ -80,14 +80,6 @@ public class RampartEngineTest extends M
     		assertNotNull(e);
     	}
     }
-
-    private void buildSOAPEnvelope(MessageContext ctx) throws Exception {
-        SOAPBuilder soapBuilder = new SOAPBuilder();
-        SOAPEnvelope env = ctx.getEnvelope();
-        ByteArrayInputStream inStream = new ByteArrayInputStream(env.toString().getBytes());
-        env = (SOAPEnvelope) soapBuilder.processDocument(inStream, getContentTypeForEnvelope(env), ctx);
-        ctx.setEnvelope(env);
-    }
     
     private void runValidRampartProcessing(MessageContext ctx, String policyXmlPath) throws Exception{    	
         Policy policy = loadPolicy(policyXmlPath);
@@ -121,4 +113,12 @@ public class RampartEngineTest extends M
         }
         assertNotNull("Result of processing did not include a certificate", usedCert);
     }
+
+    private void buildSOAPEnvelope(MessageContext ctx) throws Exception {
+        SOAPBuilder soapBuilder = new SOAPBuilder();
+        SOAPEnvelope env = ctx.getEnvelope();
+        ByteArrayInputStream inStream = new ByteArrayInputStream(env.toString().getBytes());
+        env = (SOAPEnvelope) soapBuilder.processDocument(inStream, getContentTypeForEnvelope(env), ctx);
+        ctx.setEnvelope(env);
+    }
 }