Examples of PasswordAuthenticator


Examples of mx4j.tools.remote.PasswordAuthenticator

      JMXServiceURL url = new JMXServiceURL("rmi", "localhost", 0, "/jndi/jmx");

      // Specify the authenticator in the environment Map, using the
      // standard property JMXConnector.AUTHENTICATOR
      Map environment = new HashMap();
      JMXAuthenticator authenticator = new PasswordAuthenticator(new File(PASSWORD_FILE));
      environment.put(JMXConnectorServer.AUTHENTICATOR, authenticator);

      // Create and register the connector server
      JMXConnectorServer cntorServer = JMXConnectorServerFactory.newJMXConnectorServer(url, environment, null);
      ObjectName cntorServerName = ObjectName.getInstance(":service=" + JMXConnectorServer.class.getName() + ",protocol=" + url.getProtocol());
View Full Code Here

Examples of mx4j.tools.remote.PasswordAuthenticator

      JMXServiceURL url = new JMXServiceURL("rmi", "localhost", 0, "/jndi/jmx");

      // Specify the authenticator in the environment Map, using the
      // standard property JMXConnector.AUTHENTICATOR
      Map environment = new HashMap();
      JMXAuthenticator authenticator = new PasswordAuthenticator(new File(PASSWORD_FILE));
      environment.put(JMXConnectorServer.AUTHENTICATOR, authenticator);

      // Create and register the connector server
      JMXConnectorServer cntorServer = JMXConnectorServerFactory.newJMXConnectorServer(url, environment, null);
      ObjectName cntorServerName = ObjectName.getInstance(":service=" + JMXConnectorServer.class.getName() + ",protocol=" + url.getProtocol());
View Full Code Here

Examples of mx4j.tools.remote.PasswordAuthenticator

      super(s);
   }

   public void testAuthenticationWithNullCredentials() throws Exception
   {
      PasswordAuthenticator authenticator = new PasswordAuthenticator(preparePasswords(new String[0]));
      Object credentials = null;
      try
      {
         authenticator.authenticate(credentials);
         fail();
      }
      catch (SecurityException x)
      {
      }
View Full Code Here

Examples of mx4j.tools.remote.PasswordAuthenticator

      }
   }

   public void testAuthenticationWithBadCredentials() throws Exception
   {
      PasswordAuthenticator authenticator = new PasswordAuthenticator(preparePasswords(new String[0]));
      Object credentials = new Object();
      try
      {
         authenticator.authenticate(credentials);
         fail();
      }
      catch (SecurityException x)
      {
      }
View Full Code Here

Examples of mx4j.tools.remote.PasswordAuthenticator

      }
   }

   public void testAuthenticationWithCredentialsNull() throws Exception
   {
      PasswordAuthenticator authenticator = new PasswordAuthenticator(preparePasswords(new String[0]));
      Object credentials = new String[2];
      try
      {
         authenticator.authenticate(credentials);
         fail();
      }
      catch (SecurityException x)
      {
      }
View Full Code Here

Examples of mx4j.tools.remote.PasswordAuthenticator

      }
   }

   public void testAuthenticationWithUnknwonCredentials() throws Exception
   {
      PasswordAuthenticator authenticator = new PasswordAuthenticator(preparePasswords(new String[]{"user1", "password1"}));
      Object credentials = new String[]{"dummy", null};
      try
      {
         authenticator.authenticate(credentials);
         fail();
      }
      catch (SecurityException x)
      {
      }
View Full Code Here

Examples of mx4j.tools.remote.PasswordAuthenticator

   }

   public void testAuthenticationWithWrongCredentials() throws Exception
   {
      String user = "user1";
      PasswordAuthenticator authenticator = new PasswordAuthenticator(preparePasswords(new String[]{user, "password1"}));
      Object credentials = new String[]{user, null};
      try
      {
         authenticator.authenticate(credentials);
         fail();
      }
      catch (SecurityException x)
      {
      }
View Full Code Here

Examples of mx4j.tools.remote.PasswordAuthenticator

   public void testAuthenticationPlainSentClear() throws Exception
   {
      String user = "user1";
      String password = "password1";
      PasswordAuthenticator authenticator = new PasswordAuthenticator(preparePasswords(new String[]{user, password}));
      Object credentials = new String[]{user, password};
      // Send the password in clear
      Subject subject = authenticator.authenticate(credentials);
      assertNotNull(subject);
      Set principals = subject.getPrincipals();
      assertEquals(principals.size(), 1);
      Principal principal = (Principal)principals.iterator().next();
      assertEquals(principal.getName(), user);
View Full Code Here

Examples of mx4j.tools.remote.PasswordAuthenticator

   public void testAuthenticationPlainSentObfuscated() throws Exception
   {
      String user = "user1";
      String password = "password1";
      PasswordAuthenticator authenticator = new PasswordAuthenticator(preparePasswords(new String[]{user, password}));
      Object credentials = new String[]{user, PasswordAuthenticator.obfuscatePassword(password)};
      // Send the password obfuscated
      Subject subject = authenticator.authenticate(credentials);
      assertNotNull(subject);
      Set principals = subject.getPrincipals();
      assertEquals(principals.size(), 1);
      Principal principal = (Principal)principals.iterator().next();
      assertEquals(principal.getName(), user);
View Full Code Here

Examples of mx4j.tools.remote.PasswordAuthenticator

   public void testAuthenticationObfuscatedSentClear() throws Exception
   {
      String user = "user1";
      String password = "password1";
      PasswordAuthenticator authenticator = new PasswordAuthenticator(preparePasswords(new String[]{user, PasswordAuthenticator.obfuscatePassword(password)}));
      Object credentials = new String[]{user, password};
      // Send the password in clear
      Subject subject = authenticator.authenticate(credentials);
      assertNotNull(subject);
      Set principals = subject.getPrincipals();
      assertEquals(principals.size(), 1);
      Principal principal = (Principal)principals.iterator().next();
      assertEquals(principal.getName(), user);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.