View Javadoc

1   /*
2    * $Id: JaasAuthenticationWithNtLoginModule.java 22526 2011-07-22 11:13:49Z justin.calleja $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.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.module.jaas;
12  
13  import static org.junit.Assert.assertNotNull;
14  import static org.junit.Assert.assertTrue;
15  
16  import java.util.Arrays;
17  import java.util.Collection;
18  import java.util.Map;
19  
20  import org.junit.Test;
21  import org.junit.runners.Parameterized.Parameters;
22  import org.mule.api.MuleMessage;
23  import org.mule.util.SystemUtils;
24  
25  public class JaasAuthenticationWithNtLoginModule extends AbstractJaasFunctionalTestCase
26  {
27      public JaasAuthenticationWithNtLoginModule(ConfigVariant variant, String configResources)
28      {
29          super(variant, configResources);
30      }
31  
32      @Parameters
33      public static Collection<Object[]> parameters()
34      {
35          return Arrays.asList(new Object[][]{{ConfigVariant.SERVICE, "mule-conf-with-NTLoginModule.xml"}
36  
37          });
38      }
39  
40      @Override
41      protected boolean isDisabledInThisEnvironment()
42      {
43          return SystemUtils.IS_OS_UNIX;
44      }
45  
46      @Test
47      public void testCaseAuthentication() throws Exception
48      {
49          Map<String, Object> props = createMessagePropertiesWithCredentials("Marie.Rizzo", "dragon");
50          MuleMessage m = muleContext.getClient().send("vm://test", "Test", props);
51  
52          assertNotNull(m);
53          assertTrue(m.getPayload() instanceof String);
54          assertTrue(m.getPayloadAsString().equals("Test Received"));
55      }
56  }