1   /*
2    * $Id: XfireSamlTestCase.java 10165 2007-12-28 11:34:33Z marie.rizzo $ 
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.extras.wssecurity.testcases;
12  
13  import org.mule.extras.client.MuleClient;
14  import org.mule.tck.FunctionalTestCase;
15  import org.mule.umo.UMOMessage;
16  
17  import java.util.Properties;
18  
19  import org.apache.ws.security.handler.WSHandlerConstants;
20  
21  public class XfireSamlTestCase extends FunctionalTestCase
22  {
23      // The test cases have been suppressed because for JDK 1.4, the Xerces parser
24      // must be in an endorsed file for SAML to work. Everything works fine on JDK 1.5
25  
26      public void testBogus () throws Exception
27      {
28          // no test
29      }
30  
31      public void _testGoodUnsignedSamlTokenAuthentication () throws Exception
32      {
33          MuleClient client = new MuleClient();
34          Properties props = new Properties();
35  
36          // saml configuration file
37          props.setProperty(WSHandlerConstants.SAML_PROP_FILE, "saml.properties");
38          
39          UMOMessage m = client.send("unsignedAddr", "Test", props);
40          assertNotNull(m);
41          assertTrue(m.getPayload() instanceof String);
42          assertTrue(m.getPayload().equals("Test"));
43      }
44  
45      public void _testGoodSignedSamlTokenAuthentication () throws Exception
46      {
47          MuleClient client = new MuleClient();
48          Properties props = new Properties();
49  
50          // saml configuration file
51          props.setProperty(WSHandlerConstants.SAML_PROP_FILE, "saml.properties");
52          
53          UMOMessage m = client.send("signedAddr", "Test", props);
54          assertNotNull(m);
55          assertTrue(m.getPayload() instanceof String);
56          assertTrue(m.getPayload().equals("Test"));
57      }
58  
59      protected String getConfigResources ()
60      {
61          return "wssecurity-mule-saml-config.xml";
62      }
63  }