@Test public void testDigestAuthentication() throws Exception { log.info("testDigestAuthentication - Begin"); config.saslMechanisms = Collections.singleton(DIGEST_MD5); JMXRemotingServer remotingServer = new JMXRemotingServer(config); remotingServer.start(); Map<String, Object> env = new HashMap<String, Object>(1); env.put(JMXConnector.CREDENTIALS, new String[] {"DigestUser", "DigestPassword"}); JMXConnector connector = JMXConnectorFactory.connect(serviceURL, env); assertNotNull(connector.getConnectionId()); connector.close(); // Now Try A Bad Password env.put(JMXConnector.CREDENTIALS, new String[] {"DigestUser", "BadPassword"}); try { JMXConnectorFactory.connect(serviceURL, env); fail("Expected exception not thrown."); } catch (IOException expected) { } remotingServer.stop(); }
@Test public void testLocalAuthentication() throws Exception { log.info("testLocalAuthentication - Begin"); config.saslMechanisms = Collections.singleton(JBOSS_LOCAL_USER); JMXRemotingServer remotingServer = new JMXRemotingServer(config); remotingServer.start(); Map<String, Object> env = new HashMap<String, Object>(1); JMXConnector connector = JMXConnectorFactory.connect(serviceURL, env); assertNotNull(connector.getConnectionId()); connector.close(); remotingServer.stop(); }