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/30 23:45:51 UTC

svn commit: r1781005 - in /axis/axis2/java/rampart/branches/RAMPART-423: ./ modules/rampart-core/src/main/java/org/apache/rampart/ modules/rampart-samples/policy/ modules/rampart-samples/policy/sample09/ modules/rampart-samples/src/test/java/org/apache...

Author: veithen
Date: Mon Jan 30 23:45:51 2017
New Revision: 1781005

URL: http://svn.apache.org/viewvc?rev=1781005&view=rev
Log:
Merge latest changes from trunk.

Added:
    axis/axis2/java/rampart/branches/RAMPART-423/modules/rampart-samples/policy/sample09/
      - copied from r1781004, axis/axis2/java/rampart/trunk/modules/rampart-samples/policy/sample09/
    axis/axis2/java/rampart/branches/RAMPART-423/modules/rampart-tests/test-resources/policy/soapmessage12.xml
      - copied unchanged from r1781004, axis/axis2/java/rampart/trunk/modules/rampart-tests/test-resources/policy/soapmessage12.xml
    axis/axis2/java/rampart/branches/RAMPART-423/src/site/resources/samples/msgs/req09.xml
      - copied unchanged from r1781004, axis/axis2/java/rampart/trunk/src/site/resources/samples/msgs/req09.xml
    axis/axis2/java/rampart/branches/RAMPART-423/src/site/resources/samples/msgs/res09.xml
      - copied unchanged from r1781004, axis/axis2/java/rampart/trunk/src/site/resources/samples/msgs/res09.xml
Modified:
    axis/axis2/java/rampart/branches/RAMPART-423/   (props changed)
    axis/axis2/java/rampart/branches/RAMPART-423/modules/rampart-core/src/main/java/org/apache/rampart/RampartEngine.java
    axis/axis2/java/rampart/branches/RAMPART-423/modules/rampart-samples/policy/build.xml
    axis/axis2/java/rampart/branches/RAMPART-423/modules/rampart-samples/src/test/java/org/apache/rampart/samples/runner/SampleTest.java
    axis/axis2/java/rampart/branches/RAMPART-423/modules/rampart-tests/src/test/java/org/apache/rampart/MessageBuilderTestBase.java
    axis/axis2/java/rampart/branches/RAMPART-423/modules/rampart-tests/src/test/java/org/apache/rampart/RampartEngineTest.java
    axis/axis2/java/rampart/branches/RAMPART-423/modules/rampart-trust/src/main/java/org/apache/rahas/STSMessageReceiver.java

Propchange: axis/axis2/java/rampart/branches/RAMPART-423/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jan 30 23:45:51 2017
@@ -1,2 +1,3 @@
+/axis/axis2/java/rampart/branches/RAMPART-339:1780859-1780938
 /axis/axis2/java/rampart/branches/RAMPART-433:1778760-1780751
-/axis/axis2/java/rampart/trunk:1778774-1780753
+/axis/axis2/java/rampart/trunk:1778774-1781004

Modified: axis/axis2/java/rampart/branches/RAMPART-423/modules/rampart-core/src/main/java/org/apache/rampart/RampartEngine.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-423/modules/rampart-core/src/main/java/org/apache/rampart/RampartEngine.java?rev=1781005&r1=1781004&r2=1781005&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-423/modules/rampart-core/src/main/java/org/apache/rampart/RampartEngine.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-423/modules/rampart-core/src/main/java/org/apache/rampart/RampartEngine.java Mon Jan 30 23:45:51 2017
@@ -27,17 +27,24 @@ import org.apache.commons.logging.LogFac
 import org.apache.rahas.Token;
 import org.apache.rahas.TokenStorage;
 import org.apache.rampart.policy.RampartPolicyData;
+import org.apache.rampart.policy.model.KerberosConfig;
+import org.apache.rampart.policy.model.RampartConfig;
 import org.apache.rampart.saml.SAMLAssertionHandler;
 import org.apache.rampart.saml.SAMLAssertionHandlerFactory;
 import org.apache.rampart.util.Axis2Util;
 import org.apache.rampart.util.RampartUtil;
-import org.apache.rampart.policy.model.KerberosConfig;
-import org.apache.rampart.policy.model.RampartConfig;
 import org.apache.ws.secpolicy.WSSPolicyException;
-import org.apache.ws.secpolicy.model.UsernameToken;
 import org.apache.ws.secpolicy.model.KerberosToken;
 import org.apache.ws.secpolicy.model.SupportingToken;
-import org.apache.ws.security.*;
+import org.apache.ws.secpolicy.model.UsernameToken;
+import org.apache.ws.security.NamePasswordCallbackHandler;
+import org.apache.ws.security.WSConstants;
+import org.apache.ws.security.WSPasswordCallback;
+import org.apache.ws.security.WSSConfig;
+import org.apache.ws.security.WSSecurityEngine;
+import org.apache.ws.security.WSSecurityEngineResult;
+import org.apache.ws.security.WSSecurityException;
+import org.apache.ws.security.WSUsernameTokenPrincipal;
 import org.apache.ws.security.components.crypto.Crypto;
 import org.apache.ws.security.validate.KerberosTokenDecoder;
 import org.apache.ws.security.validate.KerberosTokenValidator;
@@ -48,7 +55,11 @@ import javax.xml.namespace.QName;
 
 import java.io.IOException;
 import java.security.cert.X509Certificate;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
 
 public class RampartEngine {
 
@@ -223,8 +234,7 @@ public class RampartEngine {
 		    }
 		}
 		
-		String actorValue = secHeader.getAttributeValue(new QName(rmd
-				.getSoapConstants().getEnvelopeURI(), "actor"));
+		String actorValue = secHeader.getRole();
 
 		Crypto signatureCrypto = RampartUtil.getSignatureCrypto(rpd.getRampartConfig(), 
         		msgCtx.getAxisService().getClassLoader());
@@ -269,89 +279,90 @@ public class RampartEngine {
 		
 		//Store username in MessageContext property
 
-        for (int j = 0; j < results.size(); j++) {
-            WSSecurityEngineResult wser = (WSSecurityEngineResult) results.get(j);
-            final Integer actInt =
-                    (Integer) wser.get(WSSecurityEngineResult.TAG_ACTION);
-            if (WSConstants.ST_UNSIGNED == actInt.intValue()) {
+        if (results != null) {
+            for (int j = 0; j < results.size(); j++) {
+                WSSecurityEngineResult wser = (WSSecurityEngineResult) results.get(j);
+                final Integer actInt =
+                        (Integer) wser.get(WSSecurityEngineResult.TAG_ACTION);
+                if (WSConstants.ST_UNSIGNED == actInt.intValue()) {
 
-                Object samlAssertion = wser.get(WSSecurityEngineResult.TAG_SAML_ASSERTION);
+                    Object samlAssertion = wser.get(WSSecurityEngineResult.TAG_SAML_ASSERTION);
 
-                SAMLAssertionHandler samlAssertionHandler
-                        = SAMLAssertionHandlerFactory.createAssertionHandler(samlAssertion);
+                    SAMLAssertionHandler samlAssertionHandler
+                            = SAMLAssertionHandlerFactory.createAssertionHandler(samlAssertion);
 
-                if (samlAssertionHandler.isBearerAssertion()) {
-                    break;
-                }
-                //Store the token
-                try {
-                    TokenStorage store = rmd.getTokenStorage();
-                    if (store.getToken(samlAssertionHandler.getAssertionId()) == null) {
-                        Token token = new Token(samlAssertionHandler.getAssertionId(),
-                                samlAssertionHandler.getAssertionElement(),
-                                samlAssertionHandler.getDateNotBefore(),
-                                samlAssertionHandler.getDateNotOnOrAfter());
-
-                        token.setSecret(samlAssertionHandler.
-                                getAssertionKeyInfoSecret(signatureCrypto, tokenCallbackHandler));
-                        store.add(token);
+                    if (samlAssertionHandler.isBearerAssertion()) {
+                        break;
                     }
-                } catch (Exception e) {
-                    throw new RampartException(
-                            "errorInAddingTokenIntoStore", e);
-                }
-            } else if (WSConstants.UT == actInt) {
+                    //Store the token
+                    try {
+                        TokenStorage store = rmd.getTokenStorage();
+                        if (store.getToken(samlAssertionHandler.getAssertionId()) == null) {
+                            Token token = new Token(samlAssertionHandler.getAssertionId(),
+                                    samlAssertionHandler.getAssertionElement(),
+                                    samlAssertionHandler.getDateNotBefore(),
+                                    samlAssertionHandler.getDateNotOnOrAfter());
+
+                            token.setSecret(samlAssertionHandler.
+                                    getAssertionKeyInfoSecret(signatureCrypto, tokenCallbackHandler));
+                            store.add(token);
+                        }
+                    } catch (Exception e) {
+                        throw new RampartException(
+                                "errorInAddingTokenIntoStore", e);
+                    }
+                } else if (WSConstants.UT == actInt) {
 
-		        WSUsernameTokenPrincipal userNameTokenPrincipal = (WSUsernameTokenPrincipal)wser.get(WSSecurityEngineResult.TAG_PRINCIPAL);
+                    WSUsernameTokenPrincipal userNameTokenPrincipal = (WSUsernameTokenPrincipal)wser.get(WSSecurityEngineResult.TAG_PRINCIPAL);
 
-                String username = userNameTokenPrincipal.getName();
-                msgCtx.setProperty(RampartMessageData.USERNAME, username);
-                
-                if (userNameTokenPrincipal.getNonce() != null) {
-                    // Check whether this is a replay attack. To verify that we need to check whether nonce value
-                    // is a repeating one
-                    int nonceLifeTimeInSeconds = 0;
+                    String username = userNameTokenPrincipal.getName();
+                    msgCtx.setProperty(RampartMessageData.USERNAME, username);
+                    
+                    if (userNameTokenPrincipal.getNonce() != null) {
+                        // Check whether this is a replay attack. To verify that we need to check whether nonce value
+                        // is a repeating one
+                        int nonceLifeTimeInSeconds = 0;
 
-                    if (rpd.getRampartConfig() != null) {
-                        
-                        String stringLifeTime = rpd.getRampartConfig().getNonceLifeTime();
+                        if (rpd.getRampartConfig() != null) {
+                            
+                            String stringLifeTime = rpd.getRampartConfig().getNonceLifeTime();
 
-                        try {
-                            nonceLifeTimeInSeconds = Integer.parseInt(stringLifeTime);
+                            try {
+                                nonceLifeTimeInSeconds = Integer.parseInt(stringLifeTime);
 
-                        } catch (NumberFormatException e) {
-                            log.error("Invalid value for nonceLifeTime in rampart configuration file.", e);
-                            throw new RampartException(
-                                        "invalidNonceLifeTime", e);
+                            } catch (NumberFormatException e) {
+                                log.error("Invalid value for nonceLifeTime in rampart configuration file.", e);
+                                throw new RampartException(
+                                            "invalidNonceLifeTime", e);
 
+                            }
                         }
-                    }
 
-                    String serviceEndpointName = msgCtx.getAxisService().getEndpointName();
+                        String serviceEndpointName = msgCtx.getAxisService().getEndpointName();
+
+                        boolean valueRepeating = serviceNonceCache.isNonceRepeatingForService(serviceEndpointName, username, userNameTokenPrincipal.getNonce());
 
-                    boolean valueRepeating = serviceNonceCache.isNonceRepeatingForService(serviceEndpointName, username, userNameTokenPrincipal.getNonce());
+                        if (valueRepeating){
+                            throw new RampartException("repeatingNonceValue", new Object[]{ userNameTokenPrincipal.getNonce(), username} );
+                        }
 
-                    if (valueRepeating){
-                        throw new RampartException("repeatingNonceValue", new Object[]{ userNameTokenPrincipal.getNonce(), username} );
+                        serviceNonceCache.addNonceForService(serviceEndpointName, username, userNameTokenPrincipal.getNonce(), nonceLifeTimeInSeconds);
                     }
+                } else if (WSConstants.SIGN == actInt) {
+                    X509Certificate cert = (X509Certificate) wser.get(WSSecurityEngineResult.TAG_X509_CERTIFICATE);
 
-                    serviceNonceCache.addNonceForService(serviceEndpointName, username, userNameTokenPrincipal.getNonce(), nonceLifeTimeInSeconds);
-                }
-            } else if (WSConstants.SIGN == actInt) {
-                X509Certificate cert = (X509Certificate) wser.get(WSSecurityEngineResult.TAG_X509_CERTIFICATE);
+                    if (rpd.isAsymmetricBinding() && cert == null && rpd.getInitiatorToken() != null
+                            && !rpd.getInitiatorToken().isDerivedKeys()) {
 
-                if (rpd.isAsymmetricBinding() && cert == null && rpd.getInitiatorToken() != null
-                        && !rpd.getInitiatorToken().isDerivedKeys()) {
+                        // If symmetric binding is used, the certificate should be null.
+                        // If certificate is not null then probably initiator and
+                        // recipient are using 2 different bindings.
+                        throw new RampartException("invalidSignatureAlgo");
+                    }
 
-                    // If symmetric binding is used, the certificate should be null.
-                    // If certificate is not null then probably initiator and
-                    // recipient are using 2 different bindings.
-                    throw new RampartException("invalidSignatureAlgo");
+                    msgCtx.setProperty(RampartMessageData.X509_CERT, cert);
                 }
-
-                msgCtx.setProperty(RampartMessageData.X509_CERT, cert);
             }
-
         }
 
 		SOAPEnvelope env = Axis2Util.getSOAPEnvelopeFromDOMDocument(rmd.getDocument(), true);

Modified: axis/axis2/java/rampart/branches/RAMPART-423/modules/rampart-samples/policy/build.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-423/modules/rampart-samples/policy/build.xml?rev=1781005&r1=1781004&r2=1781005&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-423/modules/rampart-samples/policy/build.xml (original)
+++ axis/axis2/java/rampart/branches/RAMPART-423/modules/rampart-samples/policy/build.xml Mon Jan 30 23:45:51 2017
@@ -128,6 +128,16 @@
         <create.and.run.client sample.number="08"/>
     </target>
 
+    <!--Sample Service 09-->
+    <target name="service.09" if="env.AXIS2_HOME" depends="check.dependency">
+        <create.service.repo sample.number="09"/>
+    </target>
+
+    <!--Sample Client 09-->
+    <target  name="client.09" if="env.AXIS2_HOME" depends="check.dependency">
+        <create.and.run.client sample.number="09"/>
+    </target>
+
     <target name="setup">
 	<mkdir dir="${endorsed.dir}"/>
         <get src="http://repo2.maven.org/maven2/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar"
@@ -295,7 +305,10 @@
 
 	   		<copy file="${keys.dir}/client.jks" tofile="${temp.client.dir}/client.jks" overwrite="true"/>
 	   		<copy file="${keys.dir}/client.properties" tofile="${temp.client.dir}/client.properties" overwrite="true"/>
-            <copy file="sample@{sample.number}/policy.xml" tofile="${temp.client.dir}/policy.xml" overwrite="true">
+            <copy todir="${temp.client.dir}" overwrite="true">
+                <fileset dir="sample@{sample.number}">
+                    <include name="*policy*.xml"/>
+                </fileset>
                 <filterset>
                     <filter token="port" value="${client.port}"/>
                 </filterset>

Modified: axis/axis2/java/rampart/branches/RAMPART-423/modules/rampart-samples/src/test/java/org/apache/rampart/samples/runner/SampleTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-423/modules/rampart-samples/src/test/java/org/apache/rampart/samples/runner/SampleTest.java?rev=1781005&r1=1781004&r2=1781005&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-423/modules/rampart-samples/src/test/java/org/apache/rampart/samples/runner/SampleTest.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-423/modules/rampart-samples/src/test/java/org/apache/rampart/samples/runner/SampleTest.java Mon Jan 30 23:45:51 2017
@@ -44,6 +44,7 @@ public class SampleTest extends TestCase
         suite.addTest(new SampleTest("policy", "06"));
         suite.addTest(new SampleTest("policy", "07"));
         suite.addTest(new SampleTest("policy", "08"));
+        suite.addTest(new SampleTest("policy", "09"));
         return suite;
     }
 }

Modified: axis/axis2/java/rampart/branches/RAMPART-423/modules/rampart-tests/src/test/java/org/apache/rampart/MessageBuilderTestBase.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-423/modules/rampart-tests/src/test/java/org/apache/rampart/MessageBuilderTestBase.java?rev=1781005&r1=1781004&r2=1781005&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-423/modules/rampart-tests/src/test/java/org/apache/rampart/MessageBuilderTestBase.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-423/modules/rampart-tests/src/test/java/org/apache/rampart/MessageBuilderTestBase.java Mon Jan 30 23:45:51 2017
@@ -20,8 +20,6 @@ import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMXMLBuilderFactory;
 import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.soap.SOAP11Constants;
-import org.apache.axiom.soap.SOAP12Constants;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.context.ConfigurationContext;
@@ -74,7 +72,7 @@ public class MessageBuilderTestBase exte
      * @throws AxisFault
      */
     protected MessageContext getMsgCtx12() throws Exception {
-        return initMsgCtxFromMessage("test-resources/policy/soapmessage.xml");
+        return initMsgCtxFromMessage("test-resources/policy/soapmessage12.xml");
     }
 
     /**
@@ -139,16 +137,4 @@ public class MessageBuilderTestBase exte
                  "next expected element" + qnameList.next().toString());
         }
     }
-
-    public String getContentTypeForEnvelope(SOAPEnvelope env) {
-        String contentType = SOAP11Constants.SOAP_11_CONTENT_TYPE;  //default
-        if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(env.getNamespace().getNamespaceURI())) {
-            contentType = SOAP11Constants.SOAP_11_CONTENT_TYPE;
-        }
-        else if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(env.getNamespace().getNamespaceURI())) {
-            contentType = SOAP12Constants.SOAP_12_CONTENT_TYPE;
-        }
-        return contentType;
-    }
-
 }

Modified: axis/axis2/java/rampart/branches/RAMPART-423/modules/rampart-tests/src/test/java/org/apache/rampart/RampartEngineTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-423/modules/rampart-tests/src/test/java/org/apache/rampart/RampartEngineTest.java?rev=1781005&r1=1781004&r2=1781005&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-423/modules/rampart-tests/src/test/java/org/apache/rampart/RampartEngineTest.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-423/modules/rampart-tests/src/test/java/org/apache/rampart/RampartEngineTest.java Mon Jan 30 23:45:51 2017
@@ -26,74 +26,41 @@ import org.apache.axis2.context.MessageC
 import org.apache.neethi.Policy;
 import org.apache.ws.security.WSConstants;
 import org.apache.ws.security.WSSecurityEngineResult;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
 
+@RunWith(JUnit4.class)
 public class RampartEngineTest extends MessageBuilderTestBase {
-
-    public RampartEngineTest(String name) {
-        super(name);
-    }
-
+    /**
+     * Tests that Rampart complains about missing security header in request.
+     * 
+     * @throws Exception
+     */
+    @Test(expected=RampartException.class)
     public void testEmptySOAPMessage() throws Exception {
-
-        try {
-            MessageContext ctx = getMsgCtx();
-
-            String policyXml = "test-resources/policy/rampart-asymm-binding-6-3des-r15.xml";
-            Policy policy = this.loadPolicy(policyXml);
-
-            ctx.setProperty(RampartMessageData.KEY_RAMPART_POLICY, policy);
-
-            RampartEngine engine = new RampartEngine();
-            engine.process(ctx);
-        }
-        catch (RampartException e) {
-            assertEquals("Expected rampart to complain about missing security header",
-                         "Missing wsse:Security header in request", e.getMessage());
-        }
-    }
-
-    public void testValidSOAPMessage() throws Exception {
-
         MessageContext ctx = getMsgCtx();
 
         String policyXml = "test-resources/policy/rampart-asymm-binding-6-3des-r15.xml";
-        Policy policy = loadPolicy(policyXml);
+        Policy policy = this.loadPolicy(policyXml);
 
         ctx.setProperty(RampartMessageData.KEY_RAMPART_POLICY, policy);
 
-        MessageBuilder builder = new MessageBuilder();
-        builder.build(ctx);
-
-        // Building the SOAP envelope from the OMElement
-        buildSOAPEnvelope(ctx);
-
         RampartEngine engine = new RampartEngine();
-        List<WSSecurityEngineResult> results = engine.process(ctx);
+        engine.process(ctx);
+    }
 
-        /*
-        The principle purpose of the test case is to verify that the above processes
-        without throwing an exception. However, perform a minimal amount of validation on the
-        results.
-        */
-        assertNotNull("RampartEngine returned null result", results);
-        //verify cert was stored
-        X509Certificate usedCert = null;
-        for (WSSecurityEngineResult result : results) {
-            Integer action = (Integer) result.get(WSSecurityEngineResult.TAG_ACTION);
-            if (action == WSConstants.SIGN) {
-                //the result is for the signature, which contains the used certificate
-                usedCert = (X509Certificate) result.get(WSSecurityEngineResult.TAG_X509_CERTIFICATE);
-                break;
-            }
-        }
-        assertNotNull("Result of processing did not include a certificate", usedCert);
+    @Test
+    public void testValidSOAPMessage() throws Exception {
+        runRampartEngine(getMsgCtx(), "test-resources/policy/rampart-asymm-binding-6-3des-r15.xml");
     }
 
+    @Test
     public void testValidSOAP12Message() throws Exception {
+        runRampartEngine(getMsgCtx12(), "test-resources/policy/rampart-asymm-binding-6-3des-r15.xml");
+    }
 
-        MessageContext ctx = getMsgCtx12();
-
-        String policyXml = "test-resources/policy/rampart-asymm-binding-6-3des-r15.xml";
+    private void runRampartEngine(MessageContext ctx, String policyXml) throws Exception {
         Policy policy = loadPolicy(policyXml);
 
         ctx.setProperty(RampartMessageData.KEY_RAMPART_POLICY, policy);
@@ -130,7 +97,7 @@ public class RampartEngineTest extends M
         SOAPBuilder soapBuilder = new SOAPBuilder();
         SOAPEnvelope env = ctx.getEnvelope();
         ByteArrayInputStream inStream = new ByteArrayInputStream(env.toString().getBytes());
-        env = (SOAPEnvelope) soapBuilder.processDocument(inStream, getContentTypeForEnvelope(env), ctx);
+        env = (SOAPEnvelope) soapBuilder.processDocument(inStream, env.getVersion().getMediaType().toString(), ctx);
         ctx.setEnvelope(env);
     }
 }

Modified: axis/axis2/java/rampart/branches/RAMPART-423/modules/rampart-trust/src/main/java/org/apache/rahas/STSMessageReceiver.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-423/modules/rampart-trust/src/main/java/org/apache/rahas/STSMessageReceiver.java?rev=1781005&r1=1781004&r2=1781005&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-423/modules/rampart-trust/src/main/java/org/apache/rahas/STSMessageReceiver.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-423/modules/rampart-trust/src/main/java/org/apache/rahas/STSMessageReceiver.java Mon Jan 30 23:45:51 2017
@@ -39,7 +39,7 @@ public class STSMessageReceiver extends
                     .getParameter(TokenRequestDispatcherConfig.CONFIG_PARAM_KEY);
             Parameter paramFile = inMessage
                     .getParameter(TokenRequestDispatcherConfig.CONFIG_FILE_KEY);
-            TokenRequestDispatcher dispatcher = null;
+            TokenRequestDispatcher dispatcher;
             if (param != null) {
                 dispatcher = new TokenRequestDispatcher(param
                         .getParameterElement().getFirstChildWithName(
@@ -53,12 +53,8 @@ public class STSMessageReceiver extends
                                 .getProperty(TokenRequestDispatcherConfig.CONFIG_PARAM_KEY));
             }
             
-            if(dispatcher != null) {
-                SOAPEnvelope responseEnv = dispatcher.handle(inMessage, outMessage);
-                outMessage.setEnvelope(responseEnv);
-            } else {
-                throw new TrustException("missingDispatcherConfiguration");
-            }
+            SOAPEnvelope responseEnv = dispatcher.handle(inMessage, outMessage);
+			outMessage.setEnvelope(responseEnv);
         } catch (TrustException e) {
             e.printStackTrace();
             //Log the exception